Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/bugfix copysharedbackup #134

Merged
merged 2 commits into from
Jul 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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