SSM: Fix bad state caused by invalid PutParameter request (#6484)

This commit is contained in:
Viren Nadkarni 2023-07-07 19:43:57 +05:30 committed by GitHub
parent 47bca5b607
commit 89f2a3c538
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -2062,7 +2062,11 @@ class SimpleSystemManagerBackend(BaseBackend):
"formed as a mix of letters, numbers and the following 3 symbols .-_" "formed as a mix of letters, numbers and the following 3 symbols .-_"
) )
raise ValidationException(invalid_prefix_error) raise ValidationException(invalid_prefix_error)
if not parameter_type and not overwrite and not self._parameters[name]: if (
not parameter_type
and not overwrite
and not (name in self._parameters and self._parameters[name])
):
raise ValidationException( raise ValidationException(
"A parameter type is required when you create a parameter." "A parameter type is required when you create a parameter."
) )

View File

@ -448,6 +448,9 @@ def test_put_parameter_no_type():
== "A parameter type is required when you create a parameter." == "A parameter type is required when you create a parameter."
) )
# Ensure backend state is consistent
assert client.describe_parameters()
@mock_ssm @mock_ssm
def test_update_parameter(): def test_update_parameter():