Skip to content

Commit

Permalink
Merge pull request #134 from tarunmenon95/feature/bugfix-copysharedba…
Browse files Browse the repository at this point in the history
…ckup

Feature/bugfix copysharedbackup
  • Loading branch information
LewS authored Jul 4, 2022
2 parents 95962fd + 093e2f2 commit 305666b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions shelvery/documentdb_backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def copy_shared_backup(self, source_account: str, source_backup: BackupResource)
kms_key = source_backup.resource_properties['KmsKeyId']
self.logger.info(f"Snapshot {source_backup.backup_id} is encrypted with the kms key {kms_key}")

copy_kms_key = RuntimeConfig.get_copy_kms_key_id(backup_resource.entity_resource.tags, self)
copy_kms_key = RuntimeConfig.get_copy_kms_key_id(source_backup.tags, self)
# if a new key is provided by config encypt the copy with the new kms key
if copy_kms_key is not None:
self.logger.info(
Expand All @@ -149,8 +149,8 @@ def copy_shared_backup(self, source_account: str, source_backup: BackupResource)
params['KmsKeyId'] = kms_key
else:
# if the backup is not encrypted and the encrypt_copy is enabled, encrypted the backup with the provided kms key
if RuntimeConfig.get_encrypt_copy(backup_resource.entity_resource.tags, self):
kms_key = RuntimeConfig.get_copy_kms_key_id(backup_resource.entity_resource.tags, self)
if RuntimeConfig.get_encrypt_copy(source_backup.tags, self):
kms_key = RuntimeConfig.get_copy_kms_key_id(source_backup.tags, self)
if kms_key is not None:
self.logger.info(
f"Snapshot {source_backup.backup_id} is not encrypted. Encrypting the copy with KMS key {kms_key}")
Expand Down
6 changes: 3 additions & 3 deletions shelvery/rds_cluster_backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def copy_shared_backup(self, source_account: str, source_backup: BackupResource)
kms_key = source_backup.resource_properties['KmsKeyId']
self.logger.info(f"Snapshot {source_backup.backup_id} is encrypted with the kms key {kms_key}")

copy_kms_key = RuntimeConfig.get_copy_kms_key_id(backup_resource.entity_resource.tags, self)
copy_kms_key = RuntimeConfig.get_copy_kms_key_id(source_backup.tags, self)
# if a new key is provided by config encypt the copy with the new kms key
if copy_kms_key is not None:
self.logger.info(f"Snapshot {source_backup.backup_id} will be copied and encrypted with the kms key {copy_kms_key}")
Expand All @@ -143,8 +143,8 @@ def copy_shared_backup(self, source_account: str, source_backup: BackupResource)
params['KmsKeyId'] = kms_key
else:
# if the backup is not encrypted and the encrypt_copy is enabled, encrypted the backup with the provided kms key
if RuntimeConfig.get_encrypt_copy(backup_resource.entity_resource.tags, self):
kms_key = RuntimeConfig.get_copy_kms_key_id(backup_resource.entity_resource.tags, self)
if RuntimeConfig.get_encrypt_copy(source_backup.tags, self):
kms_key = RuntimeConfig.get_copy_kms_key_id(source_backup.tags, self)
if kms_key is not None:
self.logger.info(f"Snapshot {source_backup.backup_id} is not encrypted. Encrypting the copy with KMS key {kms_key}")
params['KmsKeyId'] = kms_key
Expand Down

0 comments on commit 305666b

Please sign in to comment.