From 30254eb52767419586e270efba104340c33c13d5 Mon Sep 17 00:00:00 2001 From: Disassembler Date: Tue, 2 Oct 2018 17:38:58 +0200 Subject: [PATCH] better lxc-pack unlinking --- zz-extra/lxc-pack | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/zz-extra/lxc-pack b/zz-extra/lxc-pack index 8fd8ce5..21c6a43 100755 --- a/zz-extra/lxc-pack +++ b/zz-extra/lxc-pack @@ -31,11 +31,10 @@ def pack(pkg_file): xz_path = '{}.xz'.format(tar_path) # Remove old package - try: + if os.path.exists(tar_path): os.unlink(tar_path) + if os.path.exists(xz_path): os.unlink(xz_path) - except: - pass # Create archive print('Archiving', meta['lxcpath']) @@ -51,11 +50,9 @@ def pack(pkg_file): print('Registering package') packages = {} packages_file = os.path.join(BUILD_ROOT, 'packages') - try: + if os.path.exists(packages_file): with open(packages_file, 'r') as fd: packages = json.load(fd) - except: - pass packages[pkg_name] = meta with open(packages_file, 'w') as fd: json.dump(packages, fd, sort_keys=True, indent=4)