Bug #19159

Session authentication doesn't work with Restclient < 1.8

Added by Tomáš Strachota 8 months ago. Updated 6 months ago.

Status:Closed
Priority:High
Assigned To:Tomáš Strachota
Category:Other commands
Target version:Foreman - Team Marek Iteration 13
Difficulty: Bugzilla link:1452774
Found in release: Pull request:https://github.com/theforeman/hammer-cli-foreman/pull/298
Story points-
Velocity based estimate-
Releasehammer-cli-foreman-0.10.1Release relationshipAuto

Description

Session authentication doesn't work with restclient 1.8 that we use on production installs.
The authenticator expects http request to have uri set but this change was introduced post 1.8.

[DEBUG 2017-04-04 07:17:49 API] Using authenticator: HammerCLIForeman::Api::SessionAuthenticatorWrapper
[ERROR 2017-04-04 07:17:49 API] undefined method `hostname' for nil:NilClass
[DEBUG 2017-04-04 07:17:49 API] #<NoMethodError: undefined method `hostname' for nil:NilClass>
[ERROR 2017-04-04 07:17:49 Exception] Error: undefined method `hostname' for nil:NilClass
Error: undefined method `hostname' for nil:NilClass
[ERROR 2017-04-04 07:17:49 Exception]

NoMethodError (undefined method `hostname' for nil:NilClass):
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.10.0/lib/hammer_cli_foreman/api/session_authenticator_wrapper.rb:40:in `authenticate'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.1.0/lib/apipie_bindings/rest_client_extensions.rb:14:in `block in <module:RestClientExtensions>'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.8.0/lib/restclient/request.rb:407:in `call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.8.0/lib/restclient/request.rb:407:in `block in transmit'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.8.0/lib/restclient/request.rb:406:in `each'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.8.0/lib/restclient/request.rb:406:in `transmit'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.8.0/lib/restclient/request.rb:176:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.8.0/lib/restclient/request.rb:41:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.8.0/lib/restclient/resource.rb:51:in `get'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.1.0/lib/apipie_bindings/api.rb:313:in `call_client'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.1.0/lib/apipie_bindings/api.rb:229:in `http_call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.1.0/lib/apipie_bindings/api.rb:179:in `call_action'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.1.0/lib/apipie_bindings/api.rb:174:in `call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.1.0/lib/apipie_bindings/resource.rb:21:in `call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.0/lib/hammer_cli/apipie/command.rb:43:in `send_request'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.10.0/lib/hammer_cli_foreman/commands.rb:158:in `send_request'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.10.0/lib/hammer_cli_foreman/commands.rb:248:in `send_request'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.10.0/lib/hammer_cli_foreman/commands.rb:283:in `retrieve_all'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.10.0/lib/hammer_cli_foreman/commands.rb:267:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.0/lib/hammer_cli/abstract.rb:27:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/subcommand/execution.rb:11:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.0/lib/hammer_cli/abstract.rb:27:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/subcommand/execution.rb:11:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.0/lib/hammer_cli/abstract.rb:27:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:133:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.0/bin/hammer:146:in `<top (required)>'
    /usr/bin/hammer:23:in `load'
    /usr/bin/hammer:23:in `<main>'

Associated revisions

Revision 78488d2d
Added by Tomas Strachota 8 months ago

Fixes #19159 - make session authenticator compatible with rest-client 1.8

History

#1 Updated by The Foreman Bot 8 months ago

  • Status changed from Assigned to Ready For Testing
  • Pull request https://github.com/theforeman/hammer-cli-foreman/pull/298 added

#2 Updated by Tomáš Strachota 8 months ago

  • Release deleted (hammer-cli-foreman-0.11.0)

This is a candidate for hammer-cli-foreman 0.10.1

#3 Updated by Tomáš Strachota 8 months ago

  • Release set to hammer-cli-foreman-0.10.1

#4 Updated by Anonymous 8 months ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#5 Updated by Ivan Necas 6 months ago

  • Bugzilla link set to 1452774

Also available in: Atom PDF