From 617048b7175a86bfa92216d8f3c9cb805b70e2ac Mon Sep 17 00:00:00 2001 From: Matt Martz Date: Thu, 15 Jan 2015 19:13:32 -0600 Subject: [PATCH] It is not correct that you need at least 1 primary node --- .../modules/cloud/rackspace/rax_clb_nodes.py | 24 +------------------ 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/lib/ansible/modules/cloud/rackspace/rax_clb_nodes.py b/lib/ansible/modules/cloud/rackspace/rax_clb_nodes.py index 24325b44597..472fad19b1c 100644 --- a/lib/ansible/modules/cloud/rackspace/rax_clb_nodes.py +++ b/lib/ansible/modules/cloud/rackspace/rax_clb_nodes.py @@ -150,21 +150,6 @@ def _get_node(lb, node_id=None, address=None, port=None): return None -def _is_primary(node): - """Return True if node is primary and enabled""" - return (node.type.lower() == 'primary' and - node.condition.lower() == 'enabled') - - -def _get_primary_nodes(lb): - """Return a list of primary and enabled nodes""" - nodes = [] - for node in lb.nodes: - if _is_primary(node): - nodes.append(node) - return nodes - - def main(): argument_spec = rax_argument_spec() argument_spec.update( @@ -230,13 +215,6 @@ def main(): if state == 'absent': if not node: # Removing a non-existent node module.exit_json(changed=False, state=state) - - # The API detects this as well but currently pyrax does not return a - # meaningful error message - if _is_primary(node) and len(_get_primary_nodes(lb)) == 1: - module.fail_json( - msg='At least one primary node has to be enabled') - try: lb.delete_node(node) result = {} @@ -299,5 +277,5 @@ def main(): from ansible.module_utils.basic import * from ansible.module_utils.rax import * -### invoke the module +# invoke the module main()