Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

image_id is not required to delete a vm from openstack #3874

Merged
merged 1 commit into from
Aug 19, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 6 additions & 3 deletions library/cloud/nova_compute
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def main():
auth_url = dict(default='http://127.0.0.1:35357/v2.0/'),
region_name = dict(default=None),
name = dict(required=True),
image_id = dict(required=True),
image_id = dict(default=None),
flavor_id = dict(default=1),
key_name = dict(default=None),
security_groups = dict(default='default'),
Expand All @@ -234,8 +234,11 @@ def main():
except Exception as e:
module.fail_json( msg = "Error in authenticating to nova: %s" % e.message)
if module.params['state'] == 'present':
_get_server_state(module, nova)
_create_server(module, nova)
if not module.params['image_id']:
module.fail_json( msg = "Parameter 'image_id' is required if state == 'present'")
else:
_get_server_state(module, nova)
_create_server(module, nova)
if module.params['state'] == 'absent':
_get_server_state(module, nova)
_delete_server(module, nova)
Expand Down