Pass status directly to clean

This commit is contained in:
jpic 2020-05-31 03:44:51 +02:00
parent 9c3790e438
commit 1660acbcbb
2 changed files with 4 additions and 5 deletions

View File

@ -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'

View File

@ -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):