summaryrefslogtreecommitdiffstats
path: root/bin/ansible-pull
diff options
context:
space:
mode:
authorJames Tanner <tanner.jc@gmail.com>2013-12-19 22:24:46 +0100
committerJames Tanner <tanner.jc@gmail.com>2013-12-19 22:24:46 +0100
commitebeaf785b596ea4925aa097bf8a30ac3303e82b9 (patch)
treea99642d0fa1194898d2dcdd6e2231ba8350ff06d /bin/ansible-pull
parentFixes #3973 live output for ansible-pull (diff)
downloadansible-ebeaf785b596ea4925aa097bf8a30ac3303e82b9.tar.xz
ansible-ebeaf785b596ea4925aa097bf8a30ac3303e82b9.zip
Revert "Fixes #3973 live output for ansible-pull"
This reverts commit 3b2a35ae004f4902eefe3aa12a1d2b746649e592.
Diffstat (limited to 'bin/ansible-pull')
-rwxr-xr-xbin/ansible-pull46
1 files changed, 2 insertions, 44 deletions
diff --git a/bin/ansible-pull b/bin/ansible-pull
index 95ff9852bf..78f4d216e3 100755
--- a/bin/ansible-pull
+++ b/bin/ansible-pull
@@ -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('/')