summaryrefslogtreecommitdiff
path: root/lib/ansible/modules/dnf.py
diff options
context:
space:
mode:
authorRick Elrod <rick@elrod.me>2020-09-15 10:36:18 -0500
committerGitHub <noreply@github.com>2020-09-15 11:36:18 -0400
commitfdf80690e40a58abd458d57be4cbcc3d985218e7 (patch)
tree3680544daacf7ad58396d4d5e59d667bd8da441e /lib/ansible/modules/dnf.py
parent70485421998463036c93ce927b3029fd0e7d4301 (diff)
downloadansible-fdf80690e40a58abd458d57be4cbcc3d985218e7.tar.gz
[dnf] accumulate update filters (#71726)
Change: - Previously when `security: true` and `bugfix: true` were both given, only security updates would get applied. Filters now accumulate so that both get applied in this case. Test Plan: - New integration tests for both check_mode and not. These tests make use of a contrived yum repository which is stored in S3. Tickets: - Fixes #70854 Signed-off-by: Rick Elrod <rick@elrod.me> Co-authored-by: Matt Martz <matt@sivel.net> Co-authored-by: Matt Martz <matt@sivel.net>
Diffstat (limited to 'lib/ansible/modules/dnf.py')
-rw-r--r--lib/ansible/modules/dnf.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/ansible/modules/dnf.py b/lib/ansible/modules/dnf.py
index 1ede9a0444..3b97ab9675 100644
--- a/lib/ansible/modules/dnf.py
+++ b/lib/ansible/modules/dnf.py
@@ -654,12 +654,16 @@ class DnfModule(YumDnf):
results=[],
rc=1
)
+
+ filters = []
if self.bugfix:
key = {'advisory_type__eq': 'bugfix'}
- base._update_security_filters = [base.sack.query().filter(**key)]
+ filters.append(base.sack.query().filter(**key))
if self.security:
key = {'advisory_type__eq': 'security'}
- base._update_security_filters = [base.sack.query().filter(**key)]
+ filters.append(base.sack.query().filter(**key))
+ if filters:
+ base._update_security_filters = filters
return base