Island: Add instance ID to AWSCommandResults
Instance id tells us where the command was launched
This commit is contained in:
parent
0b5a507f38
commit
b8006a6274
|
@ -67,7 +67,11 @@ class RemoteRun(flask_restful.Resource):
|
|||
for result in results:
|
||||
results_copy.append(
|
||||
AWSCommandResults(
|
||||
result.response_code, result.stdout, result.stderr, result.status.name.lower()
|
||||
result.instance_id,
|
||||
result.response_code,
|
||||
result.stdout,
|
||||
result.stderr,
|
||||
result.status.name.lower(),
|
||||
)
|
||||
)
|
||||
return results_copy
|
||||
|
|
|
@ -23,6 +23,7 @@ class AWSCommandStatus(Enum):
|
|||
|
||||
@dataclass(frozen=True)
|
||||
class AWSCommandResults:
|
||||
instance_id: str
|
||||
response_code: int
|
||||
stdout: str
|
||||
stderr: str
|
||||
|
@ -137,6 +138,7 @@ def _fetch_command_results(
|
|||
aws_command_result_status = AWSCommandStatus.ERROR
|
||||
|
||||
return AWSCommandResults(
|
||||
target_instance_id,
|
||||
command_results["ResponseCode"],
|
||||
command_results["StandardOutputContent"],
|
||||
command_results["StandardErrorContent"],
|
||||
|
|
|
@ -228,5 +228,5 @@ def test_failed_command(send_command_response, error_response):
|
|||
],
|
||||
)
|
||||
def test_command_resuls_status(status, success):
|
||||
results = AWSCommandResults(0, "", "", status)
|
||||
results = AWSCommandResults(INSTANCE_ID, 0, "", "", status)
|
||||
assert results.success == success
|
||||
|
|
Loading…
Reference in New Issue