Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1386726

Summary: hammer - attribute --content-view does not work in many subcommands of content-view filter rule
Product: Red Hat Satellite Reporter: Martin Korbel <mkorbel>
Component: Content ManagementAssignee: Andrew Kofink <akofink>
Status: CLOSED ERRATA QA Contact: Brad Buckingham <bbuckingham>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.3.0CC: ajambhul, bbuckingham, dhlavacd, jcallaha, tstrachota
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-02-21 16:54:37 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Martin Korbel 2016-10-19 14:10:11 UTC
Description of problem:
In several cases I detected problem with attribute --content-view. We get this error:

Error: Could not find organization. Some search options were missing, please see --help.

Version-Release number of selected component (if applicable):
tfm-rubygem-hammer_cli-0.8.0-1

How reproducible:
100%

Steps to Reproduce:
1. We have got content view (in my case test view)
> hammer content-view list
----------------|---------------------------|---------------------------|-----------|---------------------|---------------
CONTENT VIEW ID | NAME                      | LABEL                     | COMPOSITE | LAST PUBLISHED      | REPOSITORY IDS
----------------|---------------------------|---------------------------|-----------|---------------------|---------------
2               | test view                 | test_view                 |           | 2016/10/19 12:35:48 | 2             
1               | Default Organization View | Default_Organization_View |           | 2016/10/17 10:02:42 |               
----------------|---------------------------|---------------------------|-----------|---------------------|---------------

2. Create filter
> hammer content-view filter create --content-view "test view"  --name "test" --inclusion=false --type=rpm --organization="Default Organization"
Filter created

3. list rules
> hammer content-view filter rule list --content-view "test view" --content-view-filter "test"
Error: Could not find organization. Some search options were missing, please see --help.

> hammer content-view filter rule list --content-view-id 2 --content-view-filter "test"
--------|-----------|------|---------|-----------------|-----------------|-----------|------------|---------
RULE ID | FILTER ID | NAME | VERSION | MINIMUM VERSION | MAXIMUM VERSION | ERRATA ID | START DATE | END DATE
--------|-----------|------|---------|-----------------|-----------------|-----------|------------|---------

4. the same error we get for creating or deleting rule.
> hammer content-view filter rule create --content-view "test view" --content-view-filter "test" --name="c" 
> hammer content-view filter rule delete --content-view  "test view" --content-view-filter "test" --name "c"

Comment 2 Andrew Kofink 2016-10-28 13:24:30 UTC
Created redmine issue http://projects.theforeman.org/issues/17127 from this bug

Comment 3 Bryan Kearney 2016-10-28 14:20:04 UTC
Upstream bug component is Content Management

Comment 4 Bryan Kearney 2016-11-04 14:03:56 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/17127 has been resolved.

Comment 5 Brad Buckingham 2017-09-06 19:14:22 UTC
Verified with Satellite 6.3 SNAP 14: satellite-6.3.0-17.0.beta.el7sat.noarch, tfm-rubygem-katello-3.4.5-1.el7sat.noarch

hammer> content-view list
----------------|---------------------------|---------------------------|-----------|---------------------|---------------
CONTENT VIEW ID | NAME                      | LABEL                     | COMPOSITE | LAST PUBLISHED      | REPOSITORY IDS
----------------|---------------------------|---------------------------|-----------|---------------------|---------------
1               | Default Organization View | Default_Organization_View |           | 2017/09/05 21:36:28 |               
2               | rhel7                     | rhel7                     |           | 2017/09/06 15:22:47 | 1             
3               | rhel7_filtered            | rhel7_filtered            |           |                     | 1             
----------------|---------------------------|---------------------------|-----------|---------------------|---------------

hammer> content-view filter create --content-view rhel7_filtered --name test --inclusion false --type rpm --organization "Default Organization"
Filter created

hammer> content-view filter rule list --content-view-id 3 --content-view-filter test
--------|-----------|------|---------|-----------------|-----------------|-----------|------------|---------
RULE ID | FILTER ID | NAME | VERSION | MINIMUM VERSION | MAXIMUM VERSION | ERRATA ID | START DATE | END DATE
--------|-----------|------|---------|-----------------|-----------------|-----------|------------|---------

hammer> content-view filter rule create --content-view rhel7_filtered --content-view-filter test --name c --organization "Default Organization"
Filter rule created

hammer> content-view filter rule list --content-view-id 3 --content-view-filter test
--------|-----------|------|---------|-----------------|-----------------|-----------|------------|---------
RULE ID | FILTER ID | NAME | VERSION | MINIMUM VERSION | MAXIMUM VERSION | ERRATA ID | START DATE | END DATE
--------|-----------|------|---------|-----------------|-----------------|-----------|------------|---------
1       | 1         | c    |         |                 |                 |           |            |         
--------|-----------|------|---------|-----------------|-----------------|-----------|------------|---------

hammer> content-view filter rule info --content-view rhel7_filtered --content-view-filter test --name c --organization "Default Organization"
Rule ID:   1
Filter ID: 1
Name:      c
Created:   2017/09/06 19:10:29
Updated:   2017/09/06 19:10:29

hammer> content-view filter rule delete --content-view rhel7_filtered --content-view-filter test --name c --organization "Default Organization"
Filter rule deleted

hammer> content-view filter rule list --content-view-id 3 --content-view-filter test
--------|-----------|------|---------|-----------------|-----------------|-----------|------------|---------
RULE ID | FILTER ID | NAME | VERSION | MINIMUM VERSION | MAXIMUM VERSION | ERRATA ID | START DATE | END DATE
--------|-----------|------|---------|-----------------|-----------------|-----------|------------|---------

Comment 6 Satellite Program 2018-02-21 16:54: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/RHSA-2018:0336