From 8c22df2e71de329a286e75af9bff69e82876db35 Mon Sep 17 00:00:00 2001 From: Disassembler Date: Sat, 9 Jan 2021 18:04:54 +0100 Subject: [PATCH] Make lxc-wait check more resilient --- usr/lib/python3.8/spoc/container.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/usr/lib/python3.8/spoc/container.py b/usr/lib/python3.8/spoc/container.py index 6bf1b6a..86215b1 100644 --- a/usr/lib/python3.8/spoc/container.py +++ b/usr/lib/python3.8/spoc/container.py @@ -85,7 +85,10 @@ class Container: try: subprocess.run(['lxc-wait', '-P', config.CONTAINERS_DIR, '-s', awaited_state.value, '-t', '30', self.name], check=True) except subprocess.CalledProcessError: - raise InvalidContainerStateError(self.name, self.get_state()) + # Sometimes LXC decides to return rc 1 even on successful state change + actual_state = self.get_state() + if actual_state != awaited_state: + raise InvalidContainerStateError(self.name, actual_state) def mount_rootfs(self): # Prepares container rootfs