cloud roster: Check provider and profile configs for ssh_username

Pass the vm_ variable with provider and profile info to
salt.utils.cloud.ssh_usernames in order to lookup ssh_username not only
in the main salt-cloud config file but in provider and profile
configuration as well. It is the same way all other settings are
retrieved in the cloud roster.
This commit is contained in:
Sergei Zviagintsev 2017-03-11 16:04:49 +01:00
parent a18250b2e4
commit 1b45c8e8c2

View file

@ -92,7 +92,7 @@ def targets(tgt, tgt_type='glob', **kwargs): # pylint: disable=W0613
cloud_opts = salt.config.cloud_config(
os.path.join(os.path.dirname(__opts__['conf_file']), 'cloud')
)
ssh_username = salt.utils.cloud.ssh_usernames({}, cloud_opts)
ssh_username = salt.utils.cloud.ssh_usernames(vm_, cloud_opts)
if isinstance(ssh_username, string_types):
ret[tgt]['user'] = ssh_username
elif isinstance(ssh_username, list):