Bug 1242488
| Summary: | hammer says "Error: 301 Moved Permanently" when you are missing "https://" in server option | ||
|---|---|---|---|
| Product: | Red Hat Satellite | Reporter: | Jan Hutař <jhutar> |
| Component: | Hammer | Assignee: | Martin Bacovsky <mbacovsk> |
| Status: | CLOSED ERRATA | QA Contact: | Lukas Zapletal <lzap> |
| Severity: | low | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 6.1.0 | CC: | ahuchcha, bbuckingham, bkearney, ehelms, lzap, rraghuwa, sghai, sthirugn |
| Target Milestone: | Unspecified | Keywords: | Triaged |
| Target Release: | Unused | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| URL: | http://projects.theforeman.org/issues/11147 | ||
| Whiteboard: | |||
| Fixed In Version: | foreman-1.15.3-2 | Doc Type: | Bug Fix |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2018-02-21 16:51:07 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
|
Description
Jan Hutař
2015-07-13 12:27:21 UTC
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 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
|