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
5531b843
Commit
5531b843
authored
Apr 04, 2015
by
Brian Coca
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
moved ad-hoc to use display
parent
af97e732
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
17 deletions
+16
-17
v2/bin/ansible
+16
-17
No files found.
v2/bin/ansible
View file @
5531b843
...
...
@@ -40,8 +40,12 @@ from ansible.vars import VariableManager
class
Cli
(
object
):
''' code behind bin/ansible '''
def
__init__
(
self
):
pass
def
__init__
(
self
,
display
=
None
):
if
display
is
None
:
self
.
display
=
Display
()
else
:
self
.
display
=
display
def
parse
(
self
):
''' create an options parser for bin/ansible '''
...
...
@@ -105,7 +109,7 @@ class Cli(object):
if
options
.
listhosts
:
for
host
in
hosts
:
print
(
'
%
s'
%
host
.
name
)
self
.
display
(
'
%
s'
%
host
.
name
)
sys
.
exit
(
0
)
if
((
options
.
module_name
==
'command'
or
options
.
module_name
==
'shell'
)
and
not
options
.
module_args
):
...
...
@@ -157,22 +161,17 @@ class Cli(object):
########################################################
if
__name__
==
'__main__'
:
#callbacks.display("", log_only=True)
#callbacks.display(" ".join(sys.argv), log_only=True
)
#
callbacks.display(""
, log_only=True)
display
=
Display
(
)
#
display.display(" ".join(sys.argv)
, log_only=True)
try
:
cli
=
Cli
()
cli
=
Cli
(
display
=
display
)
(
options
,
args
)
=
cli
.
parse
()
result
=
cli
.
run
(
options
,
args
)
except
AnsibleError
,
e
:
print
(
e
)
sys
.
exit
(
cli
.
run
(
options
,
args
))
except
AnsibleError
as
e
:
display
.
display
(
"[ERROR]:
%
s"
%
e
,
color
=
'red'
,
stderr
=
True
)
sys
.
exit
(
1
)
except
Exception
,
e
:
# Generic handler for errors
print
(
"ERROR:
%
s"
%
str
(
e
))
except
KeyboardInterrupt
:
display
.
display
(
"[ERROR]: interrupted"
,
color
=
'red'
,
stderr
=
True
)
sys
.
exit
(
1
)
sys
.
exit
(
result
)
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