Fix invocations of module.fail_json with no msg=

Bonus: add missing % in cs_nic.py
This commit is contained in:
Kamil Cholewiński
2017-03-07 13:51:38 +01:00
committed by Brian Coca
parent 91860b2423
commit ec9582fd83
15 changed files with 25 additions and 25 deletions

View File

@@ -230,7 +230,7 @@ def main():
module.fail_json(msg="region must be specified")
if dns_hostnames and not dns_support:
module.fail_json('In order to enable DNS Hostnames you must also enable DNS support')
module.fail_json(msg='In order to enable DNS Hostnames you must also enable DNS support')
if state == 'present':

View File

@@ -651,7 +651,7 @@ def main():
state = module.params.get('state', 'present')
if lookup == 'id' and route_table_id is None:
module.fail_json("You must specify route_table_id if lookup is set to id")
module.fail_json(msg="You must specify route_table_id if lookup is set to id")
try:
if state == 'present':

View File

@@ -167,7 +167,7 @@ def check_valid_modification(module, values, modifiable_params):
# check valid modifiable parameters
if parameter not in modifiable_params:
module.fail_json("%s is not a modifiable parameter. Valid parameters to modify are: %s." % (parameter, modifiable_params.keys()))
module.fail_json(msg="%s is not a modifiable parameter. Valid parameters to modify are: %s." % (parameter, modifiable_params.keys()))
# check allowed datatype for modified parameters
str_to_type = {"integer": int, "string": text_type}

View File

@@ -231,7 +231,7 @@ def main():
"the ARN is correct and your profile has "
"permissions to execute this function.",
exception=traceback.format_exc())
module.fail_json("Client-side error when invoking Lambda, check inputs and specific error",
module.fail_json(msg="Client-side error when invoking Lambda, check inputs and specific error",
exception=traceback.format_exc())
except botocore.exceptions.ParamValidationError as ve:
module.fail_json(msg="Parameters to `invoke` failed to validate",

View File

@@ -191,7 +191,7 @@ class AnsibleCloudStackNic(AnsibleCloudStack):
if nics:
self.nic = nics['nic'][0]
return self.nic
self.module.fail_json("NIC for VM %s in network %s not found" (self.get_vm(key='name'), self.get_network(key='name')))
self.module.fail_json(msg="NIC for VM %s in network %s not found" %(self.get_vm(key='name'), self.get_network(key='name')))
def get_secondary_ip(self):
nic = self.get_nic()

View File

@@ -232,7 +232,7 @@ def _get_net_id(neutron, module):
try:
networks = neutron.list_networks(**kwargs)
except Exception as e:
module.fail_json("Error in listing neutron networks: %s" % e.message)
module.fail_json(msg="Error in listing neutron networks: %s" % e.message)
if not networks['networks']:
return None
return networks['networks'][0]['id']

View File

@@ -182,7 +182,7 @@ def _delete_router(module, neutron, router_id):
try:
neutron.delete_router(router_id)
except:
module.fail_json("Error in deleting the router")
module.fail_json(msg="Error in deleting the router")
return True
def main():

View File

@@ -154,7 +154,7 @@ def _get_net_id(neutron, module):
try:
networks = neutron.list_networks(**kwargs)
except Exception as e:
module.fail_json("Error in listing neutron networks: %s" % e.message)
module.fail_json(msg="Error in listing neutron networks: %s" % e.message)
if not networks['networks']:
return None
return networks['networks'][0]['id']

View File

@@ -200,7 +200,7 @@ def _get_net_id(neutron, module):
try:
networks = neutron.list_networks(**kwargs)
except Exception as e:
module.fail_json("Error in listing neutron networks: %s" % e.message)
module.fail_json(msg="Error in listing neutron networks: %s" % e.message)
if not networks['networks']:
return None
return networks['networks'][0]['id']