1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Remove some debug in ansible-galaxy upgrades, one of which raises errors down some code paths.

This commit is contained in:
Michael DeHaan 2014-08-21 18:24:40 -04:00
parent 56ce56fdbe
commit 2e95e21cad

View file

@ -344,13 +344,14 @@ def scm_archive_role(scm, role_url, role_version, role_name):
clone_cmd = [scm, 'clone', role_url, role_name] clone_cmd = [scm, 'clone', role_url, role_name]
with open('/dev/null', 'w') as devnull: with open('/dev/null', 'w') as devnull:
try: try:
print "- executing: %s" % " ".join(clone_cmd)
popen = subprocess.Popen(clone_cmd, cwd=tempdir, stdout=devnull, stderr=devnull) popen = subprocess.Popen(clone_cmd, cwd=tempdir, stdout=devnull, stderr=devnull)
except: except:
raise AnsibleError("error executing: %s" % " ".join(clone_cmd)) raise AnsibleError("error executing: %s" % " ".join(clone_cmd))
rc = popen.wait() rc = popen.wait()
if rc != 0: if rc != 0:
print "Command %s failed" % ' '.join(clone_cmd) print "- command %s failed" % ' '.join(clone_cmd)
print "in directory %s" % tempdir print " in directory %s" % tempdir
return False return False
temp_file = tempfile.NamedTemporaryFile(delete=False, suffix='.tar') temp_file = tempfile.NamedTemporaryFile(delete=False, suffix='.tar')
@ -367,12 +368,13 @@ def scm_archive_role(scm, role_url, role_version, role_name):
archive_cmd.append('HEAD') archive_cmd.append('HEAD')
with open('/dev/null', 'w') as devnull: 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), popen = subprocess.Popen(archive_cmd, cwd=os.path.join(tempdir, role_name),
stderr=devnull, stdout=devnull) stderr=devnull, stdout=devnull)
rc = popen.wait() rc = popen.wait()
if rc != 0: if rc != 0:
print "Command %s failed" % ' '.join(archive_cmd) print "- command %s failed" % ' '.join(archive_cmd)
print "in directory %s" % tempdir print " in directory %s" % tempdir
return False return False
shutil.rmtree(tempdir) shutil.rmtree(tempdir)
@ -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 # the file is a tar, so open it that way and extract it
# to the specified (or default) roles directory # to the specified (or default) roles directory
print "DEBUG: FN=%s" % role_filename
if not tarfile.is_tarfile(role_filename): if not tarfile.is_tarfile(role_filename):
print "Error: the file downloaded was not a tar.gz" print "Error: the file downloaded was not a tar.gz"
return False return False
@ -759,7 +759,6 @@ def execute_install(args, options, parser):
role["version"] = str(loose_versions[-1]) role["version"] = str(loose_versions[-1])
else: else:
role["version"] = 'master' role["version"] = 'master'
print " no version specified, installing %s" % role.version
else: else:
if role_versions and role["version"] not in [a.get('name',None) for a in role_versions]: 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 print "The specified version (%s) was not found in the list of available versions." % role.version