diff --git a/lib/ansible/module_utils/yumdnf.py b/lib/ansible/module_utils/yumdnf.py index 97165b3055..21ddf5a5a4 100644 --- a/lib/ansible/module_utils/yumdnf.py +++ b/lib/ansible/module_utils/yumdnf.py @@ -130,6 +130,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 52d58d8f96..54bad92159 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