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
4f55bcc2
Commit
4f55bcc2
authored
Sep 04, 2014
by
Toshio Kuratomi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Standardize on bytes internally to _log_invocation
parent
7545e306
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
14 deletions
+21
-14
lib/ansible/module_utils/basic.py
+21
-14
No files found.
lib/ansible/module_utils/basic.py
View file @
4f55bcc2
...
@@ -991,10 +991,12 @@ class AnsibleModule(object):
...
@@ -991,10 +991,12 @@ class AnsibleModule(object):
else
:
else
:
found
=
False
found
=
False
for
filter
in
filter_re
:
for
filter
in
filter_re
:
if
isinstance
(
self
.
params
[
param
],
unicode
):
param_val
=
self
.
params
[
param
]
m
=
filter
.
match
(
self
.
params
[
param
])
if
not
isinstance
(
param_val
,
basestring
):
else
:
param_val
=
str
(
param_val
)
m
=
filter
.
match
(
str
(
self
.
params
[
param
]))
elif
isinstance
(
param_val
,
unicode
):
param_val
=
param_val
.
encode
(
'utf-8'
)
m
=
filter
.
match
(
param_val
)
if
m
:
if
m
:
d
=
m
.
groupdict
()
d
=
m
.
groupdict
()
log_args
[
param
]
=
d
[
'before'
]
+
"********"
+
d
[
'after'
]
log_args
[
param
]
=
d
[
'before'
]
+
"********"
+
d
[
'after'
]
...
@@ -1004,22 +1006,27 @@ class AnsibleModule(object):
...
@@ -1004,22 +1006,27 @@ class AnsibleModule(object):
log_args
[
param
]
=
self
.
params
[
param
]
log_args
[
param
]
=
self
.
params
[
param
]
module
=
'ansible-
%
s'
%
os
.
path
.
basename
(
__file__
)
module
=
'ansible-
%
s'
%
os
.
path
.
basename
(
__file__
)
msg
=
''
msg
=
[]
for
arg
in
log_args
:
for
arg
in
log_args
:
if
isinstance
(
log_args
[
arg
],
basestring
):
arg_val
=
log_args
[
arg
]
msg
=
msg
+
arg
+
'='
+
log_args
[
arg
]
.
decode
(
'utf-8'
)
+
' '
if
not
isinstance
(
arg_val
,
basestring
):
else
:
arg_val
=
str
(
arg_val
)
msg
=
msg
+
arg
+
'='
+
str
(
log_args
[
arg
])
+
' '
elif
isinstance
(
arg_val
,
unicode
):
arg_val
=
arg_val
.
encode
(
'utf-8'
)
msg
.
append
(
'
%
s=
%
s '
%
(
arg
,
arg_val
))
if
msg
:
if
msg
:
msg
=
'Invoked with
%
s'
%
msg
msg
=
'Invoked with
%
s'
%
''
.
join
(
msg
)
else
:
else
:
msg
=
'Invoked'
msg
=
'Invoked'
# 6655 - allow for accented characters
# 6655 - allow for accented characters
try
:
if
isinstance
(
msg
,
unicode
):
msg
=
msg
.
encode
(
'utf8'
)
# If we've done everything right up above msg should be type
except
UnicodeDecodeError
,
e
:
# str, not type unicode here. This is partial protection in case
pass
# we've done something wrong. But if we arrive here we can
# potentially get tracebacks in code up above (when mixing unicode
# and str together)
msg
=
msg
.
encode
(
'utf-8'
)
if
(
has_journal
):
if
(
has_journal
):
journal_args
=
[
"MESSAGE=
%
s
%
s"
%
(
module
,
msg
)]
journal_args
=
[
"MESSAGE=
%
s
%
s"
%
(
module
,
msg
)]
...
...
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