Skip to content

Commit

Permalink
Remove some debug in ansible-galaxy upgrades, one of which raises err…
Browse files Browse the repository at this point in the history
…ors down some code paths.
  • Loading branch information
mpdehaan committed Aug 21, 2014
1 parent 56ce56f commit 2e95e21
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions bin/ansible-galaxy
Original file line number Diff line number Diff line change
Expand Up @@ -344,13 +344,14 @@ def scm_archive_role(scm, role_url, role_version, role_name):
clone_cmd = [scm, 'clone', role_url, role_name]
with open('/dev/null', 'w') as devnull:
try:
print "- executing: %s" % " ".join(clone_cmd)
popen = subprocess.Popen(clone_cmd, cwd=tempdir, stdout=devnull, stderr=devnull)
except:
raise AnsibleError("error executing: %s" % " ".join(clone_cmd))
rc = popen.wait()
if rc != 0:
print "Command %s failed" % ' '.join(clone_cmd)
print "in directory %s" % tempdir
print "- command %s failed" % ' '.join(clone_cmd)
print " in directory %s" % tempdir
return False

temp_file = tempfile.NamedTemporaryFile(delete=False, suffix='.tar')
Expand All @@ -367,12 +368,13 @@ def scm_archive_role(scm, role_url, role_version, role_name):
archive_cmd.append('HEAD')

with open('/dev/null', 'w') as devnull:
print "- executing: %s" % " ".join(archive_cmd)
popen = subprocess.Popen(archive_cmd, cwd=os.path.join(tempdir, role_name),
stderr=devnull, stdout=devnull)
rc = popen.wait()
if rc != 0:
print "Command %s failed" % ' '.join(archive_cmd)
print "in directory %s" % tempdir
print "- command %s failed" % ' '.join(archive_cmd)
print " in directory %s" % tempdir
return False

shutil.rmtree(tempdir)
Expand Down Expand Up @@ -495,8 +497,6 @@ def install_role(role_name, role_version, role_filename, options):
# the file is a tar, so open it that way and extract it
# to the specified (or default) roles directory

print "DEBUG: FN=%s" % role_filename

if not tarfile.is_tarfile(role_filename):
print "Error: the file downloaded was not a tar.gz"
return False
Expand Down Expand Up @@ -759,7 +759,6 @@ def execute_install(args, options, parser):
role["version"] = str(loose_versions[-1])
else:
role["version"] = 'master'
print " no version specified, installing %s" % role.version
else:
if role_versions and role["version"] not in [a.get('name',None) for a in role_versions]:
print "The specified version (%s) was not found in the list of available versions." % role.version
Expand Down

0 comments on commit 2e95e21

Please sign in to comment.