From a07ef4e6a150e6fae8b2f2bade18618c84686eb7 Mon Sep 17 00:00:00 2001 From: Sebastian Dahlgren Date: Mon, 27 Jan 2014 15:19:23 +0100 Subject: [PATCH] Removed the eternal loop --- automated_ebs_snapshots/snapshot_manager.py | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/automated_ebs_snapshots/snapshot_manager.py b/automated_ebs_snapshots/snapshot_manager.py index 87c7295..8d78e71 100644 --- a/automated_ebs_snapshots/snapshot_manager.py +++ b/automated_ebs_snapshots/snapshot_manager.py @@ -1,7 +1,6 @@ """ 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 @@ -9,22 +8,16 @@ 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):