fixing calls to fail_json

This commit is contained in:
Charles Paul 2015-10-12 08:50:18 -05:00
parent 50372eecc9
commit 3d533cb423

View file

@ -196,26 +196,26 @@ VCHS_REQ_ARGS = ['service_id']
def _validate_module(module): def _validate_module(module):
if not HAS_PYVCLOUD: if not HAS_PYVCLOUD:
module.fail_json("python module pyvcloud is needed for this module") module.fail_json(msg="python module pyvcloud is needed for this module")
service_type = module.params.get('service_type', DEFAULT_SERVICE_TYPE) service_type = module.params.get('service_type', DEFAULT_SERVICE_TYPE)
if service_type == 'vca': if service_type == 'vca':
for arg in VCA_REQ_ARGS: for arg in VCA_REQ_ARGS:
if module.params.get(arg) is None: if module.params.get(arg) is None:
module.fail_json("argument %s is mandatory when service type " module.fail_json(msg="argument %s is mandatory when service type "
"is vca" % arg) "is vca" % arg)
if service_type == 'vchs': if service_type == 'vchs':
for arg in VCHS_REQ_ARGS: for arg in VCHS_REQ_ARGS:
if module.params.get(arg) is None: if module.params.get(arg) is None:
module.fail_json("argument %s is mandatory when service type " module.fail_json(msg="argument %s is mandatory when service type "
"is vchs" % arg) "is vchs" % arg)
if service_type == 'vcd': if service_type == 'vcd':
for arg in VCD_REQ_ARGS: for arg in VCD_REQ_ARGS:
if module.params.get(arg) is None: if module.params.get(arg) is None:
module.fail_json("argument %s is mandatory when service type " module.fail_json(msg="argument %s is mandatory when service type "
"is vcd" % arg) "is vcd" % arg)