Lots of formatting fixes

This commit is contained in:
Michael DeHaan 2013-05-24 23:46:23 -04:00
parent 333577c944
commit 4105813ebe
10 changed files with 86 additions and 87 deletions

View file

@ -154,7 +154,7 @@ def _set_tenant_id(module):
for tenant in _os_keystone.tenants.list():
if tenant.name == tenant_name:
_os_tenant_id = tenant.id
break;
break
if not _os_tenant_id:
module.fail_json(msg = "The tenant id cannot be found, please check the paramters")

View file

@ -127,7 +127,7 @@ def _set_tenant_id(module):
for tenant in _os_keystone.tenants.list():
if tenant.name == login_tenant_name:
_os_tenant_id = tenant.id
break;
break
if not _os_tenant_id:
module.fail_json(msg = "The tenant id cannot be found, please check the paramters")
@ -152,7 +152,7 @@ def _create_router(module, quantum):
'admin_state_up': module.params['admin_state_up'],
}
try:
new_router = quantum.create_router({'router': router })
new_router = quantum.create_router(dict(router=router))
except Exception as e:
module.fail_json( msg = "Error in creating router: %s" % e.message)
return new_router['router']['id']
@ -196,9 +196,6 @@ def main():
_delete_router(module, quantum, router_id)
module.exit_json(changed = True, result = "deleted")
# this is magic, see lib/ansible/module.params['common.py
#<<INCLUDE_ANSIBLE_MODULE_COMMON>>
main()

View file

@ -127,7 +127,7 @@ def _set_tenant_id(module):
for tenant in _os_keystone.tenants.list():
if tenant.name == login_tenant_name:
_os_tenant_id = tenant.id
break;
break
if not _os_tenant_id:
module.fail_json(msg = "The tenant id cannot be found, please check the paramters")

View file

@ -155,7 +155,7 @@ def _set_tenant_id(module):
for tenant in _os_keystone.tenants.list():
if tenant.name == tenant_name:
_os_tenant_id = tenant.id
break;
break
if not _os_tenant_id:
module.fail_json(msg = "The tenant id cannot be found, please check the paramters")
@ -205,15 +205,17 @@ def _create_subnet(module, quantum):
}
if module.params['allocation_pool_start'] and module.params['allocation_pool_end']:
allocation_pools = [
{'start': module.params['allocation_pool_start'],
'end': module.params['allocation_pool_end']}
{
'start' : module.params['allocation_pool_start'],
'end' : module.params['allocation_pool_end']
}
]
subnet.update({'allocation_pools': allocation_pools})
if not module.params['gateway_ip']:
subnet.pop('gateway_ip')
try:
new_subnet = quantum.create_subnet({'subnet': subnet })
except Exception as e:
new_subnet = quantum.create_subnet(dict(subnet=subnet))
except Exception, e:
module.fail_json(msg = "Failure in creating subnet: %s" % e.message)
return new_subnet['subnet']['id']