Description of problem: This RFE requests the ability to set the default organization/location of a user that is leveraging Hammer CLI. This would save the user a great deal of typing when accessing the CLI. This value can potentially be: * Set within the cli_config.yml file. * Inherited from the user's 'Default Organization | Default Locaiton' setting in the UI Version-Release number of selected component (if applicable): rubygem-hammer_cli-0.1.1-12.el6sat.noarch
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.
Created redmine issue http://projects.theforeman.org/issues/8015 from this bug
*** Bug 1280015 has been marked as a duplicate of this bug. ***
Moving to POST since upstream bug http://projects.theforeman.org/issues/8015 has been closed ------------- Alon Goldboim Applied in changeset commit:417e7163c0964e8e64aabe25feed7f6a509545a6.
Following the steps in Comment, this bug failed in Satellite 6.2.0-beta-snap4 # hammer defaults list ----------|------ PARAMETER | VALUE ----------|------ # hammer defaults providers ---------|------------------------------|------------------------------------------------------------- PROVIDER | SUPPORTED DEFAULTS | DESCRIPTION ---------|------------------------------|------------------------------------------------------------- foreman | organization_id, location_id | Use the default organization and/or location from the server ---------|------------------------------|------------------------------------------------------------- # hammer defaults add --param-name=organization_id --provider=foreman No such file or directory @ rb_sysopen - /root/.hammer/defaults.yml # hammer defaults add --param-name=organization_id --param-value=1 No such file or directory @ rb_sysopen - /root/.hammer/defaults.yml # hammer activation-key list Error: Could not find organization, please set one of options --organization, --organization-label, --organization-id.
I tried adding /root/.hammer/defaults.yml # ll /root/.hammer/defaults.yml -rw-r--r--. 1 root root 0 Mar 21 13:32 /root/.hammer/defaults.yml # hammer defaults add --param-name=organization_id --param-value=1 Error: undefined method `[]' for false:FalseClass Note: I don't see error in any of these files: /var/log/{pulp,candlepin,foreman*,rhsm,puppet,tomcat*}/{*.log,*.out} /var/log/messages
Disclaimer: I am guessing here. I assume that /root/.hammer/defaults.yml is empty right now. If it is, run: echo "--- {}" > /root/.hammer/defaults.yml This should make it work.
Created upstream bug (and a PR): http://projects.theforeman.org/issues/14311
Apparently bugzilla was already there: https://bugzilla.redhat.com/show_bug.cgi?id=1315645
this looks the same as 1315645, QE: feel free to close as a dupe
Failed in Satellite 6.2-beta-snap-6. The default foreman provider shows 'organization_id', 'location_id' instead of 'organization-id', 'location-id'. Test steps below: [root@sat6host ~] # hammer -u admin -p changeme defaults providers ---------|------------------------------|------------------------------------------------------------- PROVIDER | SUPPORTED DEFAULTS | DESCRIPTION ---------|------------------------------|------------------------------------------------------------- foreman | organization_id, location_id | Use the default organization and/or location from the server ---------|------------------------------|------------------------------------------------------------- [root@sat6host ~] # hammer -u admin -p changeme defaults add --param-name=organization-id --param-value=1 Added organization-id default-option with value 1. [root@sat6host ~]# hammer -u admin -p changeme defaults add --param-name=location-id --param-value=1 Added location-id default-option with value 1. [root@sat6host ~]# hammer -u admin -p changeme defaults list ----------------|------ PARAMETER | VALUE ----------------|------ organization-id | 1 location-id | 1 ----------------|------ [root@sat6host ~]# hammer -u admin -p changeme activation-key list Error: Could not find organization, please set one of options --organization, --organization-label, --organization-id. [root@sat6host ~]# hammer -u admin -p changeme defaults add --param-name=organization_id --param-value=1 Added organization_id default-option with value 1. [root@sat6host ~]# hammer -u admin -p changeme defaults add --param-name=location_id --param-value=1 Added location_id default-option with value 1. [root@sat6host ~]# hammer -u admin -p changeme defaults list ----------------|------ PARAMETER | VALUE ----------------|------ organization-id | 1 location-id | 1 organization_id | 1 location_id | 1 ----------------|------ [root@sat6host ~]# hammer -u admin -p changeme activation-key list ---|---------|----------------|-----------------------|------------- ID | NAME | HOST LIMIT | LIFECYCLE ENVIRONMENT | CONTENT VIEW ---|---------|----------------|-----------------------|------------- 2 | rhel7ak | 0 of Unlimited | prod | ---|---------|----------------|-----------------------|------------- [root@sat6host ~]# hammer -u admin -p changeme activation-key list --organization-id=3 ---|--------------|----------------|-----------------------|-------------------------- ID | NAME | HOST LIMIT | LIFECYCLE ENVIRONMENT | CONTENT VIEW ---|--------------|----------------|-----------------------|-------------------------- 1 | testorg1_ack | 0 of Unlimited | Library | Default Organization View ---|--------------|----------------|-----------------------|--------------------
Defaults feature was designed to use names with underscores as it is the real name representing the option inside hammer. With respect to that the feature works as expected. On the other side I understand it may be confusing for the users who use mostly the form with dashes. I have prepared PR [1] that adds support for both forms. Sureshkumar, would that be acceptable solution? [1] https://github.com/theforeman/hammer-cli/pull/203
@Martin: The proposed solution in Comment 21 looks good to me as long as the questions/comments in the PR are answered. Thanks!
Verified Version Verified: Snap 14 satellite-cli-6.2.0-14.1.el7sat.noarch Steps to verify: [vagrant@sat-test-rhel7 ~]$ hammer -u admin -p changeme product list Error: Could not find organization, please set one of options --organization, --organization-label, --organization-id. [vagrant@sat-test-rhel7 ~]$ hammer defaults add --param-name organization-id --param-value 1 Added organization-id default-option with value 1. [vagrant@sat-test-rhel7 ~]$ hammer -u admin -p changeme product list ---|----------------------------------------------------------------------------------|-------------|----------------------|--------------|----------- ID | NAME | DESCRIPTION | ORGANIZATION | REPOSITORIES | SYNC STATE ---|----------------------------------------------------------------------------------|-------------|----------------------|--------------|----------- 4 | Red Hat Software Collections for RHEL Server | | Default Organization | 0 | 8 | Red Hat Software Collections Beta for RHEL Server | | Default Organization | 0 | 25 | Red Hat S-JIS Support for RHEL Server - Extended Update Support | | Default Organization | 0 | 27 | Red Hat Satellite with Embedded Oracle | | Default Organization | 0 | 3 | Red Hat Satellite Proxy | | Default Organization | 0 | 2 | Red Hat Satellite Capsule Beta | | Default Organization | 0 | 5 | Red Hat Satellite Capsule | | Default Organization | 0 | 28 | Red Hat Satellite Beta | | Default Organization | 0 | 29 | Red Hat Satellite 6 Beta | | Default Organization | 0 | 30 | Red Hat Satellite | | Default Organization | 1 | 13 | Red Hat EUCJP Support for RHEL Server - Extended Update Support | | Default Organization | 0 | 15 | Red Hat Enterprise Linux Server - Extended Update Support | | Default Organization | 0 | 7 | Red Hat Enterprise Linux Server | | Default Organization | 0 | 19 | Red Hat Enterprise Linux Scalable File System for RHEL Server - Extended Upda... | | Default Organization | 0 | 10 | Red Hat Enterprise Linux Resilient Storage for RHEL Server - Extended Update ... | | Default Organization | 0 | 21 | Red Hat Enterprise Linux Load Balancer for RHEL Server - Extended Update Support | | Default Organization | 0 | 9 | Red Hat Enterprise Linux Load Balancer for RHEL Server | | Default Organization | 0 | 18 | Red Hat Enterprise Linux High Performance Networking for RHEL Server - Extend... | | Default Organization | 0 | 12 | Red Hat Enterprise Linux High Availability for RHEL Server - Extended Update ... | | Default Organization | 0 | 6 | Red Hat Enterprise Linux High Availability for RHEL Server | | Default Organization | 0 | ---|----------------------------------------------------------------------------------|-------------|----------------------|--------------|-----------
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