Hide Forgot
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
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"
Created redmine issue http://projects.theforeman.org/issues/16631 from this bug
Upstream bug assigned to mbacovsk
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/16631 has been resolved.
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
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