From 884f96013e821f76baa6efc7b553f68394e078d9 Mon Sep 17 00:00:00 2001 From: jpic Date: Sat, 15 Feb 2020 17:03:02 +0100 Subject: [PATCH] Buildah clean --- shlax/targets/buildah.py | 4 ++-- tests/test_proc.py | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/shlax/targets/buildah.py b/shlax/targets/buildah.py index 69c68ca..11b74fd 100644 --- a/shlax/targets/buildah.py +++ b/shlax/targets/buildah.py @@ -136,7 +136,7 @@ class Buildah(Localhost): cli.exit_code = await proc.wait() async def clean(self, *args, **kwargs): - if self.mnt: + if self.mnt is not None: await self.exec('buildah', 'umount', self.ctr, buildah=False) - if self.ctr: + if self.ctr is not None: await self.exec('buildah', 'rm', self.ctr, buildah=False) diff --git a/tests/test_proc.py b/tests/test_proc.py index 7ffe2ba..4276263 100644 --- a/tests/test_proc.py +++ b/tests/test_proc.py @@ -29,6 +29,7 @@ test_args_params = [ ('buildah', 'from', 'alpine'), ('buildah', 'mount', ''), ('buildah', 'run', '', '--', 'sh', '-euc', 'echo hi'), + ('buildah', 'umount', ''), ('buildah', 'rm', ''), ] ), @@ -38,6 +39,7 @@ test_args_params = [ ('buildah', 'from', 'alpine'), ('buildah', 'mount', ''), ('buildah', 'run', '--user', 'root', '', '--', 'sh', '-euc', 'echo hi'), + ('buildah', 'umount', ''), ('buildah', 'rm', ''), ] ), @@ -47,6 +49,7 @@ test_args_params = [ ('ssh', 'host', 'buildah', 'from', 'alpine'), ('ssh', 'host', 'buildah', 'mount', ''), ('ssh', 'host', 'buildah', 'run', '--user', 'root', '', '--', 'sh', '-euc', 'echo hi'), + ('ssh', 'host', 'buildah', 'umount', ''), ('ssh', 'host', 'buildah', 'rm', ''), ] ),