Bug #15162

Unable to remove host collection from activation key via hammer

Added by Andrew Kofink about 4 years ago. Updated almost 2 years ago.

Target version:
Bugzilla link:
Fixed in Releases:
Found in Releases:


Cloned from
Description of problem:
Can't remove host collection from activation key using hammer - operation succeeds but host collection remains associated.

Version-Release number of selected component (if applicable):
Sat 6.2.0 GA SNAP11

How reproducible:

Steps to Reproduce:
1. Associate host collection with activation key.
2. Try to remove host collection from activation key via 'hammer activation-key remove-host-collection' command.
3. Check whether host collection was actually removed.

Actual results:
remove-host-collection command succeeds, but host collection remains associated:

2016-05-17 12:33:07 - robottelo.ssh - DEBUG - >>> [] LANG=en_US.UTF-8 hammer -v -u admin -p changeme activation-key remove-host-collection --host-collection-id="1" --name="v6ncdpkpdL" --organization="X25dny"
2016-05-17 12:33:13 - robottelo.ssh - DEBUG - <<< stdout
The host collection has been removed

2016-05-17 12:33:13 - robottelo.ssh - DEBUG - >>> [] LANG=en_US.UTF-8 hammer -v -u admin -p changeme activation-key info --id="1"
2016-05-17 12:33:18 - robottelo.ssh - DEBUG - <<< stdout
Name: v6ncdpkpdL
ID: 1
Host Limit: Unlimited
Auto Attach: true
Lifecycle Environment:
Content View:
Host Collections:
1) ID: 1
Name: FMpDVYKxmh

Expected results:
Host collection should be removed from activation key.
Also some validation for `activation-key remove-host-collection` command should be present - it shouldn't say 'The host collection has been removed' and finish with 0 return code when operation's failed.

Additional info:
Works as expected via UI (and, basically, 'activation-key info' reflects the changes, so it's an issue with `activation-key remove-host-collection`, not `activation-key info` command)

Related issues

Related to Katello - Refactor #15168: Refactor content_views method view_paramsClosed2016-05-24

Associated revisions

Revision bb736223 (diff)
Added by Andrew Kofink almost 4 years ago

Fixes #15162 - Host collections can be removed (#6063)

Allow the last host collection to be removed from an activation key.

This issue is caused by the deep_munge method in Rails 4. We use our API
to GET a record, update a collection of children, then PUT the updated
record to the API in order to update the DB. If the collection of
children is empty, deep munge in conjunction with strong parameters,
translates the empty array into nil, and the collection of children
remains unchanged.

This fix is a workaround and should be removed when upgrading Foretello
to Rails 5. I made a comment containing "Rails 5" so it can be addressed
during the upgrade with a global find.

Add a test for removing all host collections from an activation key.


#1 Updated by The Foreman Bot about 4 years ago

  • Status changed from New to Ready For Testing
  • Pull request added

#2 Updated by David Davis about 4 years ago

  • Related to Refactor #15168: Refactor content_views method view_params added

#3 Updated by Eric Helms about 4 years ago

  • Legacy Backlogs Release (now unused) set to 143

#4 Updated by Anonymous almost 4 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

Also available in: Atom PDF