This bug has been migrated to another issue tracking site. It has been closed here and may no longer be being monitored.

If you would like to get updates for this issue, or to participate in it, you may do so at Red Hat Issue Tracker .
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 1920224 - hammer content-view list --organization <ORG NAME> seems to show always the result for ORG with ID 1
Summary: hammer content-view list --organization <ORG NAME> seems to show always the ...
Keywords:
Status: CLOSED MIGRATED
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Hammer
Version: 6.8.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: stream
Assignee: Oleh Fedorenko
QA Contact: Lukáš Hellebrandt
URL:
Whiteboard:
: 1953713 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-01-25 20:12 UTC by Rafael Cavalcanti
Modified: 2024-10-01 17:23 UTC (History)
9 users (show)

Fixed In Version: tfm-rubygem-hammer_cli_foreman-2.5.1.1-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2024-06-06 00:45:07 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 32392 0 Normal Closed hammer content-view list --organization <ORG NAME> seems to show always the result for ORG with ID 1 2021-07-28 17:24:45 UTC
Foreman Issue Tracker 33711 0 Normal Assigned Provided id options don't override defaults 2021-10-18 17:00:55 UTC
Red Hat Issue Tracker   SAT-23335 0 None Migrated None 2024-06-06 00:45:06 UTC

Description Rafael Cavalcanti 2021-01-25 20:12:20 UTC
Description of problem:
hammer content-view  list --organization <ORG NAME> always shows the CV's related to ORG with ID=1

---
From hammer -d:
[ INFO 2021-01-25T14:56:19 HammerCLIKatello::ContentView::ListCommand] Called with options: {"option_organization_name"=>"Import", "option_organization_id"=>"1"}
[ INFO 2021-01-25T14:56:19 API] Server: https://recife.rguerra.lab
[ INFO 2021-01-25T14:56:19 API] GET /katello/api/organizations/1/content_views


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


How reproducible:


Steps to Reproduce:
1. List all orgs:
---
hammer organization list
---|----------|----------|-------------|---------
ID | TITLE    | NAME     | DESCRIPTION | LABEL   
---|----------|----------|-------------|---------
1  | ACME     | ACME     |             | ACME    
5  | Export   | Export   |             | Export  
6  | Import   | Import   |             | Import  
8  | new_one  | new_one  |             | new_one 
4  | NO_Repos | NO_Repos |             | NO_Repos
---|----------|----------|-------------|---------
---

2. Run 'hammer content-view  list --organization <Org Name>' using an ORG NAME with ID other than 1.
---
hammer content-view  list --organization Export
----------------|---------------------------|---------------------------|-----------|---------------------|-----------------------------
CONTENT VIEW ID | NAME                      | LABEL                     | COMPOSITE | LAST PUBLISHED      | REPOSITORY IDS              
----------------|---------------------------|---------------------------|-----------|---------------------|-----------------------------
10              | CAP68                     | CAP68                     | false     | 2020/12/11 01:35:43 | 91, 10, 89, 2, 90, 7        
6               | CCV-1                     | CCV-1                     | true      | 2020/09/24 13:58:41 |                             
4               | CV-Ansible                | CV-Ansible                | false     | 2020/09/16 16:11:18 | 6                           
3               | CV-CAP67                  | CV-CAP67                  | false     | 2020/10/08 14:49:51 | 6, 13, 10, 1, 2, 4, 7, 8, 48
9               | CV-HPC-76                 | CV-HPC-76                 | false     | 2020/10/14 18:07:05 | 76, 74, 75                  
12              | cv-puppet                 | cv-puppet                 | false     | 2020/12/21 17:48:33 |                             
13              | cv-sattools-rhel6         | cv-sattools-rhel6         | false     | 2020/12/22 18:34:06 | 3                           
1               | Default Organization View | Default_Organization_View | false     | 2020/09/14 20:04:58 |                             
----------------|---------------------------|---------------------------|-----------|---------------------|-----------------------------



3. Run 'hammer content-view  list --organization <Org Name>' using an ORG NAME with ID = 1.
---
hammer content-view  list --organization ACME
----------------|---------------------------|---------------------------|-----------|---------------------|-----------------------------
CONTENT VIEW ID | NAME                      | LABEL                     | COMPOSITE | LAST PUBLISHED      | REPOSITORY IDS              
----------------|---------------------------|---------------------------|-----------|---------------------|-----------------------------
10              | CAP68                     | CAP68                     | false     | 2020/12/11 01:35:43 | 91, 10, 89, 2, 90, 7        
6               | CCV-1                     | CCV-1                     | true      | 2020/09/24 13:58:41 |                             
4               | CV-Ansible                | CV-Ansible                | false     | 2020/09/16 16:11:18 | 6                           
3               | CV-CAP67                  | CV-CAP67                  | false     | 2020/10/08 14:49:51 | 6, 13, 10, 1, 2, 4, 7, 8, 48
9               | CV-HPC-76                 | CV-HPC-76                 | false     | 2020/10/14 18:07:05 | 76, 74, 75                  
12              | cv-puppet                 | cv-puppet                 | false     | 2020/12/21 17:48:33 |                             
13              | cv-sattools-rhel6         | cv-sattools-rhel6         | false     | 2020/12/22 18:34:06 | 3                           
1               | Default Organization View | Default_Organization_View | false     | 2020/09/14 20:04:58 |                             
----------------|---------------------------|---------------------------|-----------|---------------------|-----------------------------
---

Actual results:
Hammer returns the output related to ORG with ID=1.
---
hammer content-view  list --organization ACME
----------------|---------------------------|---------------------------|-----------|---------------------|-----------------------------
CONTENT VIEW ID | NAME                      | LABEL                     | COMPOSITE | LAST PUBLISHED      | REPOSITORY IDS              
----------------|---------------------------|---------------------------|-----------|---------------------|-----------------------------
10              | CAP68                     | CAP68                     | false     | 2020/12/11 01:35:43 | 91, 10, 89, 2, 90, 7        
6               | CCV-1                     | CCV-1                     | true      | 2020/09/24 13:58:41 |                             
4               | CV-Ansible                | CV-Ansible                | false     | 2020/09/16 16:11:18 | 6                           
3               | CV-CAP67                  | CV-CAP67                  | false     | 2020/10/08 14:49:51 | 6, 13, 10, 1, 2, 4, 7, 8, 48
9               | CV-HPC-76                 | CV-HPC-76                 | false     | 2020/10/14 18:07:05 | 76, 74, 75                  
12              | cv-puppet                 | cv-puppet                 | false     | 2020/12/21 17:48:33 |                             
13              | cv-sattools-rhel6         | cv-sattools-rhel6         | false     | 2020/12/22 18:34:06 | 3                           
1               | Default Organization View | Default_Organization_View | false     | 2020/09/14 20:04:58 |                             
----------------|---------------------------|---------------------------|-----------|---------------------|-----------------------------


Expected results:
Shows the output related to the ORG NAME.

Additional info:

Passing the ORG ID to the command instead of the ORG NAME, hammer shows the expected result:
---
hammer content-view  list --organization-id 1
----------------|---------------------------|---------------------------|-----------|---------------------|-----------------------------
CONTENT VIEW ID | NAME                      | LABEL                     | COMPOSITE | LAST PUBLISHED      | REPOSITORY IDS              
----------------|---------------------------|---------------------------|-----------|---------------------|-----------------------------
10              | CAP68                     | CAP68                     | false     | 2020/12/11 01:35:43 | 91, 10, 89, 2, 90, 7        
6               | CCV-1                     | CCV-1                     | true      | 2020/09/24 13:58:41 |                             
4               | CV-Ansible                | CV-Ansible                | false     | 2020/09/16 16:11:18 | 6                           
3               | CV-CAP67                  | CV-CAP67                  | false     | 2020/10/08 14:49:51 | 6, 13, 10, 1, 2, 4, 7, 8, 48
9               | CV-HPC-76                 | CV-HPC-76                 | false     | 2020/10/14 18:07:05 | 76, 74, 75                  
12              | cv-puppet                 | cv-puppet                 | false     | 2020/12/21 17:48:33 |                             
13              | cv-sattools-rhel6         | cv-sattools-rhel6         | false     | 2020/12/22 18:34:06 | 3                           
1               | Default Organization View | Default_Organization_View | false     | 2020/09/14 20:04:58 |                             
----------------|---------------------------|---------------------------|-----------|---------------------|-----------------------------

 hammer content-view  list --organization-id 5
----------------|---------------------------|--------------------------------------|-----------|---------------------|---------------
CONTENT VIEW ID | NAME                      | LABEL                                | COMPOSITE | LAST PUBLISHED      | REPOSITORY IDS
----------------|---------------------------|--------------------------------------|-----------|---------------------|---------------
14              | cv_test                   | cv_test                              | false     | 2021/01/24 18:30:18 | 61, 60        
7               | Default Organization View | 197e3103-eafd-467b-8137-35c9927aa088 | false     | 2020/09/28 21:39:56 |               
----------------|---------------------------|--------------------------------------|-----------|---------------------|---------------

By passing the ORG ID, it does the right API call:
---
GET /katello/api/organizations/5/content_views
---

Comment 1 Oleh Fedorenko 2021-04-20 12:03:44 UTC
Hello Rafael,

I've just tried similar commands in Satellite 6.8.4 and it seems to be working as expected:

> hammer content-view list
----------------|---------------------------|--------------------------------------|-----------|---------------------|---------------
CONTENT VIEW ID | NAME                      | LABEL                                | COMPOSITE | LAST PUBLISHED      | REPOSITORY IDS
----------------|---------------------------|--------------------------------------|-----------|---------------------|---------------
2               | Default Organization View | ba1aa9f4-489c-448e-ab1c-631a0b5d22cb | false     | 2021/04/20 11:48:02 |               
1               | Default Organization View | Default_Organization_View            | false     | 2021/02/25 15:56:09 |               
3               | testcv                    | testcv                               | false     |                     |               
----------------|---------------------------|--------------------------------------|-----------|---------------------|---------------
> hammer content-view list --organization testorg
----------------|---------------------------|--------------------------------------|-----------|---------------------|---------------
CONTENT VIEW ID | NAME                      | LABEL                                | COMPOSITE | LAST PUBLISHED      | REPOSITORY IDS
----------------|---------------------------|--------------------------------------|-----------|---------------------|---------------
2               | Default Organization View | ba1aa9f4-489c-448e-ab1c-631a0b5d22cb | false     | 2021/04/20 11:48:02 |               
3               | testcv                    | testcv                               | false     |                     |               
----------------|---------------------------|--------------------------------------|-----------|---------------------|---------------
> hammer content-view list --organization "Default Organization"
----------------|---------------------------|---------------------------|-----------|---------------------|---------------
CONTENT VIEW ID | NAME                      | LABEL                     | COMPOSITE | LAST PUBLISHED      | REPOSITORY IDS
----------------|---------------------------|---------------------------|-----------|---------------------|---------------
1               | Default Organization View | Default_Organization_View | false     | 2021/02/25 15:56:09 |               
----------------|---------------------------|---------------------------|-----------|---------------------|---------------

Can you please verify if this was fixed since version 6.8.4? Also, if you will face this issue again, could you please provide "hammer defaults list" command output?

Comment 2 Rafael Cavalcanti 2021-04-21 13:03:48 UTC
Hello Oleh,

Thanks for looking into this and apologies for missing the defaults information.
This behavior is happening when the 'hammer defaults' is set.

1) With defauls:
---
# hammer content-view  list --organization rguerra_org2
----------------|---------------------------|---------------------------|-----------|---------------------|------------------
CONTENT VIEW ID | NAME                      | LABEL                     | COMPOSITE | LAST PUBLISHED      | REPOSITORY IDS   
----------------|---------------------------|---------------------------|-----------|---------------------|------------------
8               | cv-app-capsule            | cv-app-capsule            | false     | 2021/02/11 22:21:39 | 1, 2, 6, 7, 8, 10
7               | cv-os-rhel-6Server        | cv-os-rhel-6Server        | false     | 2021/04/15 00:42:13 | 43, 44, 85       
2               | cv-os-rhel-7Server        | cv-os-rhel-7Server        | false     | 2021/04/14 21:06:24 | 2, 8             
5               | cv-os-rhel-82kickstart    | cv-os-rhel-82kickstart    | false     | 2020/12/06 04:39:16 | 34, 35           
4               | cv-os-rhel-83-kickstart   | cv-os-rhel-83-kickstart   | false     | 2020/12/04 22:16:08 | 26, 27           
3               | cv-os-rhel-8Server        | cv-os-rhel-8Server        | false     | 2020/11/10 01:53:39 | 4, 5, 9          
6               | cv-test-delete            | cv-test-delete            | false     |                     |                  
1               | Default Organization View | Default_Organization_View | false     | 2020/11/09 01:49:24 |                  
----------------|---------------------------|---------------------------|-----------|---------------------|------------------
# hammer content-view  list --organization rguerra_org
----------------|---------------------------|---------------------------|-----------|---------------------|------------------
CONTENT VIEW ID | NAME                      | LABEL                     | COMPOSITE | LAST PUBLISHED      | REPOSITORY IDS   
----------------|---------------------------|---------------------------|-----------|---------------------|------------------
8               | cv-app-capsule            | cv-app-capsule            | false     | 2021/02/11 22:21:39 | 1, 2, 6, 7, 8, 10
7               | cv-os-rhel-6Server        | cv-os-rhel-6Server        | false     | 2021/04/15 00:42:13 | 43, 44, 85       
2               | cv-os-rhel-7Server        | cv-os-rhel-7Server        | false     | 2021/04/14 21:06:24 | 2, 8             
5               | cv-os-rhel-82kickstart    | cv-os-rhel-82kickstart    | false     | 2020/12/06 04:39:16 | 34, 35           
4               | cv-os-rhel-83-kickstart   | cv-os-rhel-83-kickstart   | false     | 2020/12/04 22:16:08 | 26, 27           
3               | cv-os-rhel-8Server        | cv-os-rhel-8Server        | false     | 2020/11/10 01:53:39 | 4, 5, 9          
6               | cv-test-delete            | cv-test-delete            | false     |                     |                  
1               | Default Organization View | Default_Organization_View | false     | 2020/11/09 01:49:24 |                  
----------------|---------------------------|---------------------------|-----------|---------------------|------------------
# hammer content-view  list --organization acme
----------------|---------------------------|---------------------------|-----------|---------------------|------------------
CONTENT VIEW ID | NAME                      | LABEL                     | COMPOSITE | LAST PUBLISHED      | REPOSITORY IDS   
----------------|---------------------------|---------------------------|-----------|---------------------|------------------
8               | cv-app-capsule            | cv-app-capsule            | false     | 2021/02/11 22:21:39 | 1, 2, 6, 7, 8, 10
7               | cv-os-rhel-6Server        | cv-os-rhel-6Server        | false     | 2021/04/15 00:42:13 | 43, 44, 85       
2               | cv-os-rhel-7Server        | cv-os-rhel-7Server        | false     | 2021/04/14 21:06:24 | 2, 8             
5               | cv-os-rhel-82kickstart    | cv-os-rhel-82kickstart    | false     | 2020/12/06 04:39:16 | 34, 35           
4               | cv-os-rhel-83-kickstart   | cv-os-rhel-83-kickstart   | false     | 2020/12/04 22:16:08 | 26, 27           
3               | cv-os-rhel-8Server        | cv-os-rhel-8Server        | false     | 2020/11/10 01:53:39 | 4, 5, 9          
6               | cv-test-delete            | cv-test-delete            | false     |                     |                  
1               | Default Organization View | Default_Organization_View | false     | 2020/11/09 01:49:24 |                  
----------------|---------------------------|---------------------------|-----------|---------------------|------------------
# cat .hammer/defaults.yml
:defaults:
  :organization_id:
    :value: '1'
  :organization:
    :value: acme
---

2) w/o hammer defaults:
---
# hammer content-view  list --organization rguerra_org2
----------------|---------------------------|--------------------------------------|-----------|---------------------|---------------
CONTENT VIEW ID | NAME                      | LABEL                                | COMPOSITE | LAST PUBLISHED      | REPOSITORY IDS
----------------|---------------------------|--------------------------------------|-----------|---------------------|---------------
14              | Default Organization View | 8388f73c-dc14-4181-9d21-21c41c9219ff | false     | 2021/04/20 18:22:04 |               
----------------|---------------------------|--------------------------------------|-----------|---------------------|---------------
# hammer content-view  list --organization rguerra_org
----------------|---------------------------|--------------------------------------|-----------|---------------------|---------------
CONTENT VIEW ID | NAME                      | LABEL                                | COMPOSITE | LAST PUBLISHED      | REPOSITORY IDS
----------------|---------------------------|--------------------------------------|-----------|---------------------|---------------
12              | cv_1                      | cv_1                                 | false     |                     |               
13              | cv2                       | cv2                                  | false     |                     |               
11              | Default Organization View | 3ff82933-0402-41c3-8aef-d831719bff6d | false     | 2021/04/20 18:14:23 |               
----------------|---------------------------|--------------------------------------|-----------|---------------------|---------------
# hammer content-view  list --organization acme
----------------|---------------------------|---------------------------|-----------|---------------------|------------------
CONTENT VIEW ID | NAME                      | LABEL                     | COMPOSITE | LAST PUBLISHED      | REPOSITORY IDS   
----------------|---------------------------|---------------------------|-----------|---------------------|------------------
8               | cv-app-capsule            | cv-app-capsule            | false     | 2021/02/11 22:21:39 | 1, 2, 6, 7, 8, 10
7               | cv-os-rhel-6Server        | cv-os-rhel-6Server        | false     | 2021/04/15 00:42:13 | 43, 44, 85       
2               | cv-os-rhel-7Server        | cv-os-rhel-7Server        | false     | 2021/04/14 21:06:24 | 2, 8             
5               | cv-os-rhel-82kickstart    | cv-os-rhel-82kickstart    | false     | 2020/12/06 04:39:16 | 34, 35           
4               | cv-os-rhel-83-kickstart   | cv-os-rhel-83-kickstart   | false     | 2020/12/04 22:16:08 | 26, 27           
3               | cv-os-rhel-8Server        | cv-os-rhel-8Server        | false     | 2020/11/10 01:53:39 | 4, 5, 9          
6               | cv-test-delete            | cv-test-delete            | false     |                     |                  
1               | Default Organization View | Default_Organization_View | false     | 2020/11/09 01:49:24 |                  
----------------|---------------------------|---------------------------|-----------|---------------------|------------------
# cat .hammer/defaults.yml && date
Wed Apr 21 06:03:25 PDT 2021
---


Rafael

Comment 3 Oleh Fedorenko 2021-04-22 11:53:47 UTC
Thanks a lot for more info! Now it seems like a valid bug, since any explicitly provided options should override any defaults.

Few notes how to workaround this if needed:
1 - use `--no-use-defaults` option for hammer main command
2 - use --organization-id instead of --organization

Comment 4 Oleh Fedorenko 2021-04-22 11:54:43 UTC
Created redmine issue https://projects.theforeman.org/issues/32392 from this bug

Comment 5 Oleh Fedorenko 2021-04-27 08:17:41 UTC
*** Bug 1953713 has been marked as a duplicate of this bug. ***

Comment 7 Bryan Kearney 2021-05-10 20:04:21 UTC
Upstream bug assigned to ofedoren

Comment 8 Bryan Kearney 2021-05-10 20:04:23 UTC
Upstream bug assigned to ofedoren

Comment 9 Bryan Kearney 2021-06-13 12:04:34 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/32392 has been resolved.

Comment 18 Eric Helms 2024-06-06 00:45:07 UTC
This BZ has been automatically migrated to the issues.redhat.com Red Hat Issue Tracker. All future work related to this report will be managed there.

Due to differences in account names between systems, some fields were not replicated.  Be sure to add yourself to Jira issue's "Watchers" field to continue receiving updates and add others to the "Need Info From" field to continue requesting information.

To find the migrated issue, look in the "Links" section for a direct link to the new issue location. The issue key will have an icon of 2 footprints next to it, and begin with "SAT-" followed by an integer.  You can also find this issue by visiting https://issues.redhat.com/issues/?jql= and searching the "Bugzilla Bug" field for this BZ's number, e.g. a search like:

"Bugzilla Bug" = 1234567

In the event you have trouble locating or viewing this issue, you can file an issue by sending mail to rh-issues. You can also visit https://access.redhat.com/articles/7032570 for general account information.


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