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
ebeaf785
Commit
ebeaf785
authored
Dec 19, 2013
by
James Tanner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Fixes #3973 live output for ansible-pull"
This reverts commit
3b2a35ae
.
parent
3b2a35ae
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
44 deletions
+2
-44
bin/ansible-pull
+2
-44
No files found.
bin/ansible-pull
View file @
ebeaf785
...
...
@@ -45,8 +45,6 @@ import sys
import
datetime
import
socket
from
ansible
import
utils
import
shlex
import
select
DEFAULT_REPO_TYPE
=
'git'
DEFAULT_PLAYBOOK
=
'local.yml'
...
...
@@ -54,38 +52,6 @@ PLAYBOOK_ERRORS = {1: 'File does not exist',
2
:
'File is not readable'
}
def
_run_verbose
(
cmd
):
cmdargs
=
shlex
.
split
(
cmd
)
p
=
subprocess
.
Popen
(
cmdargs
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
stdout
=
''
stderr
=
''
rpipes
=
[
p
.
stdout
,
p
.
stderr
]
while
True
:
rfd
,
wfd
,
efd
=
select
.
select
(
rpipes
,
[],
rpipes
,
1
)
if
p
.
stdout
in
rfd
:
dat
=
os
.
read
(
p
.
stdout
.
fileno
(),
100
)
sys
.
stdout
.
write
(
dat
)
stdout
+=
dat
if
dat
==
''
:
rpipes
.
remove
(
p
.
stdout
)
if
p
.
stderr
in
rfd
:
dat
=
os
.
read
(
p
.
stderr
.
fileno
(),
100
)
stderr
+=
dat
sys
.
stdout
.
write
(
dat
)
if
dat
==
''
:
rpipes
.
remove
(
p
.
stderr
)
# only break out if we've emptied the pipes, or there is nothing to
# read from and the process has finished.
if
(
not
rpipes
or
not
rfd
)
and
p
.
poll
()
is
not
None
:
break
# Calling wait while there are still pipes to read can cause a lock
elif
not
rpipes
and
p
.
poll
()
==
None
:
p
.
wait
()
return
p
.
returncode
,
stdout
def
_run
(
cmd
):
print
>>
sys
.
stderr
,
"Running: '
%
s'"
%
cmd
cmd
=
subprocess
.
Popen
(
cmd
,
shell
=
True
,
...
...
@@ -136,8 +102,6 @@ def main(args):
""" Set up and run a local playbook """
usage
=
"
%
prog [options] [playbook.yml]"
parser
=
utils
.
SortedOptParser
(
usage
=
usage
)
parser
.
add_option
(
'-v'
,
'--verbose'
,
default
=
False
,
action
=
'store_true'
,
help
=
'Print the ansible-playbook output while running'
)
parser
.
add_option
(
'--purge'
,
default
=
False
,
action
=
'store_true'
,
help
=
'purge checkout after playbook run'
)
parser
.
add_option
(
'-o'
,
'--only-if-changed'
,
dest
=
'ifchanged'
,
default
=
False
,
action
=
'store_true'
,
...
...
@@ -177,10 +141,7 @@ def main(args):
inv_opts
=
'localhost,'
limit_opts
=
'localhost:
%
s:127.0.0.1'
%
hostname
if
not
options
.
verbose
:
base_opts
=
'-c local --limit "
%
s"'
%
limit_opts
else
:
base_opts
=
'-vvvv -c local --limit "
%
s"'
%
limit_opts
base_opts
=
'-c local --limit "
%
s"'
%
limit_opts
repo_opts
=
"name=
%
s dest=
%
s"
%
(
options
.
url
,
options
.
dest
)
if
options
.
checkout
:
repo_opts
+=
' version=
%
s'
%
options
.
checkout
...
...
@@ -211,10 +172,7 @@ def main(args):
if
options
.
inventory
:
cmd
+=
' -i "
%
s"'
%
options
.
inventory
os
.
chdir
(
options
.
dest
)
if
not
options
.
verbose
:
rc
,
out
=
_run
(
cmd
)
else
:
rc
,
out
=
_run_verbose
(
cmd
)
rc
,
out
=
_run
(
cmd
)
if
options
.
purge
:
os
.
chdir
(
'/'
)
...
...
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