Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
4840e59b
Commit
4840e59b
authored
Jun 01, 2013
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow cowsay to be removed mid playbook run.
parent
754d5f91
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
19 deletions
+29
-19
lib/ansible/callbacks.py
+29
-19
No files found.
lib/ansible/callbacks.py
View file @
4840e59b
...
@@ -204,27 +204,37 @@ def regular_generic_msg(hostname, result, oneline, caption):
...
@@ -204,27 +204,37 @@ def regular_generic_msg(hostname, result, oneline, caption):
return
"
%
s |
%
s >>
%
s
\n
"
%
(
hostname
,
caption
,
utils
.
jsonify
(
result
))
return
"
%
s |
%
s >>
%
s
\n
"
%
(
hostname
,
caption
,
utils
.
jsonify
(
result
))
def
banner
(
msg
):
def
banner_cowsay
(
msg
):
if
msg
.
find
(
": ["
)
!=
-
1
:
msg
=
msg
.
replace
(
"["
,
""
)
if
msg
.
endswith
(
"]"
):
msg
=
msg
[:
-
1
]
runcmd
=
[
cowsay
,
"-W"
,
"60"
]
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
()
return
"
%
s
\n
"
%
out
def
banner_normal
(
msg
):
width
=
78
-
len
(
msg
)
if
width
<
3
:
width
=
3
filler
=
"*"
*
width
return
"
\n
%
s
%
s "
%
(
msg
,
filler
)
def
banner
(
msg
):
if
cowsay
:
if
cowsay
:
if
msg
.
find
(
": ["
)
!=
-
1
:
try
:
msg
=
msg
.
replace
(
"["
,
""
)
return
banner_cowsay
(
msg
)
if
msg
.
endswith
(
"]"
):
except
OSError
:
msg
=
msg
[:
-
1
]
# somebody cleverly deleted cowsay or something during the PB run. heh.
runcmd
=
[
cowsay
,
"-W"
,
"60"
]
return
banner_normal
(
msg
)
if
noncow
:
return
banner_normal
(
msg
)
runcmd
.
append
(
'-f'
)
runcmd
.
append
(
noncow
)
runcmd
.
append
(
msg
)
cmd
=
subprocess
.
Popen
(
runcmd
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
(
out
,
err
)
=
cmd
.
communicate
()
return
"
%
s
\n
"
%
out
else
:
width
=
78
-
len
(
msg
)
if
width
<
3
:
width
=
3
filler
=
"*"
*
width
return
"
\n
%
s
%
s "
%
(
msg
,
filler
)
def
command_generic_msg
(
hostname
,
result
,
oneline
,
caption
):
def
command_generic_msg
(
hostname
,
result
,
oneline
,
caption
):
''' output the result of a command run '''
''' output the result of a command run '''
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment