From 21a264c337cfc6cb30b57420a16fb33eede19248 Mon Sep 17 00:00:00 2001 From: Tom Elliff Date: Mon, 23 Apr 2018 19:41:54 +0100 Subject: [PATCH] Default TimeoutSeconds to 1 hour (#1592) TimeoutSeconds isn't a required field so we can't rely on it being there. Quick tests against the AWS API show that when it's not specified the ExpiresAfter field seems to be 1 hour after the request. --- moto/ssm/models.py | 2 +- tests/test_ssm/test_ssm_boto3.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/moto/ssm/models.py b/moto/ssm/models.py index bb25baa5f..fc74e1524 100644 --- a/moto/ssm/models.py +++ b/moto/ssm/models.py @@ -144,7 +144,7 @@ class SimpleSystemManagerBackend(BaseBackend): def send_command(self, **kwargs): instances = kwargs.get('InstanceIds', []) now = datetime.datetime.now() - expires_after = now + datetime.timedelta(0, int(kwargs['TimeoutSeconds'])) + expires_after = now + datetime.timedelta(0, int(kwargs.get('TimeoutSeconds', 3600))) return { 'Command': { 'CommandId': str(uuid.uuid4()), diff --git a/tests/test_ssm/test_ssm_boto3.py b/tests/test_ssm/test_ssm_boto3.py index 97801e0b9..0531d1780 100644 --- a/tests/test_ssm/test_ssm_boto3.py +++ b/tests/test_ssm/test_ssm_boto3.py @@ -481,7 +481,6 @@ def test_send_command(): response = client.send_command( InstanceIds=['i-123456'], DocumentName=ssm_document, - TimeoutSeconds=60, Parameters=params, OutputS3Region='us-east-2', OutputS3BucketName='the-bucket',