diff --git a/usr/lib/python3.8/spoc/container.py b/usr/lib/python3.8/spoc/container.py index 7a1b684..d63e1e8 100644 --- a/usr/lib/python3.8/spoc/container.py +++ b/usr/lib/python3.8/spoc/container.py @@ -73,7 +73,10 @@ class Container: def await_state(self, awaited_state): # Block execution until the container reaches the desired state or until timeout - subprocess.run(['lxc-wait', '-P', CONTAINERS_DIR, '-s', awaited_state.value, '-t', '30', self.name], check=True) + try: + subprocess.run(['lxc-wait', '-P', CONTAINERS_DIR, '-s', awaited_state.value, '-t', '30', self.name], check=True) + except subprocess.CalledProcessError: + raise InvalidContainerStateError(self.name, self.get_state()) def mount_rootfs(self): # Prepares container rootfs