ansible/ansible — pull request #9484 by gplasky (2014-11-05 01:09:22+00:00)
Title: Fix for --list-tasks with multiple tags and plays

This is a cosmetic fix for the following scenario:

* Playbook with multiple plays
* Multiple tags passed to either `--skip-tags` or `--tags`
* `--list-tasks` passed to ansible-playbook

Previously the loop which iterated over plays in "no-op" mode (`--list-tasks`, `--list-hosts`, or `--syntax`) would return an empty set of tasks when the above conditions were met. The logic was constructed to break out of the loop when an "unknown" tag is encountered. Breaking out here is inappropriate considering this scope doesn't cover all playbook tags and only sees those inside the current play.

I've elected to duplicate the logic from the main playbook library to throw an error at the user when an unknown tag is encountered. Since `ansible-playbook` catches this under a normal playbook run, the unknown tag logic could be removed in these no-op modes, but my thinking is that it would be nice to catch in check mode vs a live run.

I've ran this change through the full battery of unit and integration tests without any issues. I've also constructed a few sample playbooks to test the fix and it works as expected (would be happy to provide output if desired).