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
7a1bce1b
Commit
7a1bce1b
authored
Jul 10, 2015
by
Brian Coca
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added verbose option to show callback loaded info
also made mail module print nicer without all those 'u'
parent
4b9a79d4
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
22 additions
and
5 deletions
+22
-5
lib/ansible/plugins/callback/__init__.py
+6
-1
lib/ansible/plugins/callback/context_demo.py
+1
-0
lib/ansible/plugins/callback/default.py
+1
-0
lib/ansible/plugins/callback/hipchat.py
+2
-1
lib/ansible/plugins/callback/log_plays.py
+1
-0
lib/ansible/plugins/callback/mail.py
+7
-3
lib/ansible/plugins/callback/minimal.py
+1
-0
lib/ansible/plugins/callback/osx_say.py
+1
-0
lib/ansible/plugins/callback/syslog_json.py
+1
-0
lib/ansible/plugins/callback/timer.py
+1
-0
No files found.
lib/ansible/plugins/callback/__init__.py
View file @
7a1bce1b
...
...
@@ -16,7 +16,7 @@
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
# Make coding more python3-ish
from
__future__
import
(
absolute_import
,
division
,
print_function
)
from
__future__
import
(
absolute_import
,
division
)
__metaclass__
=
type
__all__
=
[
"CallbackBase"
]
...
...
@@ -34,6 +34,11 @@ class CallbackBase:
def
__init__
(
self
,
display
):
self
.
_display
=
display
if
self
.
_display
.
verbosity
>=
4
:
name
=
getattr
(
self
,
'CALLBACK_NAME'
,
'with no defined name'
)
ctype
=
getattr
(
self
,
'CALLBACK_TYPE'
,
'unknwon'
)
version
=
getattr
(
self
,
'CALLBACK_VERSION'
,
'unknwon'
)
self
.
_display
.
vvvv
(
'Loaded callback
%
s of type
%
s, v
%
s'
%
(
name
,
ctype
,
version
))
def
set_connection_info
(
self
,
conn_info
):
pass
...
...
lib/ansible/plugins/callback/context_demo.py
View file @
7a1bce1b
...
...
@@ -24,6 +24,7 @@ class CallbackModule(CallbackBase):
"""
CALLBACK_VERSION
=
2.0
CALLBACK_TYPE
=
'aggregate'
CALLBACK_TYPE
=
'context_demo'
def
v2_on_any
(
self
,
*
args
,
**
kwargs
):
i
=
0
...
...
lib/ansible/plugins/callback/default.py
View file @
7a1bce1b
...
...
@@ -32,6 +32,7 @@ class CallbackModule(CallbackBase):
CALLBACK_VERSION
=
2.0
CALLBACK_TYPE
=
'stdout'
CALLBACK_NAME
=
'default'
def
v2_runner_on_failed
(
self
,
result
,
ignore_errors
=
False
):
if
'exception'
in
result
.
_result
:
...
...
lib/ansible/plugins/callback/hipchat.py
View file @
7a1bce1b
...
...
@@ -42,7 +42,8 @@ class CallbackModule(CallbackBase):
"""
CALLBACK_VERSION
=
2.0
CALLBACK_TYPE
=
'notification'
CALLBACK_VERSION
=
2.0
CALLBACK_NAME
=
'hipchat'
def
__init__
(
self
,
display
):
...
...
lib/ansible/plugins/callback/log_plays.py
View file @
7a1bce1b
...
...
@@ -34,6 +34,7 @@ class CallbackModule(CallbackBase):
"""
CALLBACK_VERSION
=
2.0
CALLBACK_TYPE
=
'notification'
CALLBACK_NAME
=
'log_plays'
TIME_FORMAT
=
"
%
b
%
d
%
Y
%
H:
%
M:
%
S"
MSG_FORMAT
=
"
%(now)
s -
%(category)
s -
%(data)
s
\n\n
"
...
...
lib/ansible/plugins/callback/mail.py
View file @
7a1bce1b
# -*- coding: utf-8 -*-
# Copyright 2012 Dag Wieers <dag@wieers.com>
#
# This file is part of Ansible
...
...
@@ -17,6 +18,7 @@
import
os
import
smtplib
import
json
from
ansible.plugins.callback
import
CallbackBase
def
mail
(
subject
=
'Ansible error mail'
,
sender
=
None
,
to
=
None
,
cc
=
None
,
bcc
=
None
,
body
=
None
,
smtphost
=
None
):
...
...
@@ -58,6 +60,7 @@ class CallbackModule(CallbackBase):
"""
CALLBACK_VERSION
=
2.0
CALLBACK_TYPE
=
'notification'
CALLBACK_NAME
=
'mail'
def
v2_runner_on_failed
(
self
,
res
,
ignore_errors
=
False
):
...
...
@@ -66,8 +69,9 @@ class CallbackModule(CallbackBase):
if
ignore_errors
:
return
sender
=
'"Ansible:
%
s" <root>'
%
host
subject
=
'Failed:
%
s'
%
(
res
.
_task
.
action
)
body
=
'The following task failed for host '
+
host
+
':
\n\n
%
s
\n\n
'
%
(
res
.
_task
.
action
)
attach
=
"
%
s:
%
s"
%
(
res
.
_result
[
'invocation'
][
'module_name'
],
json
.
dumps
(
res
.
_result
[
'invocation'
][
'module_args'
]))
subject
=
'Failed:
%
s'
%
attach
body
=
'The following task failed for host '
+
host
+
':
\n\n
%
s
\n\n
'
%
attach
if
'stdout'
in
res
.
_result
.
keys
()
and
res
.
_result
[
'stdout'
]:
subject
=
res
.
_result
[
'stdout'
]
.
strip
(
'
\r\n
'
)
.
split
(
'
\n
'
)[
-
1
]
...
...
@@ -78,7 +82,7 @@ class CallbackModule(CallbackBase):
if
'msg'
in
res
.
_result
.
keys
()
and
res
.
_result
[
'msg'
]:
subject
=
res
.
_result
[
'msg'
]
.
strip
(
'
\r\n
'
)
.
split
(
'
\n
'
)[
0
]
body
+=
'with the following message:
\n\n
'
+
res
.
_result
[
'msg'
]
+
'
\n\n
'
body
+=
'A complete dump of the error:
\n\n
'
+
str
(
res
.
_result
[
'msg'
]
)
body
+=
'A complete dump of the error:
\n\n
'
+
json
.
dumps
(
res
.
_result
,
indent
=
4
)
mail
(
sender
=
sender
,
subject
=
subject
,
body
=
body
)
def
v2_runner_on_unreachable
(
self
,
result
):
...
...
lib/ansible/plugins/callback/minimal.py
View file @
7a1bce1b
...
...
@@ -33,6 +33,7 @@ class CallbackModule(CallbackBase):
CALLBACK_VERSION
=
2.0
CALLBACK_TYPE
=
'stdout'
CALLBACK_NAME
=
'minimal'
def
v2_on_any
(
self
,
*
args
,
**
kwargs
):
pass
...
...
lib/ansible/plugins/callback/osx_say.py
View file @
7a1bce1b
...
...
@@ -33,6 +33,7 @@ class CallbackModule(CallbackBase):
"""
CALLBACK_VERSION
=
2.0
CALLBACK_TYPE
=
'notification'
CALLBACK_NAME
=
'osx_say'
def
__init__
(
self
,
display
):
...
...
lib/ansible/plugins/callback/syslog_json.py
View file @
7a1bce1b
...
...
@@ -21,6 +21,7 @@ class CallbackModule(CallbackBase):
"""
CALLBACK_VERSION
=
2.0
CALLBACK_TYPE
=
'aggregate'
CALLBACK_NAME
=
'syslog_json'
def
__init__
(
self
,
display
):
...
...
lib/ansible/plugins/callback/timer.py
View file @
7a1bce1b
...
...
@@ -10,6 +10,7 @@ class CallbackModule(CallbackBase):
"""
CALLBACK_VERSION
=
2.0
CALLBACK_TYPE
=
'aggregate'
CALLBACK_NAME
=
'timer'
start_time
=
datetime
.
now
()
...
...
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