Skip to content
This repository has been archived by the owner on Oct 7, 2020. It is now read-only.

Tag with creation date of snapshot #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
9 changes: 7 additions & 2 deletions backup_monkey/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

from boto.exception import NoAuthHandlerFound, BotoServerError
from boto import ec2
from datetime import datetime

from exception import BackupMonkeyException

Expand Down Expand Up @@ -121,7 +122,7 @@ def get_all_volumes(self, **kwargs):
def get_volumes_to_snapshot(self):
''' Returns volumes to snapshot based on passed in tags '''
self._info(
subject=_status.parse_status('volumes_fetch', self._region),
subject=_status.parse_status('volumes_fetch', self._region),
category='volumes')
volumes = []
if self._reverse_tags:
Expand Down Expand Up @@ -170,8 +171,12 @@ def snapshot_volumes(self):
category='snapshots',
type='alert',
severity='high')

snapshot_tags = {}
if volume.tags:
snapshot.add_tags(self.remove_reserved_tags(volume.tags))
snapshot_tags = self.remove_reserved_tags(volume.tags)
snapshot_tags.update({'snap_create_time': str(datetime.today().date())})
snapshot.add_tags(snapshot_tags)
self._info(subject=_status.parse_status('snapshot_create_success', (snapshot.id, volume.id)),
src_volume=volume.id,
src_snapshot=snapshot.id,
Expand Down