Raise InvalidContainerStateError when await_state fails
This commit is contained in:
parent
44c1a8638d
commit
d4bbce2dcf
@ -73,7 +73,10 @@ class Container:
|
|||||||
|
|
||||||
def await_state(self, awaited_state):
|
def await_state(self, awaited_state):
|
||||||
# Block execution until the container reaches the desired state or until timeout
|
# 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):
|
def mount_rootfs(self):
|
||||||
# Prepares container rootfs
|
# Prepares container rootfs
|
||||||
|
Loading…
Reference in New Issue
Block a user