Bug 1767901 - [RFE] automate method to delete a tag from a category
Summary: [RFE] automate method to delete a tag from a category
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Automate
Version: 5.10.9
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: GA
: 5.11.1
Assignee: Jay Zeng
QA Contact: Ganesh Hubale
Red Hat CloudForms Documentation
URL:
Whiteboard:
Depends On: 1744514
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-11-01 16:00 UTC by Satoe Imaishi
Modified: 2023-03-24 15:52 UTC (History)
10 users (show)

Fixed In Version: 5.11.1.0
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1744514
Environment:
Last Closed: 2019-12-13 00:35:54 UTC
Category: ---
Cloudforms Team: CFME Core
Target Upstream Version:
Embargoed:
simaishi: cfme-5.11.z+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2019:4201 0 None None None 2019-12-13 00:37:00 UTC

Comment 2 CFME Bot 2019-11-01 19:44:32 UTC
New commit detected on ManageIQ/manageiq-automation_engine/ivanchuk:

https://github.com/ManageIQ/manageiq-automation_engine/commit/8d53dd4f0a8de7718f55452df7ec575026a8dc29
commit 8d53dd4f0a8de7718f55452df7ec575026a8dc29
Author:     Greg McCullough <gmccullo>
AuthorDate: Wed Sep 11 16:04:55 2019 -0400
Commit:     Greg McCullough <gmccullo>
CommitDate: Wed Sep 11 16:04:55 2019 -0400

    Merge pull request #358 from astrozzc/tag_delete

    Add method to delete tag

    (cherry picked from commit cbd08ec03e441bc051b543a7b9d4ad528aa6f76f)

    https://bugzilla.redhat.com/show_bug.cgi?id=1767901

 lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_methods.rb | 21 +
 spec/engine/miq_ae_method_service/miq_ae_service_methods_spec.rb | 74 +
 2 files changed, 95 insertions(+)


https://github.com/ManageIQ/manageiq-automation_engine/commit/6bff2d3d7398d83ee388548de041ba6e10e070d5
commit 6bff2d3d7398d83ee388548de041ba6e10e070d5
Author:     Greg McCullough <gmccullo>
AuthorDate: Wed Sep 11 16:05:43 2019 -0400
Commit:     Greg McCullough <gmccullo>
CommitDate: Wed Sep 11 16:05:43 2019 -0400

    Merge pull request #363 from astrozzc/category_delete

    Add method to delete category

    (cherry picked from commit 77152e088ad197b582b16eb492d327a3b66c1829)

    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1767901

 lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_methods.rb | 20 +
 spec/engine/miq_ae_method_service/miq_ae_service_methods_spec.rb | 90 +
 2 files changed, 110 insertions(+)

Comment 4 Greg McCullough 2019-11-12 20:23:23 UTC
Hi Ganesh, Just to let you know Jay has moved to a different team so I can help you.

The signature for the tag_delete method takes a string for the tag name (not a hash) as shown in the code here:
https://github.com/ManageIQ/manageiq-automation_engine/blob/master/lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_methods.rb#L136
https://github.com/ManageIQ/manageiq-automation_engine/blob/master/lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_methods.rb#L122

Methods added:
 tag_delete(category, entry)   // Returns false if tag cannot be deleted
 tag_delete!(category, entry)  // Raises error if tag cannot be deleted

For your example you would use:
$evm.execute('tag_delete', 'location', 'test_tag')

While the enhancement request text specified passing a hash engineering ultimately determine that was overkill as the require data would be a single name value.

In addition this matches other tagging method calls, like "tag_exists?(category, entry)" exposed through the same interface.  See https://github.com/ManageIQ/manageiq-automation_engine/blob/master/lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_methods.rb#L103

Comment 5 Ganesh Hubale 2019-11-13 10:05:19 UTC
Fixed!

Verified on version: 5.11.1.0.20191105221526_f1764d4

Thank you so much @Greg

Comment 6 Ganesh Hubale 2019-11-13 10:06:15 UTC
Automated this scenario in PR: https://github.com/ManageIQ/integration_tests/pull/9616

Comment 8 errata-xmlrpc 2019-12-13 00:35:54 UTC
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-2019:4201


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