From b7dad3494e62e18232e1b6523a626293a8c7cb58 Mon Sep 17 00:00:00 2001 From: Jason Witkowski Date: Tue, 29 Mar 2016 17:01:52 -0400 Subject: [PATCH] The current module supporting F5 BIGIP pool creation does not support a setup where the port number must be zero to signify the pool will listen on multiple ports. This change implements that functionality and fixes an illogical conditional. --- network/f5/bigip_pool.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/network/f5/bigip_pool.py b/network/f5/bigip_pool.py index f65a13797fb..47ae941c44a 100644 --- a/network/f5/bigip_pool.py +++ b/network/f5/bigip_pool.py @@ -393,11 +393,11 @@ def main(): # sanity check user supplied values - if (host and not port) or (port and not host): + if (host and port is None) or (port is not None and not host): module.fail_json(msg="both host and port must be supplied") - if 1 > port > 65535: - module.fail_json(msg="valid ports must be in range 1 - 65535") + if 0 > port or port > 65535: + module.fail_json(msg="valid ports must be in range 0 - 65535") if monitors: if len(monitors) == 1: @@ -508,6 +508,10 @@ def main(): if not module.check_mode: add_pool_member(api, pool, address, port) result = {'changed': True} + if (host and port == 0) and not member_exists(api, pool, address, port): + if not module.check_mode: + add_pool_member(api, pool, address, port) + result = {'changed': True} except Exception, e: module.fail_json(msg="received exception: %s" % e)