diff --git a/changelogs/fragments/7125-fix-inappropriate-comparison.yml b/changelogs/fragments/7125-fix-inappropriate-comparison.yml new file mode 100644 index 0000000000..7bcfb1edd5 --- /dev/null +++ b/changelogs/fragments/7125-fix-inappropriate-comparison.yml @@ -0,0 +1,2 @@ +bugfixes: + - oci_utils module util - fix inappropriate logical comparison expressions and makes them simpler. The previous checks had logical short circuits (https://github.com/ansible-collections/community.general/pull/7125). diff --git a/plugins/module_utils/oracle/oci_utils.py b/plugins/module_utils/oracle/oci_utils.py index 9d8e16e5a3..717d253cec 100644 --- a/plugins/module_utils/oracle/oci_utils.py +++ b/plugins/module_utils/oracle/oci_utils.py @@ -561,7 +561,7 @@ def are_lists_equal(s, t): if s is None and t is None: return True - if (s is None and len(t) >= 0) or (t is None and len(s) >= 0) or (len(s) != len(t)): + if s is None or t is None or (len(s) != len(t)): return False if len(s) == 0: @@ -1026,10 +1026,7 @@ def check_if_user_value_matches_resources_attr( return if ( - resources_value_for_attr is None - and len(user_provided_value_for_attr) >= 0 - or user_provided_value_for_attr is None - and len(resources_value_for_attr) >= 0 + resources_value_for_attr is None or user_provided_value_for_attr is None ): res[0] = False return