Project

General

Profile

Actions

Bug #8640

closed

hammer could not update host and report: host not found

Added by Xiaofei Yan over 9 years ago. Updated almost 9 years ago.

Status:
Closed
Priority:
Urgent
Category:
Hammer core
Target version:
-
Difficulty:
Triaged:
Team Backlog:
Fixed in Releases:
Found in Releases:
In Kanboard:

Description

hammer could not update any host parameter with the error:

Could not update the host:
Error: host not found

Here is debug info.
[ INFO 2014-12-10 15:43:06 Init] Initialization of Hammer CLI (0.1.3) has started...
[DEBUG 2014-12-10 15:43:06 Init] Running at ruby 1.8.7-p374
[ INFO 2014-12-10 15:43:06 Init] Configuration from the file /etc/hammer/cli_config.yml has been loaded
[ INFO 2014-12-10 15:43:06 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman.yml has been loaded
[ INFO 2014-12-10 15:43:06 Init] Configuration from the file /etc/hammer/cli.modules.d/migrated.yml has been loaded
[ WARN 2014-12-10 15:43:06 Modules] Legacy configuration of modules detected. Check section about configuration in user manual
[DEBUG 2014-12-10 15:43:06 Connection] Registered: foreman
[DEBUG 2014-12-10 15:43:06 API] Global headers: {
:accept => "application/json;version=2",
:content_type => "application/json",
"Accept-Language" => "en"
}
[ INFO 2014-12-10 15:43:06 Modules] Extension module hammer_cli_foreman (0.1.3) loaded
[ INFO 2014-12-10 15:43:06 Modules] Extension module hammer_cli_foreman (0.1.3) loaded
[DEBUG 2014-12-10 15:43:06 Init] Using locale 'en'
[DEBUG 2014-12-10 15:43:06 Init] 'mo' files for locale domain 'hammer-cli' loaded from '/usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.3/locale'
[DEBUG 2014-12-10 15:43:06 Init] 'mo' files for locale domain 'hammer-cli' loaded from '/usr/share/locale'
[DEBUG 2014-12-10 15:43:06 Init] 'mo' files for locale domain 'hammer-cli-foreman' loaded from '/usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.3/locale'
[DEBUG 2014-12-10 15:43:06 Init] 'mo' files for locale domain 'hammer-cli-foreman' loaded from '/usr/share/locale'
[ INFO 2014-12-10 15:43:06 HammerCLI::MainCommand] Called with options: {"option_debug"=>true}
[ INFO 2014-12-10 15:43:06 HammerCLIForeman::Host] Called with options: {}
[ INFO 2014-12-10 15:43:06 HammerCLIForeman::Host::UpdateCommand] Called with options: {"option_interface_list"=>[], "option_medium_id"=>"5", "option_build"=>true, "option_hostgroup_id"=>"22", "option_ptable_id"=>"9", "option_volume_list"=>[], "option_name"=>"bws0600.ihep.ac.cn", "option_operatingsystem_id"=>"2"}
[ INFO 2014-12-10 15:43:06 API] GET /api/hostgroups/22/hosts
[DEBUG 2014-12-10 15:43:06 API] Params: {
:search => "name = \"bws0600.ihep.ac.cn\""
}
[DEBUG 2014-12-10 15:43:06 API] Headers: {
:params => {
:search => "name = \"bws0600.ihep.ac.cn\""
}
}
[DEBUG 2014-12-10 15:43:07 API] Response: {
"sort" => {
"order" => nil,
"by" => nil
},
"per_page" => 300,
"subtotal" => 0,
"page" => 1,
"total" => 21,
"results" => [],
"search" => "name = \"bws0600.ihep.ac.cn\""
}
[DEBUG 2014-12-10 15:43:07 API] Response headers: {
:etag => "\"44a9e00548d1789202e0045f503dac08\"",
:status => "200 OK",
:foreman_version => "1.7.0",
:connection => "close",
:x_request_id => "75d89aefadb1016d68853e34f65959e9",
:set_cookie => [
[0] "_session_id=2e553ba46b75749b81b8349a55f10234; path=/; HttpOnly"
],
:x_rack_cache => "miss",
:transfer_encoding => "chunked",
:apipie_checksum => "685d349353c52e2f4e4c83bfde0b27d3",
:content_type => "application/json; charset=utf-8",
:x_runtime => "0.101329",
:cache_control => "must-revalidate, private, max-age=0",
:date => "Wed, 10 Dec 2014 07:43:07 GMT",
:foreman_api_version => "2",
:x_powered_by => "Phusion Passenger 4.0.18",
:x_ua_compatible => "IE=Edge,chrome=1",
:server => "Apache/2.2.15 (Scientific Linux)"
}
[ERROR 2014-12-10 15:43:07 Exception] Error: host not found
Could not update the host:
Error: host not found
[ERROR 2014-12-10 15:43:07 Exception]

HammerCLIForeman::ResolverError (host not found):
/usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.3/lib/hammer_cli_foreman/id_resolver.rb:140:in `pick_result'
/usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.3/lib/hammer_cli_foreman/id_resolver.rb:136:in `find_resource'
/usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.3/lib/hammer_cli_foreman/id_resolver.rb:114:in `get_id'
/usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.3/lib/hammer_cli_foreman/id_resolver.rb:108:in `host_id'
/usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.3/lib/hammer_cli_foreman/commands.rb:143:in `send'
/usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.3/lib/hammer_cli_foreman/commands.rb:143:in `get_resource_id'
/usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.3/lib/hammer_cli_foreman/commands.rb:132:in `get_identifier'
/usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.3/lib/hammer_cli_foreman/commands.rb:180:in `customized_options'
/usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.3/lib/hammer_cli_foreman/commands.rb:185:in `request_params'
/usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.3/lib/hammer_cli_foreman/host.rb:66:in `request_params'
/usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.3/lib/hammer_cli/./apipie/command.rb:42:in `send_request'
/usr/lib/ruby/gems/1.8/gems/hammer_cli_foreman-0.1.3/lib/hammer_cli_foreman/commands.rb:164:in `send_request'
/usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.3/lib/hammer_cli/./apipie/command.rb:33:in `execute'
/usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:68:in `run'
/usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.3/lib/hammer_cli/./apipie/../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:68:in `run'
/usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.3/lib/hammer_cli/./apipie/../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:68:in `run'
/usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.3/lib/hammer_cli/./apipie/../abstract.rb:22:in `run'
/usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:126:in `run'
/usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.3/bin/hammer:106
/usr/bin/hammer:19:in `load'
/usr/bin/hammer:19


Related issues 1 (0 open1 closed)

Blocks Foreman - Tracker #10226: Core Sprint 1Resolved04/20/201505/10/2015

Actions
Actions #1

Updated by Corey Osman about 9 years ago

I have seen this issue before, and it appears that it might be related to the roles. Is the user your authenticating with able to view the host?

Actions #2

Updated by Eric Helms almost 9 years ago

Actions #3

Updated by Tomáš Strachota almost 9 years ago

I confirm this is most likely permission related. With enough permissions host editing works fine.

From the API perspective "Not found" is correct response when one tries to look for a resource without having view permissions. The problem is we can't distinguish between not having permissions and looking for non-existent object in the CLI to return better error message.

Actions #4

Updated by Tomáš Strachota almost 9 years ago

  • Status changed from New to Closed
  • Assignee set to Tomáš Strachota

Ok, on the second look into the logs I have to say the problem was elsewhere in this case. Hammer selected wrong api route for the host lookup:

[ INFO 2014-12-10 15:43:06 API] GET /api/hostgroups/22/hosts

This behaviour has been fixed in 0.2.0 release. I tested it today to make sure. Host is found and hostgroup successfully is updated.

Permission problem mentioned in my previous post is not a bug. I'm closing this one.

Actions

Also available in: Atom PDF