Merge branch 'madcow2' of git://github.com/bcoca/ansible into devel
This commit is contained in:
commit
c92bfb7234
1 changed files with 14 additions and 3 deletions
|
@ -20,7 +20,7 @@ import sys
|
||||||
import getpass
|
import getpass
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import os.path
|
import random
|
||||||
from ansible.color import stringc
|
from ansible.color import stringc
|
||||||
|
|
||||||
cowsay = None
|
cowsay = None
|
||||||
|
@ -37,6 +37,13 @@ elif os.path.exists("/opt/local/bin/cowsay"):
|
||||||
# MacPorts path for cowsay
|
# MacPorts path for cowsay
|
||||||
cowsay = "/opt/local/bin/cowsay"
|
cowsay = "/opt/local/bin/cowsay"
|
||||||
|
|
||||||
|
noncow = os.getenv("ANSIBLE_COW_SELECTION",None)
|
||||||
|
if cowsay and noncow == 'random':
|
||||||
|
cmd = subprocess.Popen([cowsay, "-l"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
|
(out, err) = cmd.communicate()
|
||||||
|
cows = out.split()
|
||||||
|
cows.append(False)
|
||||||
|
noncow = random.choice(cows)
|
||||||
|
|
||||||
# ****************************************************************************
|
# ****************************************************************************
|
||||||
# 1.1 DEV NOTES
|
# 1.1 DEV NOTES
|
||||||
|
@ -135,8 +142,12 @@ def regular_generic_msg(hostname, result, oneline, caption):
|
||||||
def banner(msg):
|
def banner(msg):
|
||||||
|
|
||||||
if cowsay:
|
if cowsay:
|
||||||
cmd = subprocess.Popen([cowsay, "-W", "60", msg],
|
runcmd = [cowsay,"-W", "60"]
|
||||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
if noncow:
|
||||||
|
runcmd.append('-f')
|
||||||
|
runcmd.append(noncow)
|
||||||
|
runcmd.append(msg)
|
||||||
|
cmd = subprocess.Popen(runcmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
(out, err) = cmd.communicate()
|
(out, err) = cmd.communicate()
|
||||||
return "%s\n" % out
|
return "%s\n" % out
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue