Work around python2 unicode exception str() issues

This commit is contained in:
Alexander Campbell 2019-10-16 14:44:41 +11:00
commit 9a54cea4f1
2 changed files with 16 additions and 16 deletions

View file

@ -47,7 +47,7 @@ class SecretsManagerBackend(BaseBackend):
def get_secret_value(self, secret_id, version_id, version_stage):
if not self._is_valid_identifier(secret_id):
raise ResourceNotFoundException("Secrets Manager cant find the specified secret.")
raise ResourceNotFoundException(u"Secrets Manager cant find the specified secret.")
if not version_id and version_stage:
# set version_id to match version_stage
@ -57,7 +57,7 @@ class SecretsManagerBackend(BaseBackend):
version_id = ver_id
break
if not version_id:
raise ResourceNotFoundException("Secrets Manager cant find the specified secret.")
raise ResourceNotFoundException(u"Secrets Manager cant find the specified secret.")
# TODO check this part
if 'deleted_date' in self.secrets[secret_id]:
@ -87,8 +87,8 @@ class SecretsManagerBackend(BaseBackend):
if 'secret_string' not in secret_version and 'secret_binary' not in secret_version:
raise ResourceNotFoundException(
"Secrets Manager cant find the specified secret value for staging label: %s" %
(version_stage or "AWSCURRENT")
u"Secrets Manager cant find the specified secret value for staging label: %s" %
(version_stage or u"AWSCURRENT")
)
response = json.dumps(response_data)
@ -176,7 +176,7 @@ class SecretsManagerBackend(BaseBackend):
def describe_secret(self, secret_id):
if not self._is_valid_identifier(secret_id):
raise ResourceNotFoundException("Secrets Manager cant find the specified secret.")
raise ResourceNotFoundException(u"Secrets Manager cant find the specified secret.")
secret = self.secrets[secret_id]
@ -205,7 +205,7 @@ class SecretsManagerBackend(BaseBackend):
rotation_days = 'AutomaticallyAfterDays'
if not self._is_valid_identifier(secret_id):
raise ResourceNotFoundException("Secrets Manager cant find the specified secret.")
raise ResourceNotFoundException(u"Secrets Manager cant find the specified secret.")
if 'deleted_date' in self.secrets[secret_id]:
raise InvalidRequestException(
@ -347,7 +347,7 @@ class SecretsManagerBackend(BaseBackend):
def delete_secret(self, secret_id, recovery_window_in_days, force_delete_without_recovery):
if not self._is_valid_identifier(secret_id):
raise ResourceNotFoundException("Secrets Manager cant find the specified secret.")
raise ResourceNotFoundException(u"Secrets Manager cant find the specified secret.")
if 'deleted_date' in self.secrets[secret_id]:
raise InvalidRequestException(
@ -377,7 +377,7 @@ class SecretsManagerBackend(BaseBackend):
secret = self.secrets.get(secret_id, None)
if not secret:
raise ResourceNotFoundException("Secrets Manager cant find the specified secret.")
raise ResourceNotFoundException(u"Secrets Manager cant find the specified secret.")
arn = secret_arn(self.region, secret['secret_id'])
name = secret['name']
@ -387,7 +387,7 @@ class SecretsManagerBackend(BaseBackend):
def restore_secret(self, secret_id):
if not self._is_valid_identifier(secret_id):
raise ResourceNotFoundException("Secrets Manager cant find the specified secret.")
raise ResourceNotFoundException(u"Secrets Manager cant find the specified secret.")
self.secrets[secret_id].pop('deleted_date', None)