Retain local tar.gz roles during galaxy install (#16592)
Don't treat local tar.gz files as temporary when cleaning up at the end of an ansible-galaxy install
This commit is contained in:
parent
1c2bc49025
commit
0e16a5f3ee
1 changed files with 7 additions and 4 deletions
|
@ -188,6 +188,7 @@ class GalaxyRole(object):
|
||||||
def install(self):
|
def install(self):
|
||||||
# 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
|
||||||
|
local_file = False
|
||||||
|
|
||||||
if self.scm:
|
if self.scm:
|
||||||
# create tar file from scm url
|
# create tar file from scm url
|
||||||
|
@ -195,6 +196,7 @@ class GalaxyRole(object):
|
||||||
elif self.src:
|
elif self.src:
|
||||||
if os.path.isfile(self.src):
|
if os.path.isfile(self.src):
|
||||||
# installing a local tar.gz
|
# installing a local tar.gz
|
||||||
|
local_file = True
|
||||||
tmp_file = self.src
|
tmp_file = self.src
|
||||||
elif '://' in self.src:
|
elif '://' in self.src:
|
||||||
role_data = self.src
|
role_data = self.src
|
||||||
|
@ -294,10 +296,11 @@ class GalaxyRole(object):
|
||||||
|
|
||||||
# return the parsed yaml metadata
|
# return the parsed yaml metadata
|
||||||
display.display("- %s was installed successfully" % self.name)
|
display.display("- %s was installed successfully" % self.name)
|
||||||
try:
|
if not local_file:
|
||||||
os.unlink(tmp_file)
|
try:
|
||||||
except (OSError,IOError) as e:
|
os.unlink(tmp_file)
|
||||||
display.warning("Unable to remove tmp file (%s): %s" % (tmp_file, str(e)))
|
except (OSError,IOError) as e:
|
||||||
|
display.warning("Unable to remove tmp file (%s): %s" % (tmp_file, str(e)))
|
||||||
return True
|
return True
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
Loading…
Reference in a new issue