Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bulk unassign tags on services and vms #13712

Merged
merged 1 commit into from
Feb 3, 2017
Merged

bulk unassign tags on services and vms #13712

merged 1 commit into from
Feb 3, 2017

Conversation

jntullo
Copy link

@jntullo jntullo commented Jan 31, 2017

Adds ability to bulk unassign tags to multiple services / VM resources

Example:

{
        'action'    => 'unassign_tags',
        'resources' => [
          { 'id' => 1, 'tags' => [{'id' => 999}] },
          { 'id' => 2, 'tags' => [{'id' => 999}] }
        ]
      }

Links

@miq-bot assign @abellotti
@miq-bot add_label enhancement, api

@miq-bot
Copy link
Member

miq-bot commented Jan 31, 2017

Checked commit jntullo@6fa2e6e with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
2 files checked, 0 offenses detected
Everything looks good. ⭐

data['tags'].collect do |tag|
tags_unassign_resource(resource, type, tag['id'], tag)
end
rescue => err
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible that this could blow up while unassigning one of the tags, having already succeeded at some, and report a failure for all?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@imtayadeway I suppose anything is possible, although unlikely. I can add in a rescue block around the tags_unassign_resource

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose anything is possible, although unlikely

Yes, agreed 😄

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be done in a follow-up PR to handle exceptions for both assign_tags and unassign_tags (which have now parity implementation) and return the appropriate failed action_result for the individual tag and not the whole lot. Thanks.

Copy link
Contributor

@imtayadeway imtayadeway left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jntullo this LGTM with small nit above. Great work! 🎈

@abellotti
Copy link
Member

LGTM!! 👍

@abellotti abellotti merged commit 111cc5e into ManageIQ:master Feb 3, 2017
@abellotti abellotti added this to the Sprint 54 Ending Feb 13, 2017 milestone Feb 3, 2017
@jntullo jntullo deleted the enhancement/bulk_unassign_tags branch November 28, 2017 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants