From 724ae97898f8e4918e166e24624e0d37f8e9ad6d Mon Sep 17 00:00:00 2001 From: Matt Martz Date: Thu, 18 Dec 2014 13:02:44 -0600 Subject: [PATCH] Fix order of logic to determine required args --- lib/ansible/modules/cloud/rackspace/rax.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/ansible/modules/cloud/rackspace/rax.py b/lib/ansible/modules/cloud/rackspace/rax.py index 4ec49e9736..3f6f7f334b 100644 --- a/lib/ansible/modules/cloud/rackspace/rax.py +++ b/lib/ansible/modules/cloud/rackspace/rax.py @@ -437,14 +437,14 @@ def cloudservers(module, state=None, name=None, flavor=None, image=None, 'incorrectly capitalized region name.') 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(): if not value: module.fail_json(msg='%s is required for the "rax" module' % 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: module.fail_json(msg='image or boot_volume are required for the ' '"rax" with boot_from_volume')