mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #45953 from rallytime/bp-45928-2017.7.3
Back-port #45928 to 2017.7.3
This commit is contained in:
commit
6530649dbc
1 changed files with 6 additions and 1 deletions
|
@ -98,7 +98,7 @@ def _get_vault_connection():
|
|||
Get the connection details for calling Vault, from local configuration if
|
||||
it exists, or from the master otherwise
|
||||
'''
|
||||
if 'vault' in __opts__ and __opts__.get('__role', 'minion') == 'master':
|
||||
def _use_local_config():
|
||||
log.debug('Using Vault connection details from local config')
|
||||
try:
|
||||
return {
|
||||
|
@ -108,6 +108,11 @@ def _get_vault_connection():
|
|||
except KeyError as err:
|
||||
errmsg = 'Minion has "vault" config section, but could not find key "{0}" within'.format(err.message)
|
||||
raise salt.exceptions.CommandExecutionError(errmsg)
|
||||
|
||||
if 'vault' in __opts__ and __opts__.get('__role', 'minion') == 'master':
|
||||
return _use_local_config()
|
||||
elif '_ssh_version' in __opts__:
|
||||
return _use_local_config()
|
||||
else:
|
||||
log.debug('Contacting master for Vault connection details')
|
||||
return _get_token_and_url_from_master()
|
||||
|
|
Loading…
Add table
Reference in a new issue