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
b19eb0f4
Commit
b19eb0f4
authored
Jul 25, 2015
by
Brian Coca
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor improvements to display
parent
0dc1cbd6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
8 deletions
+14
-8
lib/ansible/utils/display.py
+14
-8
No files found.
lib/ansible/utils/display.py
View file @
b19eb0f4
...
...
@@ -47,6 +47,7 @@ if C.DEFAULT_LOG_PATH:
else
:
logger
=
None
debug_lock
=
Lock
()
class
Display
:
...
...
@@ -62,7 +63,6 @@ class Display:
self
.
cowsay
=
None
self
.
noncow
=
os
.
getenv
(
"ANSIBLE_COW_SELECTION"
,
None
)
self
.
set_cowsay_info
()
#self.debug_lock = Lock()
def
set_cowsay_info
(
self
):
...
...
@@ -90,7 +90,7 @@ class Display:
# FIXME: this needs to be implemented
#msg = utils.sanitize_output(msg)
msg2
=
msg
msg2
=
self
.
_safe_output
(
msg
,
stderr
=
stderr
)
if
color
:
msg2
=
stringc
(
msg
,
color
)
...
...
@@ -98,8 +98,10 @@ class Display:
b_msg2
=
to_bytes
(
msg2
)
if
not
stderr
:
print
(
b_msg2
)
sys
.
stdout
.
flush
()
else
:
print
(
b_msg2
,
file
=
sys
.
stderr
)
sys
.
stderr
.
flush
()
if
logger
and
not
screen_only
:
while
msg
.
startswith
(
"
\n
"
):
...
...
@@ -127,11 +129,9 @@ class Display:
def
debug
(
self
,
msg
):
if
C
.
DEFAULT_DEBUG
:
# FIXME: enable when display is inherited to all
#self.debug_lock.acquire()
debug_lock
.
acquire
()
self
.
display
(
"
%6
d
%0.5
f:
%
s"
%
(
os
.
getpid
(),
time
.
time
(),
msg
),
color
=
'dark gray'
)
sys
.
stdout
.
flush
()
#self.debug_lock.release()
debug_lock
.
release
()
def
verbose
(
self
,
msg
,
host
=
None
,
caplevel
=
2
):
# FIXME: this needs to be implemented
...
...
@@ -223,9 +223,15 @@ class Display:
def
prompt
(
self
,
msg
):
if
sys
.
stdout
.
encoding
:
return
raw_input
(
self
.
_safe_output
(
msg
))
def
_safe_output
(
self
,
msg
,
stderr
=
False
):
if
not
stderr
and
sys
.
stdout
.
encoding
:
msg
=
to_bytes
(
msg
,
sys
.
stdout
.
encoding
)
elif
stderr
and
sys
.
stderr
.
encoding
:
msg
=
to_bytes
(
msg
,
sys
.
stderr
.
encoding
)
else
:
msg
=
to_bytes
(
msg
)
return
raw_input
(
msg
)
return
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