Make --list-tasks work nicer with --tags

This commit is contained in:
Michael DeHaan 2013-04-22 23:24:54 -04:00
parent e12f91799c
commit 89ab3a0b9f

View file

@ -163,14 +163,13 @@ def main(args):
unmatched_tags.discard('all')
unknown_tags = set(pb.only_tags) - (matched_tags | unmatched_tags)
if unknown_tags:
msg = 'tag(s) not found in playbook: %s. possible values: %s'
unknown = ','.join(sorted(unknown_tags))
unmatched = ','.join(sorted(unmatched_tags))
raise errors.AnsibleError(msg % (unknown, unmatched))
continue
print ' play #%d (%s): task count=%d' % (playnum, label, len(play.tasks()))
for task in play.tasks():
if set(task.tags).intersection(pb.only_tags):
print ' %s' % task.name
if getattr(task, 'name', None) is not None:
# meta tasks have no names
print ' %s' % task.name
print ''
continue