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
49a14805
Commit
49a14805
authored
Jul 07, 2015
by
Toshio Kuratomi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure that we're dealing with byte str when we print or log messages
parent
6d50a261
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
10 deletions
+7
-10
lib/ansible/utils/display.py
+7
-10
No files found.
lib/ansible/utils/display.py
View file @
49a14805
...
...
@@ -28,6 +28,7 @@ import sys
from
ansible
import
constants
as
C
from
ansible.errors
import
AnsibleError
from
ansible.utils.color
import
stringc
from
ansible.utils.unicode
import
to_bytes
class
Display
:
...
...
@@ -70,25 +71,21 @@ class Display:
if
color
:
msg2
=
stringc
(
msg
,
color
)
if
not
log_only
:
b_msg2
=
to_bytes
(
msg2
)
if
not
stderr
:
try
:
print
(
msg2
)
except
UnicodeEncodeError
:
print
(
msg2
.
encode
(
'utf-8'
))
print
(
b_msg2
)
else
:
try
:
print
(
msg2
,
file
=
sys
.
stderr
)
except
UnicodeEncodeError
:
print
(
msg2
.
encode
(
'utf-8'
),
file
=
sys
.
stderr
)
print
(
b_msg2
,
file
=
sys
.
stderr
)
if
C
.
DEFAULT_LOG_PATH
!=
''
:
while
msg
.
startswith
(
"
\n
"
):
msg
=
msg
.
replace
(
"
\n
"
,
""
)
b_msg
=
to_bytes
(
msg
)
# FIXME: logger stuff needs to be implemented
#if not screen_only:
# if color == 'red':
# logger.error(msg)
# logger.error(
b_
msg)
# else:
# logger.info(msg)
# logger.info(
b_
msg)
def
vv
(
self
,
msg
,
host
=
None
):
return
self
.
verbose
(
msg
,
host
=
host
,
caplevel
=
1
)
...
...
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