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
51e014d9
Commit
51e014d9
authored
Jul 03, 2014
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8012 from cchurch/callback_cleanup
Callback plugin cleanup
parents
1a3a3af0
afbc7f8a
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
12 additions
and
48 deletions
+12
-48
lib/ansible/callback_plugins/noop.py
+1
-4
lib/ansible/callbacks.py
+3
-22
lib/ansible/playbook/__init__.py
+3
-2
plugins/callbacks/hipchat.py
+2
-5
plugins/callbacks/log_plays.py
+1
-4
plugins/callbacks/mail.py
+0
-6
plugins/callbacks/osx_say.py
+2
-5
No files found.
lib/ansible/callback_plugins/noop.py
View file @
51e014d9
...
@@ -41,9 +41,6 @@ class CallbackModule(object):
...
@@ -41,9 +41,6 @@ class CallbackModule(object):
def
runner_on_ok
(
self
,
host
,
res
):
def
runner_on_ok
(
self
,
host
,
res
):
pass
pass
def
runner_on_error
(
self
,
host
,
msg
):
pass
def
runner_on_skipped
(
self
,
host
,
item
=
None
):
def
runner_on_skipped
(
self
,
host
,
item
=
None
):
pass
pass
...
@@ -89,7 +86,7 @@ class CallbackModule(object):
...
@@ -89,7 +86,7 @@ class CallbackModule(object):
def
playbook_on_not_import_for_host
(
self
,
host
,
missing_file
):
def
playbook_on_not_import_for_host
(
self
,
host
,
missing_file
):
pass
pass
def
playbook_on_play_start
(
self
,
pattern
):
def
playbook_on_play_start
(
self
,
name
):
pass
pass
def
playbook_on_stats
(
self
,
stats
):
def
playbook_on_stats
(
self
,
stats
):
...
...
lib/ansible/callbacks.py
View file @
51e014d9
...
@@ -343,9 +343,6 @@ class DefaultRunnerCallbacks(object):
...
@@ -343,9 +343,6 @@ class DefaultRunnerCallbacks(object):
def
on_ok
(
self
,
host
,
res
):
def
on_ok
(
self
,
host
,
res
):
call_callback_module
(
'runner_on_ok'
,
host
,
res
)
call_callback_module
(
'runner_on_ok'
,
host
,
res
)
def
on_error
(
self
,
host
,
msg
):
call_callback_module
(
'runner_on_error'
,
host
,
msg
)
def
on_skipped
(
self
,
host
,
item
=
None
):
def
on_skipped
(
self
,
host
,
item
=
None
):
call_callback_module
(
'runner_on_skipped'
,
host
,
item
=
item
)
call_callback_module
(
'runner_on_skipped'
,
host
,
item
=
item
)
...
@@ -404,10 +401,6 @@ class CliRunnerCallbacks(DefaultRunnerCallbacks):
...
@@ -404,10 +401,6 @@ class CliRunnerCallbacks(DefaultRunnerCallbacks):
display
(
"
%
s | skipped"
%
(
host
),
runner
=
self
.
runner
)
display
(
"
%
s | skipped"
%
(
host
),
runner
=
self
.
runner
)
super
(
CliRunnerCallbacks
,
self
)
.
on_skipped
(
host
,
item
)
super
(
CliRunnerCallbacks
,
self
)
.
on_skipped
(
host
,
item
)
def
on_error
(
self
,
host
,
err
):
display
(
"err: [
%
s] =>
%
s
\n
"
%
(
host
,
err
),
stderr
=
True
,
runner
=
self
.
runner
)
super
(
CliRunnerCallbacks
,
self
)
.
on_error
(
host
,
err
)
def
on_no_hosts
(
self
):
def
on_no_hosts
(
self
):
display
(
"no hosts matched
\n
"
,
stderr
=
True
,
runner
=
self
.
runner
)
display
(
"no hosts matched
\n
"
,
stderr
=
True
,
runner
=
self
.
runner
)
super
(
CliRunnerCallbacks
,
self
)
.
on_no_hosts
()
super
(
CliRunnerCallbacks
,
self
)
.
on_no_hosts
()
...
@@ -534,18 +527,6 @@ class PlaybookRunnerCallbacks(DefaultRunnerCallbacks):
...
@@ -534,18 +527,6 @@ class PlaybookRunnerCallbacks(DefaultRunnerCallbacks):
display
(
msg
,
color
=
'yellow'
,
runner
=
self
.
runner
)
display
(
msg
,
color
=
'yellow'
,
runner
=
self
.
runner
)
super
(
PlaybookRunnerCallbacks
,
self
)
.
on_ok
(
host
,
host_result
)
super
(
PlaybookRunnerCallbacks
,
self
)
.
on_ok
(
host
,
host_result
)
def
on_error
(
self
,
host
,
err
):
item
=
err
.
get
(
'item'
,
None
)
msg
=
''
if
item
:
msg
=
"err: [
%
s] => (item=
%
s) =>
%
s"
%
(
host
,
item
,
err
)
else
:
msg
=
"err: [
%
s] =>
%
s"
%
(
host
,
err
)
display
(
msg
,
color
=
'red'
,
stderr
=
True
,
runner
=
self
.
runner
)
super
(
PlaybookRunnerCallbacks
,
self
)
.
on_error
(
host
,
err
)
def
on_skipped
(
self
,
host
,
item
=
None
):
def
on_skipped
(
self
,
host
,
item
=
None
):
if
constants
.
DISPLAY_SKIPPED_HOSTS
:
if
constants
.
DISPLAY_SKIPPED_HOSTS
:
msg
=
''
msg
=
''
...
@@ -695,9 +676,9 @@ class PlaybookCallbacks(object):
...
@@ -695,9 +676,9 @@ class PlaybookCallbacks(object):
display
(
msg
,
color
=
'cyan'
)
display
(
msg
,
color
=
'cyan'
)
call_callback_module
(
'playbook_on_not_import_for_host'
,
host
,
missing_file
)
call_callback_module
(
'playbook_on_not_import_for_host'
,
host
,
missing_file
)
def
on_play_start
(
self
,
pattern
):
def
on_play_start
(
self
,
name
):
display
(
banner
(
"PLAY [
%
s]"
%
pattern
))
display
(
banner
(
"PLAY [
%
s]"
%
name
))
call_callback_module
(
'playbook_on_play_start'
,
pattern
)
call_callback_module
(
'playbook_on_play_start'
,
name
)
def
on_stats
(
self
,
stats
):
def
on_stats
(
self
,
stats
):
call_callback_module
(
'playbook_on_stats'
,
stats
)
call_callback_module
(
'playbook_on_stats'
,
stats
)
...
...
lib/ansible/playbook/__init__.py
View file @
51e014d9
...
@@ -322,8 +322,9 @@ class PlayBook(object):
...
@@ -322,8 +322,9 @@ class PlayBook(object):
ansible
.
callbacks
.
set_play
(
self
.
runner_callbacks
,
play
)
ansible
.
callbacks
.
set_play
(
self
.
runner_callbacks
,
play
)
if
not
self
.
_run_play
(
play
):
if
not
self
.
_run_play
(
play
):
break
break
ansible
.
callbacks
.
set_play
(
self
.
callbacks
,
None
)
ansible
.
callbacks
.
set_play
(
self
.
runner_callbacks
,
None
)
ansible
.
callbacks
.
set_play
(
self
.
callbacks
,
None
)
ansible
.
callbacks
.
set_play
(
self
.
runner_callbacks
,
None
)
# summarize the results
# summarize the results
results
=
{}
results
=
{}
...
...
plugins/callbacks/hipchat.py
View file @
51e014d9
...
@@ -91,9 +91,6 @@ class CallbackModule(object):
...
@@ -91,9 +91,6 @@ class CallbackModule(object):
def
runner_on_ok
(
self
,
host
,
res
):
def
runner_on_ok
(
self
,
host
,
res
):
pass
pass
def
runner_on_error
(
self
,
host
,
msg
):
pass
def
runner_on_skipped
(
self
,
host
,
item
=
None
):
def
runner_on_skipped
(
self
,
host
,
item
=
None
):
pass
pass
...
@@ -141,7 +138,7 @@ class CallbackModule(object):
...
@@ -141,7 +138,7 @@ class CallbackModule(object):
def
playbook_on_not_import_for_host
(
self
,
host
,
missing_file
):
def
playbook_on_not_import_for_host
(
self
,
host
,
missing_file
):
pass
pass
def
playbook_on_play_start
(
self
,
pattern
):
def
playbook_on_play_start
(
self
,
name
):
"""Display Playbook and play start messages"""
"""Display Playbook and play start messages"""
# This block sends information about a playbook when it starts
# This block sends information about a playbook when it starts
...
@@ -170,7 +167,7 @@ class CallbackModule(object):
...
@@ -170,7 +167,7 @@ class CallbackModule(object):
# This is where we actually say we are starting a play
# This is where we actually say we are starting a play
self
.
send_msg
(
"
%
s: Starting play:
%
s"
%
self
.
send_msg
(
"
%
s: Starting play:
%
s"
%
(
self
.
playbook_name
,
pattern
))
(
self
.
playbook_name
,
name
))
def
playbook_on_stats
(
self
,
stats
):
def
playbook_on_stats
(
self
,
stats
):
"""Display info about playbook statistics"""
"""Display info about playbook statistics"""
...
...
plugins/callbacks/log_plays.py
View file @
51e014d9
...
@@ -63,9 +63,6 @@ class CallbackModule(object):
...
@@ -63,9 +63,6 @@ class CallbackModule(object):
def
runner_on_ok
(
self
,
host
,
res
):
def
runner_on_ok
(
self
,
host
,
res
):
log
(
host
,
'OK'
,
res
)
log
(
host
,
'OK'
,
res
)
def
runner_on_error
(
self
,
host
,
msg
):
log
(
host
,
'ERROR'
,
msg
)
def
runner_on_skipped
(
self
,
host
,
item
=
None
):
def
runner_on_skipped
(
self
,
host
,
item
=
None
):
log
(
host
,
'SKIPPED'
,
'...'
)
log
(
host
,
'SKIPPED'
,
'...'
)
...
@@ -111,7 +108,7 @@ class CallbackModule(object):
...
@@ -111,7 +108,7 @@ class CallbackModule(object):
def
playbook_on_not_import_for_host
(
self
,
host
,
missing_file
):
def
playbook_on_not_import_for_host
(
self
,
host
,
missing_file
):
log
(
host
,
'NOTIMPORTED'
,
missing_file
)
log
(
host
,
'NOTIMPORTED'
,
missing_file
)
def
playbook_on_play_start
(
self
,
pattern
):
def
playbook_on_play_start
(
self
,
name
):
pass
pass
def
playbook_on_stats
(
self
,
stats
):
def
playbook_on_stats
(
self
,
stats
):
...
...
plugins/callbacks/mail.py
View file @
51e014d9
...
@@ -66,12 +66,6 @@ class CallbackModule(object):
...
@@ -66,12 +66,6 @@ class CallbackModule(object):
body
+=
'A complete dump of the error:
\n\n
'
+
str
(
res
)
body
+=
'A complete dump of the error:
\n\n
'
+
str
(
res
)
mail
(
sender
=
sender
,
subject
=
subject
,
body
=
body
)
mail
(
sender
=
sender
,
subject
=
subject
,
body
=
body
)
def
runner_on_error
(
self
,
host
,
msg
):
sender
=
'"Ansible:
%
s" <root>'
%
host
subject
=
'Error:
%
s'
%
msg
.
strip
(
'
\r\n
'
)
.
split
(
'
\n
'
)[
0
]
body
=
'An error occured for host '
+
host
+
' with the following message:
\n\n
'
+
msg
mail
(
sender
=
sender
,
subject
=
subject
,
body
=
body
)
def
runner_on_unreachable
(
self
,
host
,
res
):
def
runner_on_unreachable
(
self
,
host
,
res
):
sender
=
'"Ansible:
%
s" <root>'
%
host
sender
=
'"Ansible:
%
s" <root>'
%
host
if
isinstance
(
res
,
basestring
):
if
isinstance
(
res
,
basestring
):
...
...
plugins/callbacks/osx_say.py
View file @
51e014d9
...
@@ -49,9 +49,6 @@ class CallbackModule(object):
...
@@ -49,9 +49,6 @@ class CallbackModule(object):
def
runner_on_ok
(
self
,
host
,
res
):
def
runner_on_ok
(
self
,
host
,
res
):
say
(
"pew"
,
LASER_VOICE
)
say
(
"pew"
,
LASER_VOICE
)
def
runner_on_error
(
self
,
host
,
msg
):
pass
def
runner_on_skipped
(
self
,
host
,
item
=
None
):
def
runner_on_skipped
(
self
,
host
,
item
=
None
):
say
(
"pew"
,
LASER_VOICE
)
say
(
"pew"
,
LASER_VOICE
)
...
@@ -100,8 +97,8 @@ class CallbackModule(object):
...
@@ -100,8 +97,8 @@ class CallbackModule(object):
def
playbook_on_not_import_for_host
(
self
,
host
,
missing_file
):
def
playbook_on_not_import_for_host
(
self
,
host
,
missing_file
):
pass
pass
def
playbook_on_play_start
(
self
,
pattern
):
def
playbook_on_play_start
(
self
,
name
):
say
(
"Starting play:
%
s"
%
pattern
,
HAPPY_VOICE
)
say
(
"Starting play:
%
s"
%
name
,
HAPPY_VOICE
)
def
playbook_on_stats
(
self
,
stats
):
def
playbook_on_stats
(
self
,
stats
):
say
(
"Play complete"
,
HAPPY_VOICE
)
say
(
"Play complete"
,
HAPPY_VOICE
)
...
...
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