SSM Parameter Store Error Message When Requesting Invalid Version (#3977)

* Implement correct error when requesting specific version of a parameter which exists but does not have this version

* removing trailing whitespace causing lint failure

* Adding unit tests and fixing linting for new error handling

* Fixing small bug in response message

* Revert change in get_parameters as versioning is not currently implemented in this method. Will fix as a separate PR
This commit is contained in:
Austin Hendrix 2021-06-02 10:27:23 -05:00 committed by GitHub
commit b670962c5e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 2 deletions

View file

@ -1217,7 +1217,12 @@ class SimpleSystemManagerBackend(BaseBackend):
)
if len(result) > 0:
return result[-1]
elif len(parameters) > 0:
raise ParameterVersionNotFound(
"Systems Manager could not find version %s of %s. "
"Verify the version and try again."
% (version_or_label, name_prefix)
)
result = list(
filter(lambda x: version_or_label in x.labels, parameters)
)