Island: Improve _aws_command_results_to_encodable_dict

By calling __dict__ we avoid the need to specify each dictionary key and make it the same as AWSCommandResults. This will allow for easier modification of AWSCommandResults.
This commit is contained in:
vakarisz 2022-05-12 11:21:47 +03:00
parent c685ce3725
commit 499fec2574
1 changed files with 3 additions and 7 deletions

View File

@ -67,10 +67,6 @@ class RemoteRun(flask_restful.Resource):
@staticmethod @staticmethod
def _aws_command_results_to_encodable_dict(aws_command_results: AWSCommandResults): def _aws_command_results_to_encodable_dict(aws_command_results: AWSCommandResults):
return { res_dict = aws_command_results.__dict__
"instance_id": aws_command_results.instance_id, res_dict["status"] = res_dict["status"].name.lower()
"response_code": aws_command_results.response_code, return res_dict
"stdout": aws_command_results.stdout,
"stderr": aws_command_results.stderr,
"status": aws_command_results.status.name.lower(),
}