Skip to content

Commit

Permalink
Pass through nova region name
Browse files Browse the repository at this point in the history
If the region name is specified in the config, we need to pass it
in to the nova client constructor. Since key_name is similarly optional,
go ahead and handle both parameters the same.
  • Loading branch information
emonty committed Aug 3, 2014
1 parent 10a50b4 commit 8938222
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions library/cloud/nova_compute
Original file line number Diff line number Diff line change
Expand Up @@ -308,13 +308,14 @@ def _create_server(module, nova):
bootkwargs = {
'nics' : module.params['nics'],
'meta' : module.params['meta'],
'key_name': module.params['key_name'],
'security_groups': module.params['security_groups'].split(','),
#userdata is unhyphenated in novaclient, but hyphenated here for consistency with the ec2 module:
'userdata': module.params['user_data'],
}
if not module.params['key_name']:
del bootkwargs['key_name']

for optional_param in ('region_name', 'key_name'):
if module.params[optional_param]:
bootkwargs[optional_param] = module.params[optional_param]
try:
server = nova.servers.create(*bootargs, **bootkwargs)
server = nova.servers.get(server.id)
Expand Down

0 comments on commit 8938222

Please sign in to comment.