Bug 1228890 - hammer content-view filter create ignores repos if name used instead of ID
Summary: hammer content-view filter create ignores repos if name used instead of ID
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Hammer
Version: 6.1.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: Unspecified
Assignee: Andrew Kofink
QA Contact: sthirugn@redhat.com
URL: http://projects.theforeman.org/issues...
Whiteboard:
Depends On: 1343006
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-06-06 09:32 UTC by Dirk Herrmann
Modified: 2019-11-14 06:45 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-07-27 11:32:37 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
packages after filter applied (87.27 KB, image/png)
2016-06-30 10:36 UTC, Ondřej Pražák
no flags Details
content view info (42.04 KB, image/png)
2016-06-30 10:36 UTC, Ondřej Pražák
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 14147 0 Normal Closed hammer content-view filter create ignores repos if name used instead of ID 2020-04-28 07:50:25 UTC

Description Dirk Herrmann 2015-06-06 09:32:44 UTC
Description of problem:

If I create and apply a filter rule (have tried include and exclude) and use the --repositories option to limit this filter to a particular repo there is no error message but the filter rules applies for all repos inside the CV:

hammer content-view filter create --type rpm --name 'excluding-emacs' --description 'Excluding emacs package' --inclusion=false --organization "$ORG" --repositories 'Red Hat Enterprise Linux 6 Server RPMs x86_64 6.5' --content-view "cv-os-rhel-6Server"

hammer content-view filter rule create --name 'emacs*' --organization "$ORG" --content-view "cv-os-rhel-6Server" --content-view-filter 'excluding-emacs'

If I use the --repository-id option instead of name it works as expected:

REPOID=$(hammer --csv repository list --name 'Red Hat Enterprise Linux 6 Server RPMs x86_64 6.5' --organization $ORG | grep -vi '^ID' | awk -F',' '{print $1}')
hammer content-view filter create --type rpm --name 'excluding-emacs' --description 'Excluding emacs package' --inclusion=false --organization "$ORG" --repository-ids ${REPOID} --content-view "cv-os-rhel-6Server"
hammer content-view filter rule create --name 'emacs*' --organization "$ORG" --content-view "cv-os-rhel-6Server" --content-view-filter 'excluding-emacs'


Version-Release number of selected component (if applicable):

6.1 Beta

How reproducible:

See above.

Steps to Reproduce:
1. create a CV and add repos
2. create a filter + rule using --repositories option
3. publish CV and check if the filter affects only this or all repos inside CV

Actual results:

Affected Repositories: all

Expected results:

Affected Repositories: the one I've specified

Additional info:

Comment 1 RHEL Program Management 2015-06-06 09:52:27 UTC
Since this issue was entered in Red Hat Bugzilla, the release flag has been
set to ? to ensure that it is properly evaluated for this release.

Comment 3 Oleksandr Shtaier 2015-06-29 09:27:28 UTC
For custom repos, I am getting an error:

hammer -u admin -p changeme content-view filter create --name 'test1112' --content-view-id 83 --type rpm --inclusion false --repositories OaiTYcRfJeGtArl --organization qA8YPy

Could not create the filter:
  Error: Could not find repository, please set one of options --repositories, --repository-ids.

Functionality works fine in case we use repository-ids as mentioned in initial issue description

So we have change in behavior or two defects. Will try to check with Red Hat repos.

Comment 4 Oleksandr Shtaier 2015-06-29 09:40:09 UTC
Same for Red Hat repos:

hammer -u admin -p changeme content-view filter create --name 'Test01' --content-view-id 86 --type rpm --inclusion false --repositories 'Red Hat Enterprise Virtualization Agents for RHEL 6 Workstation RPMs x86_64 6Workstation' --organization qA8YPy

Could not create the filter:
  Error: Could not find repository, please set one of options --repositories, --repository-ids.

Comment 8 Andrew Kofink 2016-03-10 21:02:42 UTC
Created redmine issue http://projects.theforeman.org/issues/14147 from this bug

Comment 9 Bryan Kearney 2016-04-15 22:07:42 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/14147 has been closed
-------------
Andrew Kofink
Applied in changeset commit:hammer-cli-katello|76dd9c5576363a90a79800e730676f9aac8c523f.

Comment 10 Ondřej Pražák 2016-06-30 10:36:08 UTC
Created attachment 1174489 [details]
packages after filter applied

Comment 11 Ondřej Pražák 2016-06-30 10:36:46 UTC
Created attachment 1174490 [details]
content view info

Comment 12 Ondřej Pražák 2016-06-30 10:39:17 UTC
The filter gets applied only to repositories specified by --repositories option
Verified on RHEL7, snap 18.1

Comment 13 Bryan Kearney 2016-07-27 11:32:37 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2016:1501


Note You need to log in before you can comment on or make changes to this bug.