Bug 1477610 - Setting session via activation key command results in infinite loop
Summary: Setting session via activation key command results in infinite loop
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Hammer
Version: 6.3.0
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: Unspecified
Assignee: Tomas Strachota
QA Contact: Peter Ondrejka
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-08-02 13:18 UTC by Bryan Kearney
Modified: 2019-08-12 16:36 UTC (History)
5 users (show)

Fixed In Version: hammer-cli-foreman 0.11.0
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-02-21 16:54:37 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Bryan Kearney 2017-08-02 13:18:20 UTC
Version: Satellite 6.3 Snap 9

With sessions enabled, logging in first time using the activation key create command results in an infinate loop.

Steps to reproduce
1) Edit /etc/hammer/cli.modules.d/foreman.yml set :foreman:use_sessions to true
2) Set the organization_id to to 1 in the defaults
3) execute the following command:

hammer -d -u admin -p JarJarBinks activation-key create --organization-id="1" --name="test_key3"

Note that "JarJarBinks" is an invalid password.

Debug output is below:

[vagrant@sat63-qa-rhel7 ~]$ hammer -d -u admin -p password activation-key create --organization-id="1" --name="test_key3"
[ INFO 2017-08-02 12:58:41 Init] Initialization of Hammer CLI (0.10.2) has started...
[DEBUG 2017-08-02 12:58:41 Init] Running at ruby 2.3.1-p112
[ INFO 2017-08-02 12:58:41 Init] Configuration from the file /etc/hammer/cli_config.yml has been loaded
[ INFO 2017-08-02 12:58:41 Init] Configuration from the file /etc/hammer/cli.modules.d/csv.yml has been loaded
[ INFO 2017-08-02 12:58:41 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman.yml has been loaded
[ INFO 2017-08-02 12:58:41 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_admin.yml has been loaded
[ INFO 2017-08-02 12:58:41 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_admin_logging_core.yml has been loaded
[ INFO 2017-08-02 12:58:41 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_admin_logging_katello.yml has been loaded
[ INFO 2017-08-02 12:58:41 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_bootdisk.yml has been loaded
[ INFO 2017-08-02 12:58:41 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_discovery.yml has been loaded
[ INFO 2017-08-02 12:58:41 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_docker.yml has been loaded
[ INFO 2017-08-02 12:58:41 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_openscap.yml has been loaded
[ INFO 2017-08-02 12:58:41 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_remote_execution.yml has been loaded
[ INFO 2017-08-02 12:58:41 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_tasks.yml has been loaded
[ INFO 2017-08-02 12:58:41 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_virt_who_configure.yml has been loaded
[ INFO 2017-08-02 12:58:41 Init] Configuration from the file /etc/hammer/cli.modules.d/import.yml has been loaded
[ INFO 2017-08-02 12:58:41 Init] Configuration from the file /etc/hammer/cli.modules.d/katello.yml has been loaded
[ INFO 2017-08-02 12:58:41 Init] Configuration from the file /home/vagrant/.hammer/defaults.yml has been loaded
[DEBUG 2017-08-02 12:58:41 SSLoptions] SSL options: {
    :ssl_ca_file => "/etc/pki/katello/certs/katello-default-ca.crt",
     :verify_ssl => true
}
[DEBUG 2017-08-02 12:58:41 API] Global headers: {
        :content_type => "application/json",
              :accept => "application/json;version=2",
    "Accept-Language" => "en"
}
[DEBUG 2017-08-02 12:58:41 API] Follow redirects: never
[DEBUG 2017-08-02 12:58:41 Connection] Registered: foreman
[ INFO 2017-08-02 12:58:42 Modules] Extension module hammer_cli_foreman (0.10.2) loaded
[ INFO 2017-08-02 12:58:42 Modules] Extension module hammer_cli_foreman_admin (0.0.6) loaded
[ INFO 2017-08-02 12:58:42 Modules] Extension module hammer_cli_foreman_bootdisk (0.1.3) loaded
[ INFO 2017-08-02 12:58:42 Modules] Extension module hammer_cli_foreman_discovery (1.0.0) loaded
[ INFO 2017-08-02 12:58:42 Modules] Extension module hammer_cli_import (0.11.3) loaded
[ INFO 2017-08-02 12:58:42 HammerCLI::MainCommand] subcommand organization (HammerCLIForeman::Organization) was removed.
[ INFO 2017-08-02 12:58:42 HammerCLI::MainCommand] subcommand organization (HammerCLIKatello::Organization) was created.
[ INFO 2017-08-02 12:58:42 Modules] Extension module hammer_cli_katello (0.10.0) loaded
[DEBUG 2017-08-02 12:58:42 Init] Using locale 'en'
[DEBUG 2017-08-02 12:58:42 Init] 'mo' files for locale domain 'hammer-cli' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.2/locale'
[DEBUG 2017-08-02 12:58:42 Init] 'mo' files for locale domain 'hammer-cli-foreman' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.10.2/locale'
[DEBUG 2017-08-02 12:58:42 Init] 'mo' files for locale domain 'hammer-cli-csv' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_csv-2.3.0/locale'
[DEBUG 2017-08-02 12:58:42 Init] 'mo' files for locale domain 'hammer_cli_foreman_docker' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman_docker-0.0.4/locale'
[DEBUG 2017-08-02 12:58:42 Init] 'mo' files for locale domain 'hammer-cli-foreman-virt-who-configure' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman_virt_who_configure-0.0.3/locale'
[DEBUG 2017-08-02 12:58:42 Init] 'mo' files for locale domain 'hammer-cli-katello' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_katello-0.10.0/locale'
[ INFO 2017-08-02 12:58:42 HammerCLI::MainCommand] Called with options: {"option_debug"=>true, "option_username"=>"admin", "option_password"=>"***"}
[ INFO 2017-08-02 12:58:42 HammerCLIKatello::ActivationKeyCommand] Called with options: {}
[ INFO 2017-08-02 12:58:42 HammerCLIKatello::ActivationKeyCommand::CreateCommand] Called with options: {"option_organization_id"=>1, "option_name"=>"test_key3"}
[ INFO 2017-08-02 12:58:42 API] Server: https://sat63-qa-rhel7.example.com
[ INFO 2017-08-02 12:58:42 API] POST /katello/api/activation_keys
[DEBUG 2017-08-02 12:58:42 API] Params: {
    "organization_id" => 1,
               "name" => "test_key3",
        "environment" => {}
}
[DEBUG 2017-08-02 12:58:42 API] Headers: {}
[DEBUG 2017-08-02 12:58:42 API] Using authenticator: HammerCLIForeman::Api::SessionAuthenticatorWrapper
[ERROR 2017-08-02 12:58:42 API] 401 Unauthorized
[DEBUG 2017-08-02 12:58:42 API] {
    "error" => {
        "message" => "Unable to authenticate user admin"
    }
}
[ERROR 2017-08-02 12:58:42 Exception] 

HammerCLIForeman::Api::SessionExpired (Session has expired):
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.0/lib/apipie_bindings/api.rb:246:in `rescue in http_call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.0/lib/apipie_bindings/api.rb:238:in `http_call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.0/lib/apipie_bindings/api.rb:190:in `call_action'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.0/lib/apipie_bindings/api.rb:185:in `call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.0/lib/apipie_bindings/resource.rb:21:in `call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.2/lib/hammer_cli/apipie/command.rb:43:in `send_request'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.10.2/lib/hammer_cli_foreman/commands.rb:166:in `send_request'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.2/lib/hammer_cli/apipie/command.rb:34: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.2/lib/hammer_cli/abstract.rb:29: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.2/lib/hammer_cli/abstract.rb:29: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.2/lib/hammer_cli/abstract.rb:29: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.2/bin/hammer:147:in `<top (required)>'
    /usr/bin/hammer:23:in `load'
    /usr/bin/hammer:23:in `<main>'


[DEBUG 2017-08-02 12:58:42 HammerCLIKatello::ActivationKeyCommand::CreateCommand] Retrying the command
[ INFO 2017-08-02 12:58:42 HammerCLIKatello::ActivationKeyCommand::CreateCommand] Called with options: {"option_organization_id"=>1, "option_name"=>"test_key3"}
[ INFO 2017-08-02 12:58:42 API] Server: https://sat63-qa-rhel7.example.com
[ INFO 2017-08-02 12:58:42 API] POST /katello/api/activation_keys
[DEBUG 2017-08-02 12:58:42 API] Params: {
    "organization_id" => 1,
               "name" => "test_key3",
        "environment" => {}
}
[DEBUG 2017-08-02 12:58:42 API] Headers: {}
[DEBUG 2017-08-02 12:58:42 API] Using authenticator: HammerCLIForeman::Api::SessionAuthenticatorWrapper
[ERROR 2017-08-02 12:58:42 API] 401 Unauthorized
[DEBUG 2017-08-02 12:58:42 API] {
    "error" => {
        "message" => "Unable to authenticate user admin"
    }
}
[ERROR 2017-08-02 12:58:42 Exception] 

HammerCLIForeman::Api::SessionExpired (Session has expired):
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.0/lib/apipie_bindings/api.rb:246:in `rescue in http_call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.0/lib/apipie_bindings/api.rb:238:in `http_call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.0/lib/apipie_bindings/api.rb:190:in `call_action'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.0/lib/apipie_bindings/api.rb:185:in `call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.0/lib/apipie_bindings/resource.rb:21:in `call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.2/lib/hammer_cli/apipie/command.rb:43:in `send_request'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.10.2/lib/hammer_cli_foreman/commands.rb:166:in `send_request'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.2/lib/hammer_cli/apipie/command.rb:34: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.2/lib/hammer_cli/abstract.rb:29: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.2/lib/hammer_cli/abstract.rb:29: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.2/lib/hammer_cli/abstract.rb:29: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.2/bin/hammer:147:in `<top (required)>'
    /usr/bin/hammer:23:in `load'
    /usr/bin/hammer:23:in `<main>'


[DEBUG 2017-08-02 12:58:42 HammerCLIKatello::ActivationKeyCommand::CreateCommand] Retrying the command
[ INFO 2017-08-02 12:58:42 HammerCLIKatello::ActivationKeyCommand::CreateCommand] Called with options: {"option_organization_id"=>1, "option_name"=>"test_key3"}
[ INFO 2017-08-02 12:58:43 API] Server: https://sat63-qa-rhel7.example.com
[ INFO 2017-08-02 12:58:43 API] POST /katello/api/activation_keys
[DEBUG 2017-08-02 12:58:43 API] Params: {
    "organization_id" => 1,
               "name" => "test_key3",
        "environment" => {}
}
[DEBUG 2017-08-02 12:58:43 API] Headers: {}
[DEBUG 2017-08-02 12:58:43 API] Using authenticator: HammerCLIForeman::Api::SessionAuthenticatorWrapper
[ERROR 2017-08-02 12:58:43 API] 401 Unauthorized
[DEBUG 2017-08-02 12:58:43 API] {
    "error" => {
        "message" => "Unable to authenticate user admin"
    }
}
[ERROR 2017-08-02 12:58:43 Exception] 

HammerCLIForeman::Api::SessionExpired (Session has expired):
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.0/lib/apipie_bindings/api.rb:246:in `rescue in http_call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.0/lib/apipie_bindings/api.rb:238:in `http_call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.0/lib/apipie_bindings/api.rb:190:in `call_action'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.0/lib/apipie_bindings/api.rb:185:in `call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.0/lib/apipie_bindings/resource.rb:21:in `call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.2/lib/hammer_cli/apipie/command.rb:43:in `send_request'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.10.2/lib/hammer_cli_foreman/commands.rb:166:in `send_request'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.2/lib/hammer_cli/apipie/command.rb:34: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.2/lib/hammer_cli/abstract.rb:29: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.2/lib/hammer_cli/abstract.rb:29: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.2/lib/hammer_cli/abstract.rb:29: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.2/bin/hammer:147:in `<top (required)>'
    /usr/bin/hammer:23:in `load'
    /usr/bin/hammer:23:in `<main>'


[DEBUG 2017-08-02 12:58:43 HammerCLIKatello::ActivationKeyCommand::CreateCommand] Retrying the command
[ INFO 2017-08-02 12:58:43 HammerCLIKatello::ActivationKeyCommand::CreateCommand] Called with options: {"option_organization_id"=>1, "option_name"=>"test_key3"}
[ INFO 2017-08-02 12:58:43 API] Server: https://sat63-qa-rhel7.example.com
[ INFO 2017-08-02 12:58:43 API] POST /katello/api/activation_keys
[DEBUG 2017-08-02 12:58:43 API] Params: {
    "organization_id" => 1,
               "name" => "test_key3",
        "environment" => {}
}
[DEBUG 2017-08-02 12:58:43 API] Headers: {}
[DEBUG 2017-08-02 12:58:43 API] Using authenticator: HammerCLIForeman::Api::SessionAuthenticatorWrapper
[ERROR 2017-08-02 12:58:43 API] 401 Unauthorized
[DEBUG 2017-08-02 12:58:43 API] {
    "error" => {
        "message" => "Unable to authenticate user admin"
    }
}
[ERROR 2017-08-02 12:58:43 Exception] 

HammerCLIForeman::Api::SessionExpired (Session has expired):
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.0/lib/apipie_bindings/api.rb:246:in `rescue in http_call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.0/lib/apipie_bindings/api.rb:238:in `http_call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.0/lib/apipie_bindings/api.rb:190:in `call_action'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.0/lib/apipie_bindings/api.rb:185:in `call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.0/lib/apipie_bindings/resource.rb:21:in `call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.2/lib/hammer_cli/apipie/command.rb:43:in `send_request'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.10.2/lib/hammer_cli_foreman/commands.rb:166:in `send_request'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.2/lib/hammer_cli/apipie/command.rb:34: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.2/lib/hammer_cli/abstract.rb:29: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.2/lib/hammer_cli/abstract.rb:29: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.2/lib/hammer_cli/abstract.rb:29: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.2/bin/hammer:147:in `<top (required)>'
    /usr/bin/hammer:23:in `load'
    /usr/bin/hammer:23:in `<main>'


[DEBUG 2017-08-02 12:58:43 HammerCLIKatello::ActivationKeyCommand::CreateCommand] Retrying the command
[ INFO 2017-08-02 12:58:43 HammerCLIKatello::ActivationKeyCommand::CreateCommand] Called with options: {"option_organization_id"=>1, "option_name"=>"test_key3"}
[ INFO 2017-08-02 12:58:43 API] Server: https://sat63-qa-rhel7.example.com
[ INFO 2017-08-02 12:58:43 API] POST /katello/api/activation_keys
[DEBUG 2017-08-02 12:58:43 API] Params: {
    "organization_id" => 1,
               "name" => "test_key3",
        "environment" => {}
}
[DEBUG 2017-08-02 12:58:43 API] Headers: {}
[DEBUG 2017-08-02 12:58:43 API] Using authenticator: HammerCLIForeman::Api::SessionAuthenticatorWrapper
[ERROR 2017-08-02 12:58:43 API] 401 Unauthorized
[DEBUG 2017-08-02 12:58:43 API] {
    "error" => {
        "message" => "Unable to authenticate user admin"
    }
}
[ERROR 2017-08-02 12:58:43 Exception] 

HammerCLIForeman::Api::SessionExpired (Session has expired):
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.0/lib/apipie_bindings/api.rb:246:in `rescue in http_call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.0/lib/apipie_bindings/api.rb:238:in `http_call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.0/lib/apipie_bindings/api.rb:190:in `call_action'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.0/lib/apipie_bindings/api.rb:185:in `call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.0/lib/apipie_bindings/resource.rb:21:in `call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.2/lib/hammer_cli/apipie/command.rb:43:in `send_request'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.10.2/lib/hammer_cli_foreman/commands.rb:166:in `send_request'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.2/lib/hammer_cli/apipie/command.rb:34: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.2/lib/hammer_cli/abstract.rb:29: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.2/lib/hammer_cli/abstract.rb:29: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.2/lib/hammer_cli/abstract.rb:29: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.2/bin/hammer:147:in `<top (required)>'
    /usr/bin/hammer:23:in `load'
    /usr/bin/hammer:23:in `<main>'


[DEBUG 2017-08-02 12:58:43 HammerCLIKatello::ActivationKeyCommand::CreateCommand] Retrying the command
[ INFO 2017-08-02 12:58:43 HammerCLIKatello::ActivationKeyCommand::CreateCommand] Called with options: {"option_organization_id"=>1, "option_name"=>"test_key3"}
[ INFO 2017-08-02 12:58:43 API] Server: https://sat63-qa-rhel7.example.com
[ INFO 2017-08-02 12:58:43 API] POST /katello/api/activation_keys
[DEBUG 2017-08-02 12:58:43 API] Params: {
    "organization_id" => 1,
               "name" => "test_key3",
        "environment" => {}
}
[DEBUG 2017-08-02 12:58:43 API] Headers: {}
[DEBUG 2017-08-02 12:58:43 API] Using authenticator: HammerCLIForeman::Api::SessionAuthenticatorWrapper
[ERROR 2017-08-02 12:58:43 API] 401 Unauthorized
[DEBUG 2017-08-02 12:58:43 API] {
    "error" => {
        "message" => "Unable to authenticate user admin"
    }
}
[ERROR 2017-08-02 12:58:43 Exception] 

HammerCLIForeman::Api::SessionExpired (Session has expired):
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.0/lib/apipie_bindings/api.rb:246:in `rescue in http_call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.0/lib/apipie_bindings/api.rb:238:in `http_call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.0/lib/apipie_bindings/api.rb:190:in `call_action'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.0/lib/apipie_bindings/api.rb:185:in `call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.0/lib/apipie_bindings/resource.rb:21:in `call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.2/lib/hammer_cli/apipie/command.rb:43:in `send_request'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.10.2/lib/hammer_cli_foreman/commands.rb:166:in `send_request'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.2/lib/hammer_cli/apipie/command.rb:34: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.2/lib/hammer_cli/abstract.rb:29: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.2/lib/hammer_cli/abstract.rb:29: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.2/lib/hammer_cli/abstract.rb:29: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.2/bin/hammer:147:in `<top (required)>'
    /usr/bin/hammer:23:in `load'
    /usr/bin/hammer:23:in `<main>'


[DEBUG 2017-08-02 12:58:43 HammerCLIKatello::ActivationKeyCommand::CreateCommand] Retrying the command
[ INFO 2017-08-02 12:58:43 HammerCLIKatello::ActivationKeyCommand::CreateCommand] Called with options: {"option_organization_id"=>1, "option_name"=>"test_key3"}
[ INFO 2017-08-02 12:58:43 API] Server: https://sat63-qa-rhel7.example.com
[ INFO 2017-08-02 12:58:43 API] POST /katello/api/activation_keys
[DEBUG 2017-08-02 12:58:43 API] Params: {
    "organization_id" => 1,
               "name" => "test_key3",
        "environment" => {}
}
[DEBUG 2017-08-02 12:58:43 API] Headers: {}
[DEBUG 2017-08-02 12:58:43 API] Using authenticator: HammerCLIForeman::Api::SessionAuthenticatorWrapper
[ERROR 2017-08-02 12:58:43 API] 401 Unauthorized
[DEBUG 2017-08-02 12:58:43 API] {
    "error" => {
        "message" => "Unable to authenticate user admin"
    }
}
[ERROR 2017-08-02 12:58:43 Exception] 

HammerCLIForeman::Api::SessionExpired (Session has expired):
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.0/lib/apipie_bindings/api.rb:246:in `rescue in http_call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.0/lib/apipie_bindings/api.rb:238:in `http_call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.0/lib/apipie_bindings/api.rb:190:in `call_action'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.0/lib/apipie_bindings/api.rb:185:in `call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.0/lib/apipie_bindings/resource.rb:21:in `call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.2/lib/hammer_cli/apipie/command.rb:43:in `send_request'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.10.2/lib/hammer_cli_foreman/commands.rb:166:in `send_request'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.2/lib/hammer_cli/apipie/command.rb:34: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.2/lib/hammer_cli/abstract.rb:29: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.2/lib/hammer_cli/abstract.rb:29: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.2/lib/hammer_cli/abstract.rb:29: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.2/bin/hammer:147:in `<top (required)>'
    /usr/bin/hammer:23:in `load'
    /usr/bin/hammer:23:in `<main>'

Comment 1 Tomas Strachota 2017-08-14 10:22:38 UTC
This issue has been fixed in hammer-cli-foreman 0.11.0, moving the bug to POST.

Hammer gets no longer trapped into an infinite loop there, but prints an error message:
"Invalid username or password, continuing with session for ''"

This message isn't correct, but since it's a different issue, we track it as a separate BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1481184

Comment 3 Peter Ondrejka 2017-12-19 09:36:03 UTC
Verified in Sat 6.3 snap 29, talked to Tomas offline, as the corner case mentioned above is not directly blocking this bug and has low severity, I created http://projects.theforeman.org/issues/22027 for it.

Comment 4 Satellite Program 2018-02-21 16:54:37 UTC
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


Note You need to log in before you can comment on or make changes to this bug.