Closed treydock closed 6 years ago
@treydock, I apologize for taking so long to reply. I'd recommend you to upgrade foreman_templates to 6.0.0 or 5.0.2 at least, because this plugin does not support foreman_templates <= 5.0.1.
I'm now on foreman_templates 6.0.2 and using hammer CLI for templates at version 0.1.0:
tfm-rubygem-foreman_templates-6.0.2-1.fm1_18.el7.noarch
tfm-rubygem-hammer_cli_foreman_templates-0.1.0-1.fm1_18.el7.noarch
[root@foreman-test ~]# hammer import-templates
[Foreman] Username: tdockendorf
[Foreman] Password for tdockendorf:
Could not import:
404 Not Found
Looks like still using route API path:
2018-07-06T08:52:34 [I|app|] Started POST "/api/template/import" for 10.20.0.24 at 2018-07-06 08:52:34 -0400
2018-07-06T08:52:35 [I|app|] Started HEAD "/" for 127.0.0.1 at 2018-07-06 08:52:35 -0400
2018-07-06T08:52:35 [I|app|6cc4a] Processing by DashboardController#index as HTML
2018-07-06T08:52:35 [I|app|6cc4a] Redirected to https://foreman-test.ten.osc.edu/users/login
2018-07-06T08:52:35 [I|app|6cc4a] Filter chain halted as :require_login rendered or redirected
2018-07-06T08:52:35 [I|app|6cc4a] Completed 302 Found in 42ms (ActiveRecord: 7.3ms)
2018-07-06T08:52:36 [F|app|]
2018-07-06T08:52:36 [F|app|] ActionController::RoutingError (No route matches [POST] "/api/template/import"):
2018-07-06T08:52:36 [F|app|]
Route listed by routes rake task:
import_api_templates POST /api(/:apiv)/templates/import(.:format) api/v2/template#import {:format=>"json", :apiv=>/v1|v2/}
@treydock are you using the latest apidoc? After upgrading to a newer version of any foreman plugin there is a possibility that hammer uses the old Apipie cache.
Try hammer -r import-templates. -r or --reload-cache will reload the cache.
Reloading the cache solved my problem.
I think this CLI tool may be using wrong API path? Using Foreman 1.17.1 , foreman_templates 5.0.1 and this project's 0.1.0:
Foreman logs:
Looking at
foreman-rake routes
I see/api/templates/import
not/api/template/import
.