Bug 1508437 - Label->Tag mapping doesn't unassign last tag(s)
Summary: Label->Tag mapping doesn't unassign last tag(s)
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Providers
Version: 5.9.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: GA
: 5.10.0
Assignee: Beni Paskin-Cherniavsky
QA Contact: juwatts
URL:
Whiteboard: container
Depends On:
Blocks: 1510095 1510096
TreeView+ depends on / blocked
 
Reported: 2017-11-01 12:29 UTC by Beni Paskin-Cherniavsky
Modified: 2018-06-21 21:09 UTC (History)
7 users (show)

Fixed In Version: 5.10.0.0
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1510095 1510096 (view as bug list)
Environment:
Last Closed: 2018-06-21 21:09:21 UTC
Category: Bug
Cloudforms Team: Container Management
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Beni Paskin-Cherniavsky 2017-11-01 12:29:31 UTC
Description of problem:
When label->tag mapping has assigned some tag(s) to an object, and a later refresh should remove them all, eg. because the the labels have changed, it doesn't.

Version-Release number of selected component (if applicable):
bug on master, 5.9, 5.8.  (5.7 not affected)
According to code, affects mapping for both openshift and amazon, but I only tested openshift.
For openshift on master & 5.9, only affects the old inventory_object_refresh=false mode; tag mapping for graph refresh mode still WIP, but will not be affected.


How reproducible: 100%

Steps to Reproduce:

1. Top right menu ↓ Configuration -> Settings accordion -> Region -> Tags tab -> Map Tags subtab.
   Create a mapping: Entity: <All>, Label: foo, Category: Foo

2. Assign `foo` label to something in openshift, e.g.:

       oc label rc -n default router-1 foo=bar

3. Refresh the provider, wait for it to finish.

4. Find the entity you labelled in UI, confirm it got tagged: "My Company Tags | Foo: bar".

5. Unassign the label:

       oc label rc -n default router-1 foo-

6. Refresh the provider, wait for it to finish.  Check tags again in UI.


Actual results: It remains tagged "Foo: bar".

Expected results: Should show "No My Company Tags have been assigned".

Comment 1 Dave Johnson 2017-11-01 12:43:37 UTC
Please assess the impact of this issue and update the severity accordingly.  Please refer to https://bugzilla.redhat.com/page.cgi?id=fields.html#bug_severity for a reminder on each severity's definition.

If it's something like a tracker bug where it doesn't matter, please set the severity to Low.

Comment 2 Beni Paskin-Cherniavsky 2017-11-01 12:45:54 UTC
Setting severity medium, but if somebody relies strongly on tag mapping, this could be high.

Comment 4 CFME Bot 2017-11-01 14:26:42 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/5bc81aa9802a22fb4b2f9cf114d144f51f0ebdf1

commit 5bc81aa9802a22fb4b2f9cf114d144f51f0ebdf1
Author:     Beni Cherniavsky-Paskin <cben>
AuthorDate: Wed Nov 1 14:32:22 2017 +0200
Commit:     Beni Cherniavsky-Paskin <cben>
CommitDate: Wed Nov 1 14:32:22 2017 +0200

    Do unassign tags when mapped tags list becomes empty
    
    .blank? check was a bug, it also skipped retagging
    given empty array.
    
    Fixes
    https://bugzilla.redhat.com/show_bug.cgi?id=1508437

 app/models/ems_refresh/save_inventory.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comment 11 CFME Bot 2017-11-13 14:51:34 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/61a5961565c2db7f3c8a272cc886a000d6a3e2e2

commit 61a5961565c2db7f3c8a272cc886a000d6a3e2e2
Author:     Beni Cherniavsky-Paskin <cben>
AuthorDate: Mon Nov 13 13:51:55 2017 +0200
Commit:     Beni Cherniavsky-Paskin <cben>
CommitDate: Mon Nov 13 14:07:35 2017 +0200

    Improve save_tags_inventory tests
    
    Use factory for more realistic setup.
    Add test for
    https://bugzilla.redhat.com/show_bug.cgi?id=1508437

 .../save_inventory/save_tags_inventory_spec.rb     | 51 ++++++++++++++++++----
 1 file changed, 43 insertions(+), 8 deletions(-)

Comment 12 CFME Bot 2017-11-20 19:41:57 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/1509ecb221d1d5c138c4dc8b264dd35303071964

commit 1509ecb221d1d5c138c4dc8b264dd35303071964
Author:     Beni Cherniavsky-Paskin <cben>
AuthorDate: Mon Nov 20 15:27:40 2017 +0200
Commit:     Beni Cherniavsky-Paskin <cben>
CommitDate: Mon Nov 20 15:27:40 2017 +0200

    Fix save_tags_inventory spec: assign the tag, not the catogory
    
    In #16453, I changed this spec to "realistically"
    create a tag mapping + category + tag.
    But I made a typo/thinko, taking the parent
    (category) tag to be assigned to the vm.
    This caused false failure for #16449 and days of
    lost work debugging/rewriting it, eventually caused
    similar failure in the rewrite too :-(
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1508437

 spec/models/ems_refresh/save_inventory/save_tags_inventory_spec.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


Note You need to log in before you can comment on or make changes to this bug.