Bug #3875
closedCan't create smart proxy using the CLI
Description
Description of problem:
When running hammer proxy create
the smart proxy is not created and returns a random error message.
Version-Release number of selected component (if applicable):
$ hammer --version
hammer-0.0.12
$ rpm -qa | grep hammer
rubygem-hammer_cli_foreman-0.0.12-1.el6.noarch
rubygem-hammer_cli-0.0.12-1.el6.noarch
How reproducible:
Aways
Steps to Reproduce:
Try to create a proxy, console session below:
[root@myhost ~]# hammer -u admin -p changeme proxy create --url='http://server:8443' --name='1c4q9xf' Could not create the proxy [root@myhost ~]# hammer -u admin -p changeme proxy create --url='http://server:8443' --name='1c4q9xf' Error: can't convert String into Integer [root@myhost ~]# hammer -u admin -p changeme proxy create --url='http://server:8443' --name='1c4q9xf' Error: can't convert String into Integer [root@myhost ~]# hammer -u admin -p changeme proxy create --url='http://server:8443' --name='1c4q9xf' Could not create the proxy [root@myhost ~]# hammer -u admin -p changeme proxy create --url='http://server:8443' --name='proxy_name' Could not create the proxy [root@myhost ~]# hammer -u admin -p changeme proxy create --url='http://server:8443' --name='proxy_name' Could not create the proxy [root@myhost ~]# hammer -u admin -p changeme proxy create --url='http://server:8443' --name='proxy_name' Error: undefined method `[]' for nil:NilClass [root@myhost ~]# hammer -u admin -p changeme proxy create --url='http://server:8443' --name='proxy_name' Error: can't convert String into Integer
Actual results:
The smart proxy was not created
Expected results:
Have a smart proxy created
Additional info:
Console session with the command executer with hammer -v
:
[root@myhost ~]# hammer -v -u admin -p changeme proxy create --url='http://server:8443' --name='asd6k23' [ERROR 2013-12-13 15:29:20 Exception] Error: can't convert String into Integer Error: can't convert String into Integer [ERROR 2013-12-13 15:29:20 Exception] TypeError (can't convert String into Integer): /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.0.12/lib/hammer_cli_foreman/exception_handler.rb:22:in `[]' /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.0.12/lib/hammer_cli_foreman/exception_handler.rb:22:in `handle_unprocessable_entity' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.12/lib/hammer_cli/exception_handler.rb:23:in `send' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.12/lib/hammer_cli/exception_handler.rb:23:in `handle_exception' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.12/lib/hammer_cli/messages.rb:26:in `handle_exception' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.12/lib/hammer_cli/abstract.rb:30:in `run' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/subcommand/execution.rb:11:in `execute' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.12/lib/hammer_cli/abstract.rb:24:in `run' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/subcommand/execution.rb:11:in `execute' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.12/lib/hammer_cli/abstract.rb:24:in `run' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.12/lib/hammer_cli/main.rb:43:in `run' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:125:in `run' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.12/bin/hammer:62 /usr/bin/hammer:19:in `load' /usr/bin/hammer:19 [root@myhost ~]# hammer -v -u admin -p changeme proxy create --url='http://server:8443' --name='asd6k23' [ERROR 2013-12-13 15:29:24 Exception] Error: can't convert String into Integer Error: can't convert String into Integer [ERROR 2013-12-13 15:29:24 Exception] TypeError (can't convert String into Integer): /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.0.12/lib/hammer_cli_foreman/exception_handler.rb:22:in `[]' /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.0.12/lib/hammer_cli_foreman/exception_handler.rb:22:in `handle_unprocessable_entity' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.12/lib/hammer_cli/exception_handler.rb:23:in `send' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.12/lib/hammer_cli/exception_handler.rb:23:in `handle_exception' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.12/lib/hammer_cli/messages.rb:26:in `handle_exception' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.12/lib/hammer_cli/abstract.rb:30:in `run' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/subcommand/execution.rb:11:in `execute' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.12/lib/hammer_cli/abstract.rb:24:in `run' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/subcommand/execution.rb:11:in `execute' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.12/lib/hammer_cli/abstract.rb:24:in `run' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.12/lib/hammer_cli/main.rb:43:in `run' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:125:in `run' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.12/bin/hammer:62 /usr/bin/hammer:19:in `load' /usr/bin/hammer:19 [root@myhost ~]# hammer -v -u admin -p changeme proxy create --url='http://server:8443' --name='asd6k23' [ERROR 2013-12-13 15:29:26 Exception] Error: undefined method `[]' for nil:NilClass Error: undefined method `[]' for nil:NilClass [ERROR 2013-12-13 15:29:26 Exception] NoMethodError (undefined method `[]' for nil:NilClass): /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.0.12/lib/hammer_cli_foreman/exception_handler.rb:22:in `handle_unprocessable_entity' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.12/lib/hammer_cli/exception_handler.rb:23:in `send' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.12/lib/hammer_cli/exception_handler.rb:23:in `handle_exception' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.12/lib/hammer_cli/messages.rb:26:in `handle_exception' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.12/lib/hammer_cli/abstract.rb:30:in `run' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/subcommand/execution.rb:11:in `execute' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.12/lib/hammer_cli/abstract.rb:24:in `run' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/subcommand/execution.rb:11:in `execute' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.12/lib/hammer_cli/abstract.rb:24:in `run' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.12/lib/hammer_cli/main.rb:43:in `run' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:125:in `run' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.12/bin/hammer:62 /usr/bin/hammer:19:in `load' /usr/bin/hammer:19 [root@myhost ~]# hammer -v -u admin -p changeme proxy create --url='http://server:8443' --name='asd6k23' [ERROR 2013-12-13 15:29:28 Exception] Error: can't convert String into Integer Error: can't convert String into Integer [ERROR 2013-12-13 15:29:28 Exception] TypeError (can't convert String into Integer): /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.0.12/lib/hammer_cli_foreman/exception_handler.rb:22:in `[]' /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.0.12/lib/hammer_cli_foreman/exception_handler.rb:22:in `handle_unprocessable_entity' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.12/lib/hammer_cli/exception_handler.rb:23:in `send' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.12/lib/hammer_cli/exception_handler.rb:23:in `handle_exception' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.12/lib/hammer_cli/messages.rb:26:in `handle_exception' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.12/lib/hammer_cli/abstract.rb:30:in `run' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/subcommand/execution.rb:11:in `execute' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.12/lib/hammer_cli/abstract.rb:24:in `run' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/subcommand/execution.rb:11:in `execute' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.12/lib/hammer_cli/abstract.rb:24:in `run' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.12/lib/hammer_cli/main.rb:43:in `run' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:125:in `run' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.12/bin/hammer:62 /usr/bin/hammer:19:in `load' /usr/bin/hammer:19 [root@myhost ~]# hammer -v -u admin -p changeme proxy create --url='http://server:8443' --name='asd6k23' [ERROR 2013-12-13 15:29:31 Exception] Error: undefined method `[]' for nil:NilClass Error: undefined method `[]' for nil:NilClass [ERROR 2013-12-13 15:29:31 Exception] NoMethodError (undefined method `[]' for nil:NilClass): /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.0.12/lib/hammer_cli_foreman/exception_handler.rb:22:in `handle_unprocessable_entity' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.12/lib/hammer_cli/exception_handler.rb:23:in `send' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.12/lib/hammer_cli/exception_handler.rb:23:in `handle_exception' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.12/lib/hammer_cli/messages.rb:26:in `handle_exception' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.12/lib/hammer_cli/abstract.rb:30:in `run' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/subcommand/execution.rb:11:in `execute' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.12/lib/hammer_cli/abstract.rb:24:in `run' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/subcommand/execution.rb:11:in `execute' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.12/lib/hammer_cli/abstract.rb:24:in `run' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.12/lib/hammer_cli/main.rb:43:in `run' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:125:in `run' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.12/bin/hammer:62 /usr/bin/hammer:19:in `load' /usr/bin/hammer:19
Files
Updated by Martin Bacovsky almost 11 years ago
- Category set to Hammer core
- Status changed from New to Ready For Testing
- Target version set to 1.9.2
- Translation missing: en.field_release set to 2
I was unable to reproduce with current upstream:
$ hammer -v -u admin -p changeme proxy create --url='http://dhRkMU:6301' --name='xv34q' [ INFO 2014-01-16 15:38:43 Init] Initialization of Hammer CLI (0.0.14) has started... [ INFO 2014-01-16 15:38:43 Init] Configuration from the file /etc/foreman/cli_config.yml has been loaded [ INFO 2014-01-16 15:38:43 Init] Configuration from the file /home/mbacovsk/.foreman/cli_config.yml has been loaded [ INFO 2014-01-16 15:38:43 Modules] Extension module hammer_cli_foreman (0.0.15) loaded [ INFO 2014-01-16 15:38:44 HammerCLI::MainCommand] subcommand organization (HammerCLIForeman::Organization) was removed. [ INFO 2014-01-16 15:38:44 HammerCLI::MainCommand] subcommand organization (HammerCLIKatello::Organization) was created. [ INFO 2014-01-16 15:38:44 Modules] Extension module hammer_cli_katello (0.0.1) loaded [ INFO 2014-01-16 15:38:44 HammerCLI::MainCommand] Called with options: {"verbose"=>true, "username"=>"admin", "password"=>"***"} [ INFO 2014-01-16 15:38:44 HammerCLIForeman::SmartProxy] Called with options: {} [ INFO 2014-01-16 15:38:44 HammerCLIForeman::SmartProxy::CreateCommand] Called with options: {"name"=>"xv34q", "url"=>"http://dhRkMU:6301"} [DEBUG 2014-01-16 15:38:44 ForemanApi::Resources::SmartProxy] Calling 'create' with params { "smart_proxy" => { "name" => "xv34q", "url" => "http://dhRkMU:6301" } } [ERROR 2014-01-16 15:38:44 Exception] Unable to communicate with the proxy: getaddrinfo: Name or service not known Please check the proxy is configured and running on the host. Could not create the proxy: Unable to communicate with the proxy: getaddrinfo: Name or service not known Please check the proxy is configured and running on the host.
The error message seems okay. The create with sane params works as well
$ hammer -v -u admin -p changeme proxy create --url='https://foreman.mbacovsk.redhat.com:8443' --name='test Proxy' [ INFO 2014-01-16 16:32:51 Init] Initialization of Hammer CLI (0.0.14) has started... [ INFO 2014-01-16 16:32:51 Init] Configuration from the file /etc/foreman/cli_config.yml has been loaded [ INFO 2014-01-16 16:32:51 Init] Configuration from the file /home/mbacovsk/.foreman/cli_config.yml has been loaded [ INFO 2014-01-16 16:32:52 Modules] Extension module hammer_cli_foreman (0.0.15) loaded [ INFO 2014-01-16 16:32:52 HammerCLI::MainCommand] subcommand organization (HammerCLIForeman::Organization) was removed. [ INFO 2014-01-16 16:32:52 HammerCLI::MainCommand] subcommand organization (HammerCLIKatello::Organization) was created. [ INFO 2014-01-16 16:32:52 Modules] Extension module hammer_cli_katello (0.0.1) loaded [ INFO 2014-01-16 16:32:52 HammerCLI::MainCommand] Called with options: {"verbose"=>true, "username"=>"admin", "password"=>"***"} [ INFO 2014-01-16 16:32:52 HammerCLIForeman::SmartProxy] Called with options: {} [ INFO 2014-01-16 16:32:52 HammerCLIForeman::SmartProxy::CreateCommand] Called with options: {"name"=>"test Proxy", "url"=>"https://foreman.mbacovsk.redhat.com:8443"} [DEBUG 2014-01-16 16:32:52 ForemanApi::Resources::SmartProxy] Calling 'create' with params { "smart_proxy" => { "name" => "test Proxy", "url" => "https://foreman.mbacovsk.redhat.com:8443" } } [DEBUG 2014-01-16 16:32:53 ForemanApi::Resources::SmartProxy] Method 'create' responded with { "smart_proxy" => { "created_at" => "2014-01-16T15:32:52Z", "id" => 3, "name" => "test Proxy", "updated_at" => "2014-01-16T15:32:52Z", "url" => "https://foreman.mbacovsk.redhat.com:8443" } } Smart proxy created
Updated by Dominic Cleal almost 11 years ago
- Status changed from Ready For Testing to Resolved
Please let us know if this needs re-opening, if it's still an issue in the latest version (went out with 1.3.2).
Updated by Elyézer Rezende almost 11 years ago
I have run the test again and here is the results:
2014-01-20 16:50:40 - robottelo - DEBUG - LANG=en_US hammer -v -u admin -p changeme proxy create --url='http://hjlFtt:2974' --name='c8u8r' Error: can't convert String into Integer [ERROR 2014-01-20 13:50:39 Exception] TypeError (can't convert String into Integer): /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.0.15/lib/hammer_cli_foreman/exception_handler.rb:22:in `[]' /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.0.15/lib/hammer_cli_foreman/exception_handler.rb:22:in `handle_unprocessable_entity' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.14/lib/hammer_cli/exception_handler.rb:25:in `send' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.14/lib/hammer_cli/exception_handler.rb:25:in `handle_exception' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.14/lib/hammer_cli/messages.rb:26:in `handle_exception' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.14/lib/hammer_cli/abstract.rb:26:in `run' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/subcommand/execution.rb:11:in `execute' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.14/lib/hammer_cli/abstract.rb:22:in `run' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/subcommand/execution.rb:11:in `execute' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.14/lib/hammer_cli/abstract.rb:22:in `run' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:125:in `run' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.14/bin/hammer:61 /usr/bin/hammer:19:in `load' /usr/bin/hammer:19
Using the examples provided above, I have this:
$ hammer -v -u admin -p changeme proxy create --url='http://dhRkMU:6301' --name='xv34q' [ERROR 2014-01-20 13:52:55 Exception] Error: can't convert String into Integer Error: can't convert String into Integer [ERROR 2014-01-20 13:52:55 Exception] TypeError (can't convert String into Integer): /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.0.15/lib/hammer_cli_foreman/exception_handler.rb:22:in `[]' /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.0.15/lib/hammer_cli_foreman/exception_handler.rb:22:in `handle_unprocessable_entity' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.14/lib/hammer_cli/exception_handler.rb:25:in `send' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.14/lib/hammer_cli/exception_handler.rb:25:in `handle_exception' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.14/lib/hammer_cli/messages.rb:26:in `handle_exception' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.14/lib/hammer_cli/abstract.rb:26:in `run' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/subcommand/execution.rb:11:in `execute' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.14/lib/hammer_cli/abstract.rb:22:in `run' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/subcommand/execution.rb:11:in `execute' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.14/lib/hammer_cli/abstract.rb:22:in `run' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:125:in `run' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.14/bin/hammer:61 /usr/bin/hammer:19:in `load' /usr/bin/hammer:19
$ hammer -v -u admin -p changeme proxy create --url='https://foreman.mbacovsk.redhat.com:8443' --name='test Proxy' [ERROR 2014-01-20 13:54:21 Exception] Error: can't convert String into Integer Error: can't convert String into Integer [ERROR 2014-01-20 13:54:21 Exception] TypeError (can't convert String into Integer): /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.0.15/lib/hammer_cli_foreman/exception_handler.rb:22:in `[]' /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.0.15/lib/hammer_cli_foreman/exception_handler.rb:22:in `handle_unprocessable_entity' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.14/lib/hammer_cli/exception_handler.rb:25:in `send' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.14/lib/hammer_cli/exception_handler.rb:25:in `handle_exception' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.14/lib/hammer_cli/messages.rb:26:in `handle_exception' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.14/lib/hammer_cli/abstract.rb:26:in `run' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/subcommand/execution.rb:11:in `execute' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.14/lib/hammer_cli/abstract.rb:22:in `run' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/subcommand/execution.rb:11:in `execute' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.14/lib/hammer_cli/abstract.rb:22:in `run' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:125:in `run' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.14/bin/hammer:61 /usr/bin/hammer:19:in `load' /usr/bin/hammer:19
The current environment:
$ rpm -qa | grep foreman foreman-release-1.4.0-0.develop.201401071212git9ef39dd.el6.noarch foreman-libvirt-1.5.0-0.develop.201401171753gitb4b1219.el6.noarch foreman-selinux-1.4.0-0.develop.201311220906gite342a0b.el6.noarch foreman-postgresql-1.5.0-0.develop.201401171753gitb4b1219.el6.noarch foreman-proxy-1.4.0-0.develop.201401031522gitd3509e6.el6.noarch foreman-1.5.0-0.develop.201401171753gitb4b1219.el6.noarch foreman-compute-1.5.0-0.develop.201401171753gitb4b1219.el6.noarch rubygem-hammer_cli_foreman-0.0.15-1.el6.noarch rubygem-foreman_api-0.1.9-1.el6.noarch foreman-installer-1.4.0-0.develop.201401031335gitf3eee21.el6.noarch
Updated by Dominic Cleal almost 11 years ago
- Status changed from Resolved to Assigned
- Translation missing: en.field_release deleted (
2)
I've just tried this on EL6 and can reproduce the issues in the previous comment. But note, this only happens when we're hitting the 422 unprocessible error handler - normal proxy creation works fine. I think you're only hitting these problems because the URLs are random nonsense.
I added some debug in here and found the response is a single array:
https://github.com/theforeman/hammer-cli-foreman/blob/master/lib/hammer_cli_foreman/exception_handler.rb#L21
response.inspect => ["Unable to communicate with the proxy: getaddrinfo: Name or service not known", "Please check the proxy is configured and running on the host."]
There's no hash with a "full_messages" element.
Updated by Og Maciel almost 11 years ago
Thanks Dominic for updating it.
[root@ibm-hs22-02 ~]# hammer proxy list ------------------------------------------------------------------------------ ID | NAME | URL ------------------------------------------------------------------------------ 1 | ibm-[HIDDEN].com | https://ibm-[HIDDEN].co... ------------------------------------------------------------------------------ [root@ibm-hs22-02 ~]# hammer -v proxy delete --id 1 [ INFO 2014-01-20 14:44:32 Init] Initialization of Hammer CLI (0.0.14) has started... [ INFO 2014-01-20 14:44:32 Init] Configuration from the file /etc/foreman/cli_config.yml has been loaded [ INFO 2014-01-20 14:44:32 Modules] Extension module hammer_cli_foreman (0.0.15) loaded [ INFO 2014-01-20 14:44:32 HammerCLI::MainCommand] Called with options: {"verbose"=>true} [ INFO 2014-01-20 14:44:32 HammerCLIForeman::SmartProxy] Called with options: {} [ INFO 2014-01-20 14:44:32 HammerCLIForeman::SmartProxy::DeleteCommand] Called with options: {"id"=>"1"} [ERROR 2014-01-20 14:44:32 Exception] Error: 500 Internal Server Error Could not delete the proxy: Error: 500 Internal Server Error [ERROR 2014-01-20 14:44:32 Exception] RestClient::InternalServerError (500 Internal Server Error): /usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/abstract_response.rb:48:in `return!' /usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/request.rb:220:in `process_result' /usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/request.rb:169:in `transmit' /usr/lib/ruby/1.8/net/http.rb:543:in `start' /usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/request.rb:166:in `transmit' /usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/request.rb:60:in `execute' /usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/request.rb:31:in `execute' /usr/lib/ruby/gems/1.8/gems/rest-client-1.6.1/lib/restclient/resource.rb:80:in `delete' /usr/lib/ruby/gems/1.8/gems/foreman_api-0.1.9/lib/foreman_api/base.rb:78:in `send' /usr/lib/ruby/gems/1.8/gems/foreman_api-0.1.9/lib/foreman_api/base.rb:78:in `http_call' /usr/lib/ruby/gems/1.8/gems/foreman_api-0.1.9/lib/foreman_api/base.rb:61:in `perform_call' /usr/lib/ruby/gems/1.8/gems/foreman_api-0.1.9/lib/foreman_api/resources/smart_proxy.rb:71:in `destroy' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.14/lib/hammer_cli/./apipie/resource.rb:38:in `send' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.14/lib/hammer_cli/./apipie/resource.rb:38:in `call' /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.0.15/lib/hammer_cli_foreman/commands.rb:34:in `send_request' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.14/lib/hammer_cli/./apipie/write_command.rb:10:in `execute' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.14/lib/hammer_cli/abstract.rb:22:in `run' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/subcommand/execution.rb:11:in `execute' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.14/lib/hammer_cli/abstract.rb:22:in `run' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/subcommand/execution.rb:11:in `execute' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.14/lib/hammer_cli/abstract.rb:22:in `run' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:125:in `run' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.14/bin/hammer:61 /usr/bin/hammer:19:in `load' /usr/bin/hammer:19 [root@ibm-hs22-02 ~]# hammer -v proxy create --url='http://server:8443' --name='1c4q9xf' [ INFO 2014-01-20 14:46:10 Init] Initialization of Hammer CLI (0.0.14) has started... [ INFO 2014-01-20 14:46:10 Init] Configuration from the file /etc/foreman/cli_config.yml has been loaded [ INFO 2014-01-20 14:46:11 Modules] Extension module hammer_cli_foreman (0.0.15) loaded [ INFO 2014-01-20 14:46:11 HammerCLI::MainCommand] Called with options: {"verbose"=>true} [ INFO 2014-01-20 14:46:11 HammerCLIForeman::SmartProxy] Called with options: {} [ INFO 2014-01-20 14:46:11 HammerCLIForeman::SmartProxy::CreateCommand] Called with options: {"url"=>"http://server:8443", "name"=>"1c4q9xf"} [ERROR 2014-01-20 14:46:11 Exception] Error: undefined method `[]' for nil:NilClass Error: undefined method `[]' for nil:NilClass [ERROR 2014-01-20 14:46:11 Exception] NoMethodError (undefined method `[]' for nil:NilClass): /usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.0.15/lib/hammer_cli_foreman/exception_handler.rb:22:in `handle_unprocessable_entity' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.14/lib/hammer_cli/exception_handler.rb:25:in `send' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.14/lib/hammer_cli/exception_handler.rb:25:in `handle_exception' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.14/lib/hammer_cli/messages.rb:26:in `handle_exception' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.14/lib/hammer_cli/abstract.rb:26:in `run' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/subcommand/execution.rb:11:in `execute' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.14/lib/hammer_cli/abstract.rb:22:in `run' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/subcommand/execution.rb:11:in `execute' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.14/lib/hammer_cli/abstract.rb:22:in `run' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:125:in `run' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.0.14/bin/hammer:61 /usr/bin/hammer:19:in `load' /usr/bin/hammer:19
Updated by Dominic Cleal almost 11 years ago
- Status changed from Assigned to Closed
- Assignee changed from Martin Bacovsky to Tomáš Strachota
- % Done changed from 0 to 100
- Translation missing: en.field_release set to 2
The 422 handling (String/Integer error) is fixed in git, which is probably why Martin couldn't reproduce. Will be in the next version to be released shortly.
Commit: https://github.com/theforeman/hammer-cli-foreman/commit/0a28ad0bd
The 500 error in Og's comment 6 is #4033 / #3194 due to foreign keys.
The undefined method `[]' error in Og's comment 6 is likely changed by the above commit too, so please retry.