|
|
@ -344,12 +344,13 @@ 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
|
|
|
|
|
|
|
|
|
|
|
@ -367,11 +368,12 @@ 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
|
|
|
|
|
|
|
|
|
|
|
@ -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
|
|
|
|