diff options
author | Serge van Ginderachter <serge@vanginderachter.be> | 2013-09-07 13:31:35 +0200 |
---|---|---|
committer | Serge van Ginderachter <serge@vanginderachter.be> | 2013-10-21 20:36:25 +0200 |
commit | 7454038d82c9f300fcc7e69008d874a162d7e983 (patch) | |
tree | b5229875bc7b137e5e408441739cd101af046bde | |
parent | ad5247b82be184e705db399fb9590eafaa522ef1 (diff) | |
download | ansible-7454038d82c9f300fcc7e69008d874a162d7e983.tar.gz |
improve logic in setting parameters in check mode (monitor might not exist)
-rw-r--r-- | library/net_infrastructure/bigip_monitor_http | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/library/net_infrastructure/bigip_monitor_http b/library/net_infrastructure/bigip_monitor_http index ded8d554cf..6f3d492bd9 100644 --- a/library/net_infrastructure/bigip_monitor_http +++ b/library/net_infrastructure/bigip_monitor_http @@ -386,6 +386,7 @@ def main(): result['changed'] |= True else: # state present + ## check for monitor itself if not monitor_exists: # create it if not module.check_mode: # again, check changed status here b/c race conditions @@ -394,19 +395,22 @@ def main(): else: result['changed'] |= True + ## check for monitor parameters # whether it already existed, or was just created, now update - # attributes and properties - # the update functions need to check for check mode - result['changed'] |= update_monitor_properties(api, module, monitor, - template_string_properties, - template_integer_properties) + # the update functions need to check for check mode but + # cannot update settings if it doesn't exist which happens in check mode + if monitor_exists and not module.check_mode: + result['changed'] |= update_monitor_properties(api, module, monitor, + template_string_properties, + template_integer_properties) + # else assume nothing changed # monitor specific stuff # we just have to update the ipport if monitor already exists and it's different if monitor_exists and cur_ipport != ipport: - if not monitor_exists: - set_ipport(api, monitor, ipport) + set_ipport(api, monitor, ipport) result['changed'] |= True + #else: monitor doesn't exist (check mode) or ipport is already ok # monitor specific stuff |