Content-view filter not working as expected

Problem: content-view filters not working as expected in foreman-installer-katello-3.7.0-1.el8.noarch

Expected outcome: filters used to exclude certain packages should exclude packages

Foreman and Proxy versions:
foreman-installer-3.7.0-1.el8.noarch
foreman-proxy-3.7.0-1.el8.noarch
foreman-cli-3.7.0-1.el8.noarch

Foreman and Proxy plugin versions:
foreman-dynflow-sidekiq-3.7.1-1.el8.noarch
foreman-selinux-3.7.0-1.el8.noarch
foreman-release-3.7.0-1.el8.noarch
foreman-service-3.7.1-1.el8.noarch
rubygem-foreman_remote_execution-10.0.1-1.fm3_7.el8.noarch
foreman-proxy-3.7.0-1.el8.noarch
foreman-cli-3.7.0-1.el8.noarch
rubygem-hammer_cli_foreman_remote_execution-0.2.3-1.fm3_7.el8.noarch
foreman-installer-3.7.0-1.el8.noarch
foreman-installer-katello-3.7.0-1.el8.noarch
foreman-3.7.1-1.el8.noarch
rubygem-foreman-tasks-8.1.1-1.fm3_7.el8.noarch
rubygem-foreman_maintain-1.3.2-1.el8.noarch
rubygem-hammer_cli_foreman-3.7.0-1.el8.noarch
foreman-debug-3.7.0-1.el8.noarch
rubygem-hammer_cli_foreman_tasks-0.0.19-1.fm3_7.el8.noarch
foreman-postgresql-3.7.1-1.el8.noarch

Other relevant data:

I have created a content-view named as test1 which is a composite content view and in that content there is another content view test2 which is part of composite content view test1 and I created a filter in content view test2 to exclude package named as thrift .I have added epel rhel9 repo in the filter and now I have published a new version of content view test2 and using that new version of test2 in the composite content view test2 .But the issue here is that package is not excluding from the repo and I am still getting the thrift from epel rhel9 repo which I do not want.

I tried below two ways also to encounter this issue but issue remains same.

  1. After creating the filter , I added the epel rhel9 repo to that filter and synced the repo again but published a new version of content view test2 and using the new version of test2 in the composite content view test1 but it is not working.

  2. Second time I did the same as above but now I published a new version composite content view as well test1 but still I can see the packages remains same and still I am getting conflicting thrift packages from epel rhel9 repo which I do not want.


hammer content-view filter info --id 10
Filter ID:    10
Name:         exclude-rpms
Type:         rpm
Inclusion:    false
Description:
Repositories:
 1) Id:    1
    Name:  Red Hat Ceph Storage Tools 6 for RHEL 9 x86_64 RPMs
    Label: Red_Hat_Ceph_Storage_Tools_6_for_RHEL_9_x86_64_RPMs
Rules:
 1) Id:      85
    Name:    thrift
    Created: 2024/03/12 06:37:24
    Updated: 2024/03/12 06:37:24

Any idea/suggestions/hint are highly appreciated.Thanks in advance

I don’t quite understand the problem.

You are filtering the package thrift from repository Red_Hat_Ceph_Storage_Tools_6_for_RHEL_9_x86_64_RPMs. Not epel. I don’t think ceph storage tools contains thrift.

Find the repository which contains the package thrift and exclude it from the repository which contains it.

2 Likes

Sorry it was pasted mistakenly , please ignore above code snippet.

Below is the actual one which I am taking about.

hammer content-view filter info --id 14
Filter ID:    14
Name:         exclude-rpms
Type:         rpm
Inclusion:    false
Description:
Repositories:
 1) Id:    140
    Name:  EPEL 9 x86_64
    Label: EPEL_9_x86_64
Rules:
 1) Id:      88
    Name:    thrift
    Created: 2024/03/14 08:14:58
    Updated: 2024/03/14 08:14:58

I have excluded the thrift package from rhel9 epel repository and synced this repo then published a new version of content-view which contains this repository but still getting this package.

Are you sure you are actually using the latest version of the content view?

Check in the GUI or use hammer like this:

# hammer content-view version list --content-view "test2" --organization-id 1
-----|-------------------|---------|-------------|-----------------------
ID   | NAME              | VERSION | DESCRIPTION | LIFECYCLE ENVIRONMENTS
-----|-------------------|---------|-------------|-----------------------
3828 | test2 403.0 | 403.0   |             | Library, Testing      
3818 | test2 402.0 | 402.0   |             | Production            
-----|-------------------|---------|-------------|-----------------------

then check like this if the filter has actually been applied to the newest version:

# hammer content-view version info --content-view "test2" --id 3828 --include-applied-filters true

and also check the packages included in the content view version:

# hammer package list --content-view "test2" --content-view-version-id 3828 --organization-id 1 --search 'name=thrift'

If it is still included, even though you have an exclude filter, then there is probably another filter which includes it again.

Hello @gvde ,
Thanks for your inputs, I did the same but it seems that in my environment filter is not working.

hammer content-view version list --content-view "test2" --organization-id 3
---|-----------|---------|-------------|-----------------------
ID | NAME      | VERSION | DESCRIPTION | LIFECYCLE ENVIRONMENTS
---|-----------|---------|-------------|-----------------------
98 | test2 1.0 | 1.0     |             | Library
---|-----------|---------|-------------|-----------------------

hammer content-view version info --content-view "test2" --id 98 --include-applied-filters true
Id:                     98
Name:                   test2 1.0
Version:                1.0
Description:
Content View ID:        25
Content View Name:      test2
Content View Label:     test2
Lifecycle Environments:
 1) Id:    2
    Name:  Library
    Label: Library
Repositories:
 1) Id:    1085
    Name:  EPEL 9 x86_64
    Label: EPEL_9_x86_64
Has Applied Filters:    yes
Applied Filters:
 1) Id:   17
    Name: exlude-rpms
Dependency Solving:     false


hammer package list --content-view "test2" --content-view-version-id 98 --organization-id 3 --search 'name=thrift'
-------|--------------------------------|----------------------------
ID     | FILENAME                       | SOURCE RPM
-------|--------------------------------|----------------------------
249140 | thrift-0.15.0-2.el9.x86_64.rpm | thrift-0.15.0-2.el9.src.rpm
-------|--------------------------------|----------------------------

hammer content-view filter info --id 17
Filter ID:    17
Name:         exlude-rpms
Type:         rpm
Inclusion:    false
Description:
Repositories:

Rules:
 1) Id:      91
    Name:    thrift
    Created: 2024/03/15 11:18:16
    Updated: 2024/03/15 11:18:16

Also I am not using any other filter apart from this in test2 content-view

I don’t know if it looks different on your 3.7/4.9. I have foreman 3.9.1 with katello 4.11.1 running and for me it shows the filters on a published content view like this:

...
Applied Filters:        
 1) Id:                      13
    Name:                    etckeeper
    Type:                    rpm
    Inclusion:               yes
    Original packages:       no
    Original module streams: no
    Rules:                   
     1) Id:                     37
        Name:                   etckeeper*
        Content view filter Id: 13
 2) Id:                      14
...

It looks to me as if you have published the content view when the filter was added but without any rules. Thus, publish a new version and check the new version again.

Is your package exclusion filter applied only to the EPEL repo? If you apply a filter to a subset of repositories, it won’t work on other repos in the content view. So if a different repo includes the package, it won’t be filtered out.

Hello @jeremylenz , I have applied the rules in the filter which I created for test2 content-view but still thrift package is not been excluded from that version of the content view.

hammer content-view version list --content-view "test2" --organization-id 3
----|-----------|---------|-------------|-----------------------
ID  | NAME      | VERSION | DESCRIPTION | LIFECYCLE ENVIRONMENTS
----|-----------|---------|-------------|-----------------------
111 | test2 2.0 | 2.0     |             | Library
98  | test2 1.0 | 1.0     |             |
----|-----------|---------|-------------|-----------------------

hammer content-view version info --content-view "test2" --id 111 --include-applied-filters true
Id:                     111
Name:                   test2 2.0
Version:                2.0
Description:
Content View ID:        25
Content View Name:      test2
Content View Label:     test2
Lifecycle Environments:
 1) Id:    2
    Name:  Library
    Label: Library
Repositories:
 1) Id:    1109
    Name:  EPEL 9 x86_64
    Label: EPEL_9_x86_64
Has Applied Filters:    yes
Applied Filters:
 1) Id:   17
    Name: exlude-rpms
Dependency Solving:     false

hammer content-view filter info --id 17
Filter ID:    17
Name:         exlude-rpms
Type:         rpm
Inclusion:    false
Description:
Repositories:
 1) Id:    140
    Name:  EPEL 9 x86_64
    Label: EPEL_9_x86_64
Rules:
 1) Id:      91
    Name:    thrift
    Created: 2024/03/15 11:18:16
    Updated: 2024/03/15 11:18:16

hammer package list --content-view "test2" --content-view-version-id 111 --organization-id 3 --search 'name=thrift'
-------|--------------------------------|----------------------------
ID     | FILENAME                       | SOURCE RPM
-------|--------------------------------|----------------------------
249140 | thrift-0.15.0-2.el9.x86_64.rpm | thrift-0.15.0-2.el9.src.rpm
-------|--------------------------------|----------------------------

I didn’t created any other filter apart from this then why this package is not excluding from the test2 content view. Don’t know if I am missing something :slight_smile:

Actually thrift is included in two rpms which are Redhat Ceph Storage Tools 6 for Rhel9 x86_64 RPMs in this RPM there is one thrift-0.14.0-10.el9cp.x86_64 package and in EPEL for rhel9 there is one thrift-0.15.0-2.el9.x86_64 package .

Right now I only want to exclude this package from EPEL 9 repo so I added this filter to this repository only and not to other repos.

I think the reason the package is not being excluded is that you’ve applied your filter only to the EPEL repository. If you instead apply the filter to all repositories, and then republish, it would exclude the thrift package.

It seems like you are trying to say “I want the thrift package from Redhat Ceph Storage Tools 6 for Rhel9 x86_64 RPMs and not from EPEL”. Content view filters do not allow for this use case, as far as I understand. (cc @sajha , please correct me if I’m wrong / any other ideas?)

Why do you want to prefer one repo over the other? Perhaps a package filter (applied to all repositories) with a version restriction would work better.

1 Like