Fix serialisation of enum values by encoding as int

This commit is contained in:
Olivier 'reivilibre' 2021-01-01 12:24:36 +00:00
parent 37a5a2b99f
commit 37343c339e
2 changed files with 5 additions and 5 deletions

View File

@ -28,7 +28,7 @@ class DockerContainer(Recipe):
async def cook(self, kitchen: Kitchen) -> None:
kitchen.get_dependency_tracker()
current_state = await kitchen.ut1(DockerContainerState(self.name))
current_state = ContainerState(await kitchen.ut1(DockerContainerState(self.name)))
if current_state == ContainerState.NOTFOUND:
await kitchen.ut1areq(

View File

@ -51,16 +51,16 @@ class DockerContainerState(Utensil):
container: Container
if self.name == container.name:
if container.status == "running":
await channel.send(ContainerState.RUNNING)
await channel.send(ContainerState.RUNNING.value)
elif container.status == "exited":
await channel.send(ContainerState.EXITED)
await channel.send(ContainerState.EXITED.value)
elif container.status == "restarting":
await channel.send(ContainerState.RESTARTING)
await channel.send(ContainerState.RESTARTING.value)
else:
raise ValueError(f"Unknown container status: {container.status}")
break
else:
await channel.send(ContainerState.NOTFOUND)
await channel.send(ContainerState.NOTFOUND.value)
@attr.s(auto_attribs=True)