Fix order of logic to determine required args
This commit is contained in:
parent
a0dad8e683
commit
724ae97898
1 changed files with 3 additions and 3 deletions
|
@ -437,14 +437,14 @@ def cloudservers(module, state=None, name=None, flavor=None, image=None,
|
||||||
'incorrectly capitalized region name.')
|
'incorrectly capitalized region name.')
|
||||||
|
|
||||||
if state == 'present' or (state == 'absent' and instance_ids is None):
|
if state == 'present' or (state == 'absent' and instance_ids is None):
|
||||||
|
if not boot_from_volume and not boot_volume and not image:
|
||||||
|
module.fail_json(msg='image is required for the "rax" module')
|
||||||
|
|
||||||
for arg, value in dict(name=name, flavor=flavor).iteritems():
|
for arg, value in dict(name=name, flavor=flavor).iteritems():
|
||||||
if not value:
|
if not value:
|
||||||
module.fail_json(msg='%s is required for the "rax" module' %
|
module.fail_json(msg='%s is required for the "rax" module' %
|
||||||
arg)
|
arg)
|
||||||
|
|
||||||
if not boot_from_volume and not boot_volume and not image:
|
|
||||||
module.fail_json(msg='image is required for the "rax" module')
|
|
||||||
|
|
||||||
if boot_from_volume and not image and not boot_volume:
|
if boot_from_volume and not image and not boot_volume:
|
||||||
module.fail_json(msg='image or boot_volume are required for the '
|
module.fail_json(msg='image or boot_volume are required for the '
|
||||||
'"rax" with boot_from_volume')
|
'"rax" with boot_from_volume')
|
||||||
|
|
Loading…
Reference in a new issue