set role for loading minion config

When the minion config is loaded by the MasterMinion, the role is not set, so
the vault sdb tries to communicate with the master instead of just using the
options it already has to connect to vault.

This also fixes for loading vault sdb values for salt-cloud
This commit is contained in:
Daniel Wallace 2017-12-06 14:46:58 -07:00
parent c5af2e5048
commit bfee1cead6
No known key found for this signature in database
GPG key ID: 5FA5E5544F010D48
2 changed files with 8 additions and 2 deletions

View file

@ -2150,7 +2150,8 @@ def minion_config(path,
defaults=None,
cache_minion_id=False,
ignore_config_errors=True,
minion_id=None):
minion_id=None,
role='minion'):
'''
Reads in the minion configuration file and sets up special options
@ -2190,6 +2191,7 @@ def minion_config(path,
opts = apply_minion_config(overrides, defaults,
cache_minion_id=cache_minion_id,
minion_id=minion_id)
opts['__role'] = role
apply_sdb(opts)
_validate_opts(opts)
return opts

View file

@ -739,7 +739,11 @@ class MasterMinion(object):
matcher=True,
whitelist=None,
ignore_config_errors=True):
self.opts = salt.config.minion_config(opts['conf_file'], ignore_config_errors=ignore_config_errors)
self.opts = salt.config.minion_config(
opts['conf_file'],
ignore_config_errors=ignore_config_errors,
role='master'
)
self.opts.update(opts)
self.whitelist = whitelist
self.opts['grains'] = salt.loader.grains(opts)