diff --git a/changelogs/fragments/yum_bugfux.yml b/changelogs/fragments/yum_bugfux.yml new file mode 100644 index 00000000000..08cbc17c4ab --- /dev/null +++ b/changelogs/fragments/yum_bugfux.yml @@ -0,0 +1,3 @@ +--- +minor_changes: + - fix yum module to handle list argument optional empty strings properly diff --git a/lib/ansible/module_utils/yumdnf.py b/lib/ansible/module_utils/yumdnf.py index aa3e0138a67..9fd5360c6ea 100644 --- a/lib/ansible/module_utils/yumdnf.py +++ b/lib/ansible/module_utils/yumdnf.py @@ -110,6 +110,9 @@ class YumDnf(with_metaclass(ABCMeta, object)): some_list.extend(new_list) + if some_list == [""]: + return [] + return some_list @abstractmethod diff --git a/test/integration/targets/yum/tasks/yum.yml b/test/integration/targets/yum/tasks/yum.yml index 52d58d8f96d..54bad921597 100644 --- a/test/integration/targets/yum/tasks/yum.yml +++ b/test/integration/targets/yum/tasks/yum.yml @@ -83,6 +83,16 @@ that: - "not yum_result is changed" +- name: install sos again with empty string enablerepo + yum: name=sos state=present enablerepo="" + register: yum_result +- name: verify no change on third install with empty string enablerepo + assert: + that: + - "yum_result is success" + - "not yum_result is changed" + + # INSTALL AGAIN WITH LATEST - name: install sos again with state latest in check mode yum: name=sos state=latest