Remove the whole module directory before updating
So that deleted/renamed files upstream are actually deleted. Also check that the proper module directory was created after extraction.
This commit is contained in:
parent
863a32b96e
commit
bcec326f35
1 changed files with 5 additions and 0 deletions
|
|
@ -516,8 +516,13 @@ class Repositories(object):
|
||||||
progress.progress(0.7, 'Setting up module...')
|
progress.progress(0.7, 'Setting up module...')
|
||||||
|
|
||||||
# Extract module from tarball.
|
# Extract module from tarball.
|
||||||
|
module_dir = os.path.join(self.modules_dir, info.name)
|
||||||
|
if os.path.isdir(module_dir):
|
||||||
|
shutil.rmtree(module_dir)
|
||||||
with closing(tarfile.open('', 'r:gz', fp)) as tar:
|
with closing(tarfile.open('', 'r:gz', fp)) as tar:
|
||||||
tar.extractall(self.modules_dir)
|
tar.extractall(self.modules_dir)
|
||||||
|
if not os.path.isdir(module_dir):
|
||||||
|
raise ModuleInstallError('The archive for %s looks invalid.' % info.name)
|
||||||
|
|
||||||
self.versions.set(info.name, info.version)
|
self.versions.set(info.name, info.version)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue