1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Make it possible to say:

tags: 42

And have the tag be a string, not an int, so --tags matches.

Fixes #4110
This commit is contained in:
Michael DeHaan 2013-10-07 15:18:51 -04:00
parent c5672cf16e
commit 5e30cd999c

View file

@ -215,7 +215,9 @@ class Task(object):
self.module_args = tokens[1] self.module_args = tokens[1]
import_tags = self.module_vars.get('tags',[]) import_tags = self.module_vars.get('tags',[])
if type(import_tags) in [str,unicode]: if type(import_tags) in [int,float]:
import_tags = str(import_tags)
elif type(import_tags) in [str,unicode]:
# allow the user to list comma delimited tags # allow the user to list comma delimited tags
import_tags = import_tags.split(",") import_tags = import_tags.split(",")
@ -247,6 +249,8 @@ class Task(object):
if apply_tags is not None: if apply_tags is not None:
if type(apply_tags) in [ str, unicode ]: if type(apply_tags) in [ str, unicode ]:
self.tags.append(apply_tags) self.tags.append(apply_tags)
elif type(apply_tags) in [ int, float ]:
self.tags.append(str(apply_tags))
elif type(apply_tags) == list: elif type(apply_tags) == list:
self.tags.extend(apply_tags) self.tags.extend(apply_tags)
self.tags.extend(import_tags) self.tags.extend(import_tags)