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 1369609 - content view filter does not use 'Default' organization and location in hammer
Summary: content view filter does not use 'Default' organization and location in hammer
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Hammer
Version: 6.2.0
Hardware: Unspecified
OS: Unspecified
medium
low
Target Milestone: Unspecified
Assignee: Martin Bacovsky
QA Contact: Katello QA List
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-08-24 00:27 UTC by Ashfaqur Rahaman
Modified: 2021-06-10 11:28 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-02-21 16:49:54 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 16631 0 Normal Closed Validators do not use default values in hammer 2020-06-08 11:10:24 UTC

Description Ashfaqur Rahaman 2016-08-24 00:27:22 UTC
Description of problem:

When creating the content view filter using hammer, it does not read the default organization and location from the defaults.yml file. 

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

How reproducible:
100%

Steps to Reproduce:

1.Set default organization and location by creating defaults.yml and copy it in /root/.hammer
~~
hammer> organization list
---|------|--------------------------------------|------------
ID | NAME | LABEL                                | DESCRIPTION
---|------|--------------------------------------|------------
1  | org1 | 1e9d14ee-f38d-46cb-a7b7-63f4d39a20b6 |            
---|------|--------------------------------------|------------
hammer> location list
---|-----
ID | NAME
---|-----
2  | loc1
---|-----
hammer> 

[root@sat62 hammer_cli]# cat /root/.hammer/defaults.yml 
---
:defaults:
  :organization_id:
    :value: '1'
  :location_id:
    :value: '2'
~~

2. login to hammer shell 
3. Try hammer commands which use organization and location: 

Other hammer commands working as below: 

~~~
# hammer> repository list
---|-----------------------------------------------------------|---------------------------------|--------------|---------------------------------------------------------------------------------
ID | NAME                                                      | PRODUCT                         | CONTENT TYPE | URL                                                                             
---|-----------------------------------------------------------|---------------------------------|--------------|---------------------------------------------------------------------------------
2  | Red Hat Satellite Tools 6.2 for RHEL 7 Server RPMs x86_64 | Red Hat Enterprise Linux Server | yum          | https://cdn.redhat.com/content/dist/rhel/server/7/7Server/x86_64/sat-tools/6....
1  | Red Hat Enterprise Linux 7 Server RPMs x86_64 7.2         | Red Hat Enterprise Linux Server | yum          | https://cdn.redhat.com/content/dist/rhel/server/7/7.2/x86_64/os                 
3  | Red Hat Enterprise Linux 7 Server Kickstart x86_64 7.2    | Red Hat Enterprise Linux Server | yum          | https://cdn.redhat.com/content/dist/rhel/server/7/7.2/x86_64/kickstart          
---|-----------------------------------------------------------|---------------------------------|--------------|---------------------------------------------------------------------------------

hammer> content-view list
----------------|---------------------------|---------------------------|-----------|---------------
CONTENT VIEW ID | NAME                      | LABEL                     | COMPOSITE | REPOSITORY IDS
----------------|---------------------------|---------------------------|-----------|---------------
1               | Default Organization View | Default_Organization_View |           |               
2               | cv_rhel7                  | cv_rhel7                  |           | 1, 2, 3       
----------------|---------------------------|---------------------------|-----------|---------------
~~~

Actual results:

But when we try to create content view filter, it fails with organization id. 

~~~
hammer> content-view filter create --name "July" --type erratum --inclusion true --content-view cv_rhel7
Could not create the filter:
  Error: At least one of options --organization-id, --organization, --organization-label is required
  
  See: ' content-view filter create --help'
~~~


Expected results:
It should work using the default value like other hammer commands. 

Additional info:
N/A

Comment 3 Martin Bacovsky 2016-09-20 15:17:31 UTC
This is bug in Hammer core. The validators do not take the defaults into account and the validation fails.

During investigation I found out that there is similarly looking issue that is caused by missing organization in builde_options in some of the filter commands and it fails to look up CV by name:
 
hammer -d content-view filter list --content-view "Default Organization View"

Comment 4 Martin Bacovsky 2016-09-21 10:48:23 UTC
Created redmine issue http://projects.theforeman.org/issues/16631 from this bug

Comment 5 Bryan Kearney 2016-09-21 12:19:07 UTC
Upstream bug assigned to mbacovsk

Comment 6 Bryan Kearney 2016-09-21 12:19:11 UTC
Upstream bug assigned to mbacovsk

Comment 7 Bryan Kearney 2016-10-05 12:17:06 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/16631 has been resolved.

Comment 10 Oleksandr Shtaier 2017-07-03 11:03:22 UTC
Verified on latest 6.3:

hammer -v -u admin -p changeme  defaults add --param-value="86" --param-name="organization_id"

Added organization_id default-option with value 86

hammer -v -u admin -p changeme  defaults add --param-value="87" --param-name="location_id"

Added location_id default-option with value 87

hammer -v -u admin -p changeme --output=csv content-view filter create --inclusion="true" --type="erratum" --name="MKAyInEfyb" --content-view="NETzkAcOaa"

Message,Id,Name
Filter created,4,MKAyInEfyb

hammer -v -u admin -p changeme  content-view filter info --id="4"
Filter ID:    4
Name:         MKAyInEfyb
Type:         erratum
Inclusion:    true
Description:  
Repositories: 

Rules:


I am getting expected error in case defaults were not specified and successful outcome in case they were provided

Test Automation script was created and corresponding PR is raised:
https://github.com/SatelliteQE/robottelo/pull/4915

Comment 11 Bryan Kearney 2018-02-21 16:45:33 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

Comment 12 Satellite Program 2018-02-21 16:49:54 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


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