summaryrefslogtreecommitdiff
path: root/lib/ansible/galaxy/role.py
diff options
context:
space:
mode:
authorLeigh Jenkin <ljenkin@redhat.com>2018-02-22 00:34:44 +1100
committerChris Houseknecht <chousekn@redhat.com>2018-02-21 08:34:44 -0500
commite22403958665ce210482676b029164619fb92d3d (patch)
treea64c8fd2e2e45e3df153491bd0726fe4e57f0d56 /lib/ansible/galaxy/role.py
parentf7d79d4789af827c7fabd21dac825a95a2b39516 (diff)
downloadansible-e22403958665ce210482676b029164619fb92d3d.tar.gz
Fixes #12353 #20977 adds new option to galaxy cli to preserve scm meta (#34642)
Diffstat (limited to 'lib/ansible/galaxy/role.py')
-rw-r--r--lib/ansible/galaxy/role.py9
1 files changed, 2 insertions, 7 deletions
diff --git a/lib/ansible/galaxy/role.py b/lib/ansible/galaxy/role.py
index dad7002404..c9d8ddd3eb 100644
--- a/lib/ansible/galaxy/role.py
+++ b/lib/ansible/galaxy/role.py
@@ -194,17 +194,12 @@ class GalaxyRole(object):
return False
def install(self):
- # the file is a tar, so open it that way and extract it
- # to the specified (or default) roles directory
- local_file = False
if self.scm:
# create tar file from scm url
- tmp_file = RoleRequirement.scm_archive_role(**self.spec)
+ tmp_file = RoleRequirement.scm_archive_role(keep_scm_meta=self.options.keep_scm_meta, **self.spec)
elif self.src:
if os.path.isfile(self.src):
- # installing a local tar.gz
- local_file = True
tmp_file = self.src
elif '://' in self.src:
role_data = self.src
@@ -337,7 +332,7 @@ class GalaxyRole(object):
# return the parsed yaml metadata
display.display("- %s was installed successfully" % str(self))
- if not local_file:
+ if not (self.src and os.path.isfile(self.src)):
try:
os.unlink(tmp_file)
except (OSError, IOError) as e: