Skip to content

Commit

Permalink
Removed the eternal loop
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Dahlgren committed Jan 27, 2014
1 parent 394cf81 commit a07ef4e
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions automated_ebs_snapshots/snapshot_manager.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,23 @@
""" Module handling the snapshots """
import logging
import datetime
import time

from automated_ebs_snapshots import volume_manager
from automated_ebs_snapshots.valid_intervals import VALID_INTERVALS

logger = logging.getLogger(__name__)


def run(connection, interval=60):
def run(connection):
""" Ensure that we have snapshots for a given volume
:type connection: boto.ec2.connection.EC2Connection
:param connection: EC2 connection object
:type interval: int
:param interval: Number of seconds to wait between checks
"""
while True:
volumes = volume_manager.get_watched_volumes(connection)
volumes = volume_manager.get_watched_volumes(connection)

for volume in volumes:
_ensure_snapshot(connection, volume)

logger.info('Waiting {} seconds until next check'.format(interval))
time.sleep(interval)
for volume in volumes:
_ensure_snapshot(connection, volume)


def _create_snapshot(volume):
Expand Down

0 comments on commit a07ef4e

Please sign in to comment.