Add change_password option for openstack providers

Document as well
This commit is contained in:
Daniel Wallace 2014-05-14 10:37:58 -05:00
parent f1e2df5657
commit 045d0cbdc1
3 changed files with 21 additions and 2 deletions

View File

@ -90,3 +90,12 @@ Here is an example of a profile:
``image`` can be one of the options listed in the output of ``nova image-list``.
change_password
~~~~~~~~~~~~~~~
If no ssh_key_file is provided, and the server already exists, change_password
will use the api to change the root password of the server so that it can be
bootstrapped.
.. code-block:: yaml
change_password: True

View File

@ -553,8 +553,9 @@ def create(vm_):
__opts__
)
)
vm_['password'] = sup.secure_password()
conn.root_password(vm_['instance_id'], vm_['password'])
if vm_['key_filename'] is None and 'change_password' in __opts__ and __opts__['change_password'] is True:
vm_['password'] = sup.secure_password()
conn.root_password(vm_['instance_id'], vm_['password'])
else:
# Put together all of the information required to request the instance,
# and then fire off the request for it

View File

@ -291,6 +291,15 @@ def bootstrap(vm_, opts):
'system for the password.'
)
if key_filename is None and ('password' not in vm_ or not vm_['password']):
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. '
'Check your provider for the \'change_password\' option.'
)
ret = {}
deploy_script_code = os_script(