Commit be2b2ac7 authored by Marco Mariani's avatar Marco Mariani

SlapObject: removed useless try..finally blocks

parent 3cc4ecb3
...@@ -131,12 +131,8 @@ class Software(object): ...@@ -131,12 +131,8 @@ class Software(object):
# Check if we can download from cache # Check if we can download from cache
if (not os.path.exists(self.software_path) if (not os.path.exists(self.software_path)
and self.download_binary_cache(tarpath)): and self.download_binary_cache(tarpath)):
tar = tarfile.open(tarpath)
try:
self.logger.info("Extracting archive of cached software release...") self.logger.info("Extracting archive of cached software release...")
tar.extractall(path=self.software_root) tarfile.open(tarpath).extractall(self.software_root)
finally:
tar.close()
else: else:
self._install_from_buildout() self._install_from_buildout()
self.update_binary_cache(tarpath) self.update_binary_cache(tarpath)
...@@ -241,9 +237,7 @@ class Software(object): ...@@ -241,9 +237,7 @@ class Software(object):
""" """
self.logger.info("Creating archive of software release...") self.logger.info("Creating archive of software release...")
tar = tarfile.open(tarpath, "w:gz") tar = tarfile.open(tarpath, "w:gz")
try:
tar.add(self.software_path, arcname=self.software_url_hash) tar.add(self.software_path, arcname=self.software_url_hash)
finally:
tar.close() tar.close()
self.logger.info("Trying to upload archive of software release...") self.logger.info("Trying to upload archive of software release...")
upload_network_cached( upload_network_cached(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment