diff options
author | Rick Elrod <rick@elrod.me> | 2020-09-15 10:36:18 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-15 11:36:18 -0400 |
commit | fdf80690e40a58abd458d57be4cbcc3d985218e7 (patch) | |
tree | 3680544daacf7ad58396d4d5e59d667bd8da441e /lib/ansible/modules/dnf.py | |
parent | 70485421998463036c93ce927b3029fd0e7d4301 (diff) | |
download | ansible-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.py | 8 |
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 |