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
1aa41552
Commit
1aa41552
authored
Jul 17, 2015
by
Brian Coca
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
generalized warning handling, added it to adhoc also
parent
d4ac73a1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
5 deletions
+10
-5
lib/ansible/plugins/callback/__init__.py
+8
-0
lib/ansible/plugins/callback/default.py
+1
-5
lib/ansible/plugins/callback/minimal.py
+1
-0
No files found.
lib/ansible/plugins/callback/__init__.py
View file @
1aa41552
...
...
@@ -21,6 +21,8 @@ __metaclass__ = type
import
json
from
ansible
import
constants
as
C
__all__
=
[
"CallbackBase"
]
...
...
@@ -46,6 +48,12 @@ class CallbackBase:
def
_dump_results
(
self
,
result
,
indent
=
4
,
sort_keys
=
True
):
return
json
.
dumps
(
result
,
indent
=
indent
,
ensure_ascii
=
False
,
sort_keys
=
sort_keys
)
def
_handle_warnings
(
self
,
res
):
''' display warnings, if enabled and any exist in the result '''
if
C
.
COMMAND_WARNINGS
and
'warnings'
in
res
and
res
[
'warnings'
]:
for
warning
in
res
[
'warnings'
]:
self
.
_display
.
warning
(
warning
)
def
set_connection_info
(
self
,
conn_info
):
pass
...
...
lib/ansible/plugins/callback/default.py
View file @
1aa41552
...
...
@@ -19,7 +19,6 @@
from
__future__
import
(
absolute_import
,
division
,
print_function
)
__metaclass__
=
type
from
ansible
import
constants
as
C
from
ansible.plugins.callback
import
CallbackBase
class
CallbackModule
(
CallbackBase
):
...
...
@@ -72,10 +71,7 @@ class CallbackModule(CallbackBase):
msg
+=
" =>
%
s"
%
self
.
_dump_results
(
result
.
_result
,
indent
=
indent
)
self
.
_display
.
display
(
msg
,
color
=
color
)
# display warnings, if enabled and any exist in the result
if
C
.
COMMAND_WARNINGS
and
'warnings'
in
result
.
_result
and
result
.
_result
[
'warnings'
]:
for
warning
in
result
.
_result
[
'warnings'
]:
self
.
_display
.
display
(
"warning:
%
s"
%
warning
,
color
=
'purple'
)
self
.
_handle_warnings
(
result
.
_result
)
def
v2_runner_on_skipped
(
self
,
result
):
msg
=
"skipping: [
%
s]"
%
result
.
_host
.
get_name
()
...
...
lib/ansible/plugins/callback/minimal.py
View file @
1aa41552
...
...
@@ -51,6 +51,7 @@ class CallbackModule(CallbackBase):
def
v2_runner_on_ok
(
self
,
result
):
self
.
_display
.
display
(
"
%
s | SUCCESS =>
%
s"
%
(
result
.
_host
.
get_name
(),
self
.
_dump_results
(
result
.
_result
)),
color
=
'green'
)
self
.
_handle_warnings
(
result
.
_result
)
def
v2_runner_on_skipped
(
self
,
result
):
self
.
_display
.
display
(
"
%
s | SKIPPED"
%
(
result
.
_host
.
get_name
()),
color
=
'cyan'
)
...
...
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