yum/dnf: fail when space separated string of names (#47109)

* yum/dnf: fail when space separated string of names

* Groups allow spaces in names
This commit is contained in:
Martin Krizek
2018-10-19 20:29:27 +02:00
committed by ansibot
parent c21f92f8f7
commit e8b6864e21
3 changed files with 13 additions and 3 deletions

View File

@@ -95,6 +95,15 @@ class YumDnf(with_metaclass(ABCMeta, object)):
self.enablerepo = self.listify_comma_sep_strings_in_list(self.enablerepo)
self.exclude = self.listify_comma_sep_strings_in_list(self.exclude)
# Fail if someone passed a space separated string
# https://github.com/ansible/ansible/issues/46301
if any((' ' in name and '@' not in name for name in self.names)):
module.fail_json(
msg='It appears that a space separated string of packages was passed in '
'as an argument. To operate on several packages, pass a comma separated '
'string of packages or a list of packages.'
)
# This should really be redefined by both the yum and dnf module but a
# default isn't a bad idea
self.lockfile = '/var/run/yum.pid'