From 7d14d488da5a28e82bc423eda1a30a0b89fea217 Mon Sep 17 00:00:00 2001 From: jpic Date: Sun, 26 Jan 2020 12:41:39 +0100 Subject: [PATCH] Refactor and fix umounts --- podctl/build.py | 7 ++----- podctl/visitors/commit.py | 1 - 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/podctl/build.py b/podctl/build.py index bf5beed..508cfb1 100644 --- a/podctl/build.py +++ b/podctl/build.py @@ -16,15 +16,14 @@ class BuildScript(Script): umounts() { for i in "${mounts[@]}"; do umount $i - echo $mounts mounts=("${mounts[@]/$i}") - echo $mounts done + buildah unmount $ctr + trap - 0 } trap umounts 0 ctr=$(buildah from $base) mnt=$(buildah mount $ctr) - mounts=("$mnt" "${mounts[@]}") ''') def config(self, line): @@ -49,5 +48,3 @@ class BuildScript(Script): self.run('sudo mkdir -p ' + dst) self.append('mkdir -p ' + src) self.append(f'mount -o bind {src} $mnt{dst}') - # for unmount trap - self.append('mounts=("$mnt%s" "${mounts[@]}")' % dst) diff --git a/podctl/visitors/commit.py b/podctl/visitors/commit.py index 54f86e9..e13ae12 100644 --- a/podctl/visitors/commit.py +++ b/podctl/visitors/commit.py @@ -40,7 +40,6 @@ class Commit: script.append(f''' umounts - trap - 0 buildah commit --format={self.format} $ctr {self.repo} ''')