| Summary: | API template_combinations GET and DELETE by id not working | ||
|---|---|---|---|
| Product: | Red Hat Satellite | Reporter: | Peter Vreman <peter.vreman> |
| Component: | API | Assignee: | Shimon Shtein <sshtein> |
| Status: | CLOSED ERRATA | QA Contact: | Renzo Nuccitelli <rnuccite> |
| Severity: | high | Docs Contact: | |
| Priority: | high | ||
| Version: | 6.2.0 | CC: | bbuckingham, bkearney, brubisch, jcallaha, rnuccite |
| Target Milestone: | Unspecified | Keywords: | Triaged |
| Target Release: | Unused | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2018-02-21 16:51:07 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Bug Depends On: | |||
| Bug Blocks: | 1122832 | ||
Patch to make the API consistent that also DELETE and GET will only work on combinations with the environment or hostgroup
[crash] root@li-lc-1578:/usr/share/foreman# diff -u /usr/share/foreman/config/routes/api/v2.rb.160831-1 /usr/share/foreman/config/routes/api/v2.rb
--- /usr/share/foreman/config/routes/api/v2.rb.160831-1 2016-08-09 22:10:52.000000000 +0000
+++ /usr/share/foreman/config/routes/api/v2.rb 2016-08-31 13:47:35.776275554 +0000
@@ -32,7 +32,7 @@
get 'build_pxe_default' # Keeping get variant for backward compatibility, see #6976 for details
get 'revision'
end
- resources :template_combinations, :only => [:index, :create, :update, :show]
+ resources :template_combinations, :only => [:index, :create, :update, :show, :destroy]
resources :operatingsystems, :except => [:new, :edit]
resources :os_default_templates, :except => [:new, :edit]
end
@@ -44,7 +44,7 @@
post 'build_pxe_default'
get 'revision'
end
- resources :template_combinations, :only => [:index, :create, :update, :show]
+ resources :template_combinations, :only => [:index, :create, :update, :show, :destroy]
resources :operatingsystems, :except => [:new, :edit]
resources :os_default_templates, :except => [:new, :edit]
end
@@ -66,7 +66,7 @@
end
end
resources :hosts, :except => [:new, :edit]
- resources :template_combinations, :only => [:index, :show, :create, :update]
+ resources :template_combinations, :only => [:index, :create, :update, :show, :destroy]
end
resources :fact_values, :only => [:index]
@@ -89,7 +89,7 @@
resources :puppetclasses, :except => [:new, :edit]
resources :hostgroup_classes, :path => :puppetclass_ids, :only => [:index, :create, :destroy]
resources :hosts, :except => [:new, :edit]
- resources :template_combinations, :only => [:show, :index, :create, :update]
+ resources :template_combinations, :only => [:index, :create, :update, :show, :destroy]
end
resources :media, :except => [:new, :edit] do
@@ -228,7 +228,6 @@
resources :template_kinds, :only => [:index]
- resources :template_combinations, :only => [:show, :destroy]
resources :config_groups, :except => [:new, :edit]
resources :compute_attributes, :only => [:create, :update]
[crash] root@li-lc-1578:/usr/share/foreman# diff -u /usr/share/foreman/app/controllers/api/v2/template_combinations_controller.rb.160831-1 /usr/share/foreman/app/controllers/api/v2/template_combinations_controller.rb
--- /usr/share/foreman/app/controllers/api/v2/template_combinations_controller.rb.160831-1 2016-08-09 22:10:52.000000000 +0000
+++ /usr/share/foreman/app/controllers/api/v2/template_combinations_controller.rb 2016-08-31 13:36:02.841309152 +0000
@@ -41,7 +41,6 @@
process_response @template_combination.save
end
- api :GET, "/template_combinations/:id", N_("Show template combination")
api :GET, "/config_templates/:config_template_id/template_combinations/:id", N_("Show template combination"), :deprecated => true
api :GET, "/provisioning_templates/:provisioning_template_id/template_combinations/:id", N_("Show template combination")
api :GET, "/hostgroups/:hostgroup_id/template_combinations/:id", N_("Show template combination")
@@ -63,8 +62,13 @@
process_response @template_combination.update_attributes!(params[:template_combination])
end
- api :DELETE, "/template_combinations/:id", N_("Delete a template combination")
+ api :DELETE, "/config_templates/:config_template_id/template_combinations/:id", N_("Delete template combination"), :deprecated => true
+ api :DELETE, "/provisioning_templates/:provisioning_template_id/template_combinations/:id", N_("Delete template combination")
+ api :DELETE, "/hostgroups/:hostgroup_id/template_combinations/:id", N_("Delete template combination")
+ api :DELETE, "/environments/:environment_id/template_combinations/:id", N_("Delete template combination")
param :id, :identifier, :required => true
+ param_group :template_combination_identifiers
+ param_group :template_combination
def destroy
process_response @template_combination.destroy
Created redmine issue http://projects.theforeman.org/issues/16397 from this bug Upstream bug assigned to sshtein Upstream bug assigned to sshtein Upstream bug component is API Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/16397 has been resolved. Bug fixed on 6.3. Added automation issue to avoid regressions on future: https://github.com/SatelliteQE/robottelo/issues/3961. Moving to verified. 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
|
Description of problem: With 6.2.1 there GET and DELETE of templates_combinations is not working anymore. This is a regression over 6.0/6.1 where the same process worked for years. [crash] root@li-lc-1578:~# curl -K /opt/hoici/etc/sat6/curl-hoici.conf "-HContent-Type: application/json" "-d{\"per_page\":9999}" -XGET https://localhost/api/v2/hostgroups/3 | jq .template_combinations [ { "config_template_name": "HOIOS-6.8.1-hf1-Library", "id": 1, "provisioning_template_id": 106, "provisioning_template_name": "HOIOS-6.8.1-hf1-Library", "hostgroup_id": 3, "hostgroup_name": "crash/AWS-HiltiCloud/Oracle-IAM-DB", "environment_id": null, "environment_name": null, "config_template_id": 106 }, { "config_template_name": "HOIOS-6.8.1-hf3-Library", "id": 44, "provisioning_template_id": 117, "provisioning_template_name": "HOIOS-6.8.1-hf3-Library", "hostgroup_id": 3, "hostgroup_name": "crash/AWS-HiltiCloud/Oracle-IAM-DB", "environment_id": null, "environment_name": null, "config_template_id": 117 } ] [crash] root@li-lc-1578:~# curl -K /opt/hoici/etc/sat6/curl-hoici.conf "-HContent-Type: application/json" "-d{\"per_page\":9999}" -XGET https://localhost/api/v2/template_combinations/44 { "error": {"message":"Resource template_combination not found by id '44'"} } [crash] root@li-lc-1578:~# curl -K /opt/hoici/etc/sat6/curl-hoici.conf "-HContent-Type: application/json" "-d{\"per_page\":9999}" -XGET https://localhost/api/v2/template_combinations/1 { "error": {"message":"Resource template_combination not found by id '1'"} } [crash] root@li-lc-1578:~# curl -K /opt/hoici/etc/sat6/curl-hoici.conf "-HContent-Type: application/json" "-d{\"per_page\":9999}" -XDELETE https://localhost/api/v2/template_combinations/1 { "error": {"message":"Resource template_combination not found by id '1'"} } Version-Release number of selected component (if applicable): How reproducible: Steps to Reproduce: 1. Assiocate a template with a hostgroup 2. Get association using the API GET template_combinations/:id 3. Delete association using the API DELETE template_combinations/:id Actual results: Step 2 and 3 are giving a resource not foudn Expected results: Step 2 lists the tempmplate combination Step 3 deletes the template combination Additional info: