Project

General

Profile

Actions

Bug #6347

closed

activation_keys.add_host_collections API removes host collections from the activation key

Added by dustin tsang almost 10 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
API
Target version:
Difficulty:
easy
Triaged:
Yes
Fixed in Releases:
Found in Releases:

Description

Description of problem:

Calling
@api.resource(:activation_keys).call(
:add_host_collections, {
:id => ak_id,
:host_collection_ids => hc_ids
})
does not associate host_collections with the activation key

Version-Release number of selected component (if applicable):
Satellite-6.0.3-RHEL-6-20140521.0-Satellite-x86_64

How reproducible:
always

Steps to Reproduce:
  1. bundle exec irb
    irb> require 'apipie-bindings'
    irb> api = ApipieBindings::API.new({:uri => 'http://localhost:3000/', :username => 'admin', :password => 'changeme', :api_version=> '2', :aggressive_cache_checking => true})
    irb> api.resource(:activation_keys).call(
    :add_host_collections, {
    :id => ak_id,
    :host_collection_ids => hc_ids
    })
Actual results:
  • API call runs without issues, but does not associate host collections with the activation key
  • according to config/routes/api/v2.rb it looks like :remove_host_collections is called instead

Expected results:
associate host collections with the activation key

Additional info:
  • <sat6>/apidoc/v2/activation_keys/add_host_collections
    does not have complete apidoc
  • Ivan's patch:

diff --git a/config/routes/api/v2.rb b/config/routes/api/v2.rb
index ad7cb9a..3456d10 100644
--- a/config/routes/api/v2.rb
++ b/config/routes/api/v2.rb
27,8 +27,8 @@ Katello::Engine.routes.draw do
match '/releases' => 'activation_keys#available_releases', :via => :get, :on => :member
api_resources :host_collections, :only => [:index]
member do
match '/host_collections' => 'activation_keys#add_host_collections', :via => :post
- match '/host_collections' => 'activation_keys#remove_host_collections', :via => :put
match '/host_collections' => 'activation_keys#add_host_collections', :via => :put
+ match '/host_collections' => 'activation_keys#remove_host_collections', :via => :delete
match '/host_collections/available' => 'activation_keys#available_host_collections', :via => :get
end
api_resources :products, :only => [:index]

Actions

Also available in: Atom PDF