Hello all!
I'm getting the following error when I try to refresh facts of the
discovered hosts through actual API:
$ curl -kSs -H "Content-Type: application/json" -H
"Accept:application/json" -u admin:$PASSWORD
https://localhost/api/v2/discovered_hosts/mac008cfaed69c8/refresh_facts |
jq '.'
{
"status": "404",
"error": "Not Found"
}
This results in these messages in production.log:
2016-09-15 17:14:56 [app] [I] Started GET
"/api/v2/discovered_hosts/mac008cfafcd2f4/refresh_facts" for 127.0.0.1 at
2016-09-15 17:14:56 -0700
2016-09-15 17:14:56 [app] [F]
> ActionController::RoutingError (No route matches [GET]
"/api/v2/discovered_hosts/mac008cfafcd2f4/refresh_facts"):
> actionpack (4.2.5.1)
lib/action_dispatch/middleware/debug_exceptions.rb:21:in call' > actionpack (4.2.5.1) lib/action_dispatch/middleware/show_exceptions.rb:30:in
call'
> railties (4.2.5.1) lib/rails/rack/logger.rb:38:in call_app' > railties (4.2.5.1) lib/rails/rack/logger.rb:22:in
call'
> actionpack (4.2.5.1)
lib/action_dispatch/middleware/request_id.rb:21:in call' > rack (1.6.2) lib/rack/methodoverride.rb:22:in
call'
> rack (1.6.2) lib/rack/runtime.rb:18:in call' > activesupport (4.2.5.1) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in
call'
> actionpack (4.2.5.1) lib/action_dispatch/middleware/static.rb:116:in
call' > rack (1.6.2) lib/rack/sendfile.rb:113:in
call'
> railties (4.2.5.1) lib/rails/engine.rb:518:in call' > railties (4.2.5.1) lib/rails/application.rb:165:in
call'
> railties (4.2.5.1) lib/rails/railtie.rb:194:in public_send' > railties (4.2.5.1) lib/rails/railtie.rb:194:in
method_missing'
> rack (1.6.2) lib/rack/urlmap.rb:66:in block in call' > rack (1.6.2) lib/rack/urlmap.rb:50:in
each'
> rack (1.6.2) lib/rack/urlmap.rb:50:in call' > /usr/share/passenger/phusion_passenger/rack/thread_handler_extension.rb:74:in
process_request'
>
/usr/share/passenger/phusion_passenger/request_handler/thread_handler.rb:141:in
accept_and_process_next_request' > /usr/share/passenger/phusion_passenger/request_handler/thread_handler.rb:109:in
main_loop'
> /usr/share/passenger/phusion_passenger/request_handler.rb:455:in
block (3 levels) in start_threads' > logging (1.8.2) lib/logging/diagnostic_context.rb:323:in
call'
> logging (1.8.2) lib/logging/diagnostic_context.rb:323:in `block in
create_with_logging_context'
>
WebUI does not seem to have any problems with that though. I see the
following in production.log:
2016-09-15 17:14:45 [app] [I] Started GET
"/discovered_hosts/mac008cfafcd2f4" for 127.0.0.1 at 2016-09-15 17:14:45
-0700
2016-09-15 17:14:45 [app] [I] Processing by DiscoveredHostsController#show
as HTML
2016-09-15 17:14:45 [app] [I] Parameters: {"id"=>"mac008cfafcd2f4"}
2016-09-15 17:14:45 [app] [I] Rendered
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_discovery-6.0.0/app/views/discovered_hosts/show.html.erb
within layouts/application (6.9ms)
2016-09-15 17:14:45 [app] [I] Rendered
layouts/_application_content.html.erb (0.5ms)
2016-09-15 17:14:45 [app] [I] Rendered home/_user_dropdown.html.erb
(2.1ms)
2016-09-15 17:14:45 [app] [I] Read fragment views/tabs_and_title_records-5
(0.4ms)
2016-09-15 17:14:45 [app] [I] Rendered home/_topbar.html.erb (6.7ms)
2016-09-15 17:14:45 [app] [I] Rendered layouts/base.html.erb (8.0ms)
2016-09-15 17:14:45 [app] [I] Completed 200 OK in 85ms (Views: 16.7ms |
ActiveRecord: 4.9ms)
Any ideas what I'm doing wrong here? I think I do have proper API call, but
clearly something is missing:
$ curl -kSs -H "Content-Type: application/json" -H
"Accept:application/json" -u admin:$PASSWORD https://localhost/api/v2 | jq
'.' | grep refresh_facts
"Refreshing the facts of a discovered host":
"/api/v2/discovered_hosts/:id/refresh_facts",
I have this issue on both 1.11.2 and 1.12.2.
Thanks in advance!