Description of problem: Hammer says "Error: 301 Moved Permanently" when you are missing "https://" in server option. It is not user-friendly and I had to bug developer to find that typo. Version-Release number of selected component (if applicable): rubygem-hammer_cli-0.1.4.11-1.el6_6sat.noarch How reproducible: always Steps to Reproduce: 1. hammer --server $(hostname) --username admin --password changeme organization create --label 'satellite-qa' --name 'satellite-qa' Actual results: # hammer --server $(hostname) --username admin --password changeme organization create --label 'satellite-qa' --name 'satellite-qa' Could not create the organization: Error: 301 Moved Permanently Expected results: Some useful error message explaining what is wrong Additional info: Running with "https://" is OK: # hammer --server https://$(hostname) --username admin --password changeme organization create --label 'satellite-qa' --name 'satellite-qa' Organization created
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/11147 from this bug
Upstream bug assigned to mbacovsk
Moving to POST since upstream bug http://projects.theforeman.org/issues/11147 has been closed ------------- Martin Bacovsky Applied in changeset commit:hammer-cli-foreman|4a9eceb007ad9dcea3d5052b83a1f96bf5e176af.
The change in hammer-cli-foreman requires apipie-bindings >= 0.0.16 to get working (or https://github.com/Apipie/apipie-bindings/pull/41 cherry-picked as well)
Reproducible with sat62 GA snap10.1 though error is bit different: ~]# hammer --server $(hostname) -u admin -p changeme product create --name test1 --organization-id 1 Error: undefined method `request' for #<String:0x000000045e36a8> NoMethodError (undefined method `request' for #<String:0x00000003fce3d0>): /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.6.7/lib/restclient/exceptions.rb:71:in `method_missing' /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.5.1.6/lib/hammer_cli_foreman/exception_handler.rb:31:in `handle_moved_permanently' /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1.6/lib/hammer_cli/exception_handler.rb:28:in `handle_exception' /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1.6/lib/hammer_cli/messages.rb:26:in `handle_exception' /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1.6/lib/hammer_cli/abstract.rb:26:in `rescue in run' with "https://" working as expected. ~]# hammer --server https://$(hostname) -u admin -p changeme product create --name test1 --organization-id 1 Product created
The issue is fixed by patch in apipie-bindings https://github.com/Apipie/apipie-bindings/pull/44
[root@zzzap ~]# hammer --server $(hostname) --username admin --password changeme ping Redirection of API call detected. It seems hammer is configured to use HTTP and the server prefers HTTPS. Update your server url configuration you can set 'follow_redirects' to one of :default or :always to enable redirects following [root@zzzap ~]# vim /etc/hammer/cli.modules.d/foreman.yml https://github.com/mbacovsky/hammer-cli-foreman/blob/4a9eceb007ad9dcea3d5052b83a1f96bf5e176af/config/foreman.yml [root@zzzap ~]# hammer --server $(hostname) --username admin --password changeme ping candlepin: Status: ok Server Response: Duration: 20ms candlepin_auth: Status: ok Server Response: Duration: 19ms pulp: Status: ok Server Response: Duration: 38ms pulp_auth: Status: ok Server Response: Duration: 23ms foreman_tasks: Status: ok Server Response: Duration: 362ms One nitpick tho, the config file has no examples, it is modified by puppet perhaps. [root@zzzap ~]# rpm -q foreman katello foreman-1.15.3-2.el7sat.noarch katello-3.4.4-2.el7sat.noarch
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