When pulling values out of the available configuration for returners we should always default to using keys for those returners, eg. mongo.user for the username. Otherwise in certain situations, eg. when using salt-ssh we will end up with the wrong value for the user.

This commit is contained in:
Gareth J. Greenaway 2018-11-27 18:44:11 -08:00
parent afbcf031bb
commit 35254116f3
No known key found for this signature in database
GPG key ID: 10B62F8A7CAD7A41

View file

@ -137,7 +137,10 @@ def _fetch_option(cfg, ret_config, virtualname, attr_name):
if not ret_config:
# Using the default configuration key
if isinstance(cfg, dict):
return c_cfg.get(attr_name, cfg.get(default_cfg_key))
if default_cfg_key in cfg:
return cfg[default_cfg_key]
else:
return c_cfg.get(attr_name)
else:
return c_cfg.get(attr_name, cfg(default_cfg_key))