mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
allow virtual aliases to be used for the driver name
This checks if the driver name for cloud is in any passed in virtual_aliases.
This commit is contained in:
parent
60c9490bdc
commit
45249d3e10
2 changed files with 6 additions and 5 deletions
|
@ -83,9 +83,10 @@ def get_configured_provider():
|
|||
Return the first configured instance.
|
||||
'''
|
||||
return config.is_provider_configured(
|
||||
__opts__,
|
||||
__active_provider_name__ or __virtualname__,
|
||||
('personal_access_token',)
|
||||
opts=__opts__,
|
||||
provider=__active_provider_name__ or __virtualname__,
|
||||
aliases=__virtual_aliases__,
|
||||
required_keys=('personal_access_token',)
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -3325,7 +3325,7 @@ def get_cloud_config_value(name, vm_, opts, default=None, search_global=True):
|
|||
return value
|
||||
|
||||
|
||||
def is_provider_configured(opts, provider, required_keys=(), log_message=True):
|
||||
def is_provider_configured(opts, provider, required_keys=(), log_message=True, aliases=()):
|
||||
'''
|
||||
Check and return the first matching and fully configured cloud provider
|
||||
configuration.
|
||||
|
@ -3353,7 +3353,7 @@ def is_provider_configured(opts, provider, required_keys=(), log_message=True):
|
|||
|
||||
for alias, drivers in six.iteritems(opts['providers']):
|
||||
for driver, provider_details in six.iteritems(drivers):
|
||||
if driver != provider:
|
||||
if driver != provider and driver not in aliases:
|
||||
continue
|
||||
|
||||
# If we reached this far, we have a matching provider, let's see if
|
||||
|
|
Loading…
Add table
Reference in a new issue