1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-06-29 23:49:09 +00:00

Merge pull request #3827 from mscherer/disable_callbacks

add a way for callback to disable itself
This commit is contained in:
Michael DeHaan 2013-10-12 07:03:06 -07:00
commit 43df00550d
6 changed files with 112 additions and 2 deletions

View file

@ -17,19 +17,28 @@
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
import subprocess
import os
FAILED_VOICE="Zarvox"
REGULAR_VOICE="Trinoids"
HAPPY_VOICE="Cellos"
LASER_VOICE="Princess"
SAY_CMD="/usr/bin/say"
def say(msg, voice):
subprocess.call(["/usr/bin/say", msg, "--voice=%s" % (voice)])
subprocess.call([SAY_CMD, msg, "--voice=%s" % (voice)])
class CallbackModule(object):
"""
makes Ansible much more exciting on OS X.
"""
def __init__(self):
# plugin disable itself if say is not present
# ansible will not call any callback if disabled is set to True
if not os.path.exists(SAY_CMD):
self.disabled = True
print "%s does not exist, plugin %s disabled" % \
(SAY_CMD, os.path.basename(__file__))
def on_any(self, *args, **kwargs):
pass