Merge pull request #24880 from dkiser/salt-cloud-24871

Fix to allow password for salt-cloud to be set outside of a vm specif…
This commit is contained in:
Joseph Hall 2015-06-22 17:44:59 -06:00
commit ddaa21c0ae

View file

@ -303,7 +303,14 @@ def bootstrap(vm_, opts):
if stat.S_ISSOCK(os.stat(os.environ['SSH_AUTH_SOCK']).st_mode):
has_ssh_agent = True
if key_filename is None and ('password' not in vm_ or not vm_['password']) and has_ssh_agent is False:
if (key_filename is None and
salt.config.get_cloud_config_value(
'password', vm_, opts, default=None
) is None and
salt.config.get_cloud_config_value(
'win_password', vm_, opts, default=None
) is None and
has_ssh_agent is False):
raise SaltCloudSystemExit(
'Cannot deploy salt in a VM if the \'ssh_keyfile\' setting '
'is not set and there is no password set for the vm. '