Commit 91c69b44 authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

LUDelTags: Improve formatting of error message



Use utils.CommaJoin to add spaces after comma, clean up code a bit.

Before: Tag(s) 'bar','baz','foo','moo' not found
After: Tag(s) 'bar', 'baz', 'foo', 'moo' not found
Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 60db9336
......@@ -9927,12 +9927,13 @@ class LUDelTags(TagsLU):
objects.TaggableObject.ValidateTag(tag)
del_tags = frozenset(self.op.tags)
cur_tags = self.target.GetTags()
if not del_tags <= cur_tags:
diff_tags = del_tags - cur_tags
diff_names = ["'%s'" % tag for tag in diff_tags]
diff_names.sort()
diff_tags = del_tags - cur_tags
if diff_tags:
diff_names = ("'%s'" % i for i in sorted(diff_tags))
raise errors.OpPrereqError("Tag(s) %s not found" %
(",".join(diff_names)), errors.ECODE_NOENT)
(utils.CommaJoin(diff_names), ),
errors.ECODE_NOENT)
def Exec(self, feedback_fn):
"""Remove the tag from the object.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment