From 2e1bbf098a094f2b94c5f64e004a47c5f4c45333 Mon Sep 17 00:00:00 2001 From: jpic Date: Sun, 31 May 2020 03:44:51 +0200 Subject: [PATCH] Pass status directly to clean --- shlax/targets/base.py | 3 +-- shlax/targets/buildah.py | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/shlax/targets/base.py b/shlax/targets/base.py index 6bc79a0..04f5306 100644 --- a/shlax/targets/base.py +++ b/shlax/targets/base.py @@ -66,13 +66,12 @@ class Target: self.output.success(action) result.status = 'success' finally: - action.result = result self.caller.results.append(result) clean = getattr(action, 'clean', None) if clean: self.output.clean(action) - await clean(self) + await clean(self, result) async def rexec(self, *args, **kwargs): kwargs['user'] = 'root' diff --git a/shlax/targets/buildah.py b/shlax/targets/buildah.py index d461bdd..bd1af09 100644 --- a/shlax/targets/buildah.py +++ b/shlax/targets/buildah.py @@ -139,7 +139,7 @@ class Buildah(Target): self.image_previous = action_image return stop - async def clean(self, target): + async def clean(self, target, result): for src, dst in self.mounts.items(): await self.parent.exec('umount', self.root / str(dst)[1:]) @@ -147,12 +147,12 @@ class Buildah(Target): await self.parent.exec('buildah', 'umount', self.ctr) if self.ctr is not None: - if self.result.status == 'success': + if result.status == 'success': await self.commit() await self.parent.exec('buildah', 'rm', self.ctr) - if self.result.status == 'success' and os.getenv('BUILDAH_PUSH'): + if result.status == 'success' and os.getenv('BUILDAH_PUSH'): await self.image.push(target) async def mount(self, src, dst):