summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Krizek <martin.krizek@gmail.com>2020-06-17 21:06:59 +0200
committerGitHub <noreply@github.com>2020-06-17 12:06:59 -0700
commit055a24c027d214d6cf75767fd54565c53bf3c8d2 (patch)
treeac4d3fc56c5d7570b8ddfccc1540a3151a990ae4
parentf79c606aae07c8ee9413bf44c22f347ef9ffaf26 (diff)
downloadansible-055a24c027d214d6cf75767fd54565c53bf3c8d2.tar.gz
yum/dnf: check type of elements in a name (#70072) (#70089)
(cherry picked from commit 843751a00dc88ce69c10f09163a58a6772a91894)
-rw-r--r--changelogs/fragments/yum-dnf-elements-type-in-name-list.yml2
-rw-r--r--lib/ansible/module_utils/yumdnf.py2
-rw-r--r--lib/ansible/modules/packaging/os/dnf.py2
-rw-r--r--lib/ansible/modules/packaging/os/yum.py2
4 files changed, 7 insertions, 1 deletions
diff --git a/changelogs/fragments/yum-dnf-elements-type-in-name-list.yml b/changelogs/fragments/yum-dnf-elements-type-in-name-list.yml
new file mode 100644
index 0000000000..7817ecabc3
--- /dev/null
+++ b/changelogs/fragments/yum-dnf-elements-type-in-name-list.yml
@@ -0,0 +1,2 @@
+bugfixes:
+ - yum/dnf - check type of elements in a name
diff --git a/lib/ansible/module_utils/yumdnf.py b/lib/ansible/module_utils/yumdnf.py
index b3ed22bd24..47539bf3bd 100644
--- a/lib/ansible/module_utils/yumdnf.py
+++ b/lib/ansible/module_utils/yumdnf.py
@@ -37,7 +37,7 @@ yumdnf_argument_spec = dict(
install_repoquery=dict(type='bool', default=True),
install_weak_deps=dict(type='bool', default=True),
list=dict(type='str'),
- name=dict(type='list', aliases=['pkg'], default=[]),
+ name=dict(type='list', elements='str', aliases=['pkg'], default=[]),
releasever=dict(default=None),
security=dict(type='bool', default=False),
skip_broken=dict(type='bool', default=False),
diff --git a/lib/ansible/modules/packaging/os/dnf.py b/lib/ansible/modules/packaging/os/dnf.py
index 70a9522688..a2d5014911 100644
--- a/lib/ansible/modules/packaging/os/dnf.py
+++ b/lib/ansible/modules/packaging/os/dnf.py
@@ -33,6 +33,8 @@ options:
required: true
aliases:
- pkg
+ type: list
+ elements: str
list:
description:
diff --git a/lib/ansible/modules/packaging/os/yum.py b/lib/ansible/modules/packaging/os/yum.py
index 0b17c22cbe..69cc9aa2d9 100644
--- a/lib/ansible/modules/packaging/os/yum.py
+++ b/lib/ansible/modules/packaging/os/yum.py
@@ -41,6 +41,8 @@ options:
- You can also pass a url or a local path to a rpm file (using state=present).
To operate on several packages this can accept a comma separated string of packages or (as of 2.0) a list of packages.
aliases: [ pkg ]
+ type: list
+ elements: str
exclude:
description:
- Package name(s) to exclude when state=present, or latest