From 2545f9702b46f247f308857310f7a70464428cf6 Mon Sep 17 00:00:00 2001 From: Rafael Guterres Jeffman <rjeffman@redhat.com> Date: Thu, 29 Apr 2021 19:57:23 -0300 Subject: [PATCH] Fix excessive number of returns. --- plugins/module_utils/ansible_freeipa_module.py | 10 +--------- plugins/modules/ipadnszone.py | 16 ++++++---------- 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/plugins/module_utils/ansible_freeipa_module.py b/plugins/module_utils/ansible_freeipa_module.py index 338e0f7c..a18a89f7 100644 --- a/plugins/module_utils/ansible_freeipa_module.py +++ b/plugins/module_utils/ansible_freeipa_module.py @@ -294,16 +294,8 @@ else: # If both args and ipa are None, return there's no difference. # If only one is None, return there is a difference. # This tests avoid unecessary invalid access to attributes. - if args is None and ipa is None: - return True if args is None or ipa is None: - module.debug( - base_debug_msg + "args is%s None an ipa is%s None" % ( - "" if args is None else " not", - "" if ipa is None else " not", - ) - ) - return False + return args is None and ipa is None # Fail if args or ipa are not dicts. if not (isinstance(args, dict) and isinstance(ipa, dict)): diff --git a/plugins/modules/ipadnszone.py b/plugins/modules/ipadnszone.py index 07b1df81..ae8ed93a 100644 --- a/plugins/modules/ipadnszone.py +++ b/plugins/modules/ipadnszone.py @@ -269,16 +269,12 @@ class DNSZoneModule(FreeIPABaseModule): except ValueError: return False - if not all([part1.isdigit(), part2.isdigit(), part3.isdigit()]): - return False - - if not 0 <= int(part1) <= 255: - return False - - if not 0 <= int(part2) <= 255: - return False - - if not 0 <= int(part3) <= 65535: + if ( + not all([part1.isdigit(), part2.isdigit(), part3.isdigit()]) + or not 0 <= int(part1) <= 255 + or not 0 <= int(part2) <= 255 + or not 0 <= int(part3) <= 65535 + ): return False try: -- GitLab