ansible/ansible — pull request #1074 by tbielawa (2012-09-22 06:54:51+00:00)
Title: Add 'pause' action plugin and support plugins skipping the host loop.

**Implementation Notes**

* The ``pause`` action plugin sets a class variable ``BYPASS_HOST_LOOP`` which is an indicator to ``runner.run()`` that the plugin requires special handling

* ``runner.run()`` exposes the current group of hosts to plugins which bypass the host loop by assigning the group to the instance variable ``self.host_set``. In the case of the ``pause`` plugin, this allows it to create a more useful prompt describing exactly which hosts are currently subject to the pause condition.

* To satisfy the parameters of the ``_executor()`` method we just pass it the first host in the current group of hosts.

* Once an action plugin has completed running, a ``ReturnData`` object is created (in the ``runner.Run()`` method) for all hosts in that set using the ``ResultData.results`` dictionary returned by the the plugin (which in reality only 'ran on' the first host in the group). Before I was creating the ``ReturnData`` objects by hand I found that ``Playbook`` would (rightfully) mark ``hosts[1:]`` as dark.

**Feedback Requests**

* In ``lib/ansible/runner/__init__.py`` (lines 358 and 395) the logic controlling when to call the ``self._make_tmp_path(conn)`` and ``self._delete_remote_files(conn, tmp)`` methods was modified to exclude all action plugins in addition to the **raw** module. I am not 100% certain if this is an issue, but you should be aware of it.

* Due to how it flushes the ``stdin`` buffer and reads keyboard events this module is absolutely **100% NOT** Windows compatible. IIRC, on IRC a while back you declared that Windows was not a targeted platform for support, is that still true? Also, before this is accepted into CORE it needs to be tested on Unicies which are **NOT** Linux as I am unsure of how portable the ``tty`` and ``termios`` libraries actually are.

* ``utils.py`` now has a ``getch()`` function, this introduced two additional imports, ``tty`` and ``termios``. Same concerns as above. If this is a problem we can make the ``getch()`` function local to the pause module and remove the imports from ``utils.py``.