Fix the online status in OpsWorks

When an instance is running, OpsWorks reports its status as "online"
[1], while EC2 reports it as "running". Until now, moto copied the EC2
instance's status as is. This commit introduces the converts the running
status to online when returned by OpsWorks.

[1]: https://docs.aws.amazon.com/cli/latest/reference/opsworks/describe-instances.html
This commit is contained in:
Rigas Papathanasopoulos 2020-05-06 23:12:32 +03:00
commit 4abd88f95c
No known key found for this signature in database
GPG key ID: 6195E32AA5E22F4D
2 changed files with 9 additions and 0 deletions

View file

@ -125,6 +125,9 @@ class OpsworkInstance(BaseModel):
def status(self):
if self.instance is None:
return "stopped"
# OpsWorks reports the "running" state as "online"
elif self.instance._state.name == "running":
return "online"
return self.instance._state.name
def to_dict(self):