Project

General

Profile

Bug #15162

Unable to remove host collection from activation key via hammer

Added by Andrew Kofink about 3 years ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Hammer
Target version:
Difficulty:
Triaged:
Yes
Bugzilla link:
Team Backlog:
Fixed in Releases:
Found in Releases:

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1336716
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:
Always

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 - >>> [dell-t320-01.khw.lab.eng.bos.redhat.com] 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 - >>> [dell-t320-01.khw.lab.eng.bos.redhat.com] 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
Description:
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 about 3 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.

History

#1 Updated by The Foreman Bot about 3 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/Katello/katello/pull/6063 added

#2 Updated by David Davis about 3 years ago

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

#3 Updated by Eric Helms about 3 years ago

  • Legacy Backlogs Release (now unused) set to 143

#4 Updated by Anonymous about 3 years ago

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

Also available in: Atom PDF