Skip to content

Commit

Permalink
handle rules for the same package but different arch/version conrrectly
Browse files Browse the repository at this point in the history
  • Loading branch information
evgeni committed Nov 15, 2023
1 parent 4998177 commit 13d08d2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- content_view_filter_rule - handle multiple rules for the same package but different architectures and versions conrrectly (https://bugzilla.redhat.com/show_bug.cgi?id=2189687)
6 changes: 4 additions & 2 deletions plugins/modules/content_view_filter_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,10 @@ def main():
elif filter_type in ('rpm', 'docker', 'package_group', 'deb'):
# these filter types support many rules
# the name is the key to finding the proper one and is required for these types
content_view_filter_rule = module.find_resource_by_name('content_view_filter_rules', module.foreman_params['name'],
params=search_scope, failsafe=True)
search = [(key, module.foreman_params.get(key)) for key in ('name', 'architecture', 'version') if module.foreman_params.get(key)]
search_string = ','.join('{0}="{1}"'.format(key, val) for (key, val) in search)
content_view_filter_rule = module.find_resource('content_view_filter_rules', search_string,
params=search_scope, failsafe=True)

if filter_type == 'package_group':
# uuid is also a required value creating, but is implementation specific and not easily knowable to the end user - we find it for them
Expand Down

0 comments on commit 13d08d2

Please sign in to comment.