Explicitly prevent deletion processing in steps in which it doesn't make
sense.
diff --git a/planetstack/ec2_observer/event_loop.py b/planetstack/ec2_observer/event_loop.py
index d9855eb..e703869 100644
--- a/planetstack/ec2_observer/event_loop.py
+++ b/planetstack/ec2_observer/event_loop.py
@@ -234,7 +234,7 @@
logger.info('Waiting for event')
tBeforeWait = time.time()
- self.wait_for_event(timeout=30)
+ self.wait_for_event(timeout=5)
logger.info('Observer woke up')
# Two passes. One for sync, the other for deletion.
diff --git a/planetstack/ec2_observer/event_manager.pyc b/planetstack/ec2_observer/event_manager.pyc
index 344d5e2..7737f37 100644
--- a/planetstack/ec2_observer/event_manager.pyc
+++ b/planetstack/ec2_observer/event_manager.pyc
Binary files differ
diff --git a/planetstack/ec2_observer/steps/sync_deployments.py b/planetstack/ec2_observer/steps/sync_deployments.py
index 8a258f1..76eeb1f 100644
--- a/planetstack/ec2_observer/steps/sync_deployments.py
+++ b/planetstack/ec2_observer/steps/sync_deployments.py
@@ -10,6 +10,9 @@
provides=[Deployment]
def fetch_pending(self,deletion):
+ if (deletion):
+ return []
+
deployments = Deployment.objects.filter(Q(name="Amazon EC2"))
if (not deployments):
deployments = [Deployment(name="Amazon EC2")]
diff --git a/planetstack/ec2_observer/steps/sync_images.py b/planetstack/ec2_observer/steps/sync_images.py
index 3a15b33..903b73b 100644
--- a/planetstack/ec2_observer/steps/sync_images.py
+++ b/planetstack/ec2_observer/steps/sync_images.py
@@ -12,6 +12,9 @@
requested_interval=3600
def fetch_pending(self,deletion):
+ if (deletion):
+ return []
+
images = Image.objects.all()
image_names = [image.name for image in images]
diff --git a/planetstack/ec2_observer/steps/sync_nodes.py b/planetstack/ec2_observer/steps/sync_nodes.py
index b66eb2e..9dc00f2 100644
--- a/planetstack/ec2_observer/steps/sync_nodes.py
+++ b/planetstack/ec2_observer/steps/sync_nodes.py
@@ -16,6 +16,9 @@
requested_interval=0
def fetch_pending(self, deletion):
+ if (deletion):
+ return []
+
deployment = Deployment.objects.filter(Q(name="Amazon EC2"))[0]
current_site_deployments = SiteDeployments.objects.filter(Q(deployment=deployment))
diff --git a/planetstack/ec2_observer/steps/sync_site_deployments.py b/planetstack/ec2_observer/steps/sync_site_deployments.py
index 30fdf97..54df732 100644
--- a/planetstack/ec2_observer/steps/sync_site_deployments.py
+++ b/planetstack/ec2_observer/steps/sync_site_deployments.py
@@ -12,6 +12,9 @@
provides=[SiteDeployments]
def fetch_pending(self, deletion):
+ if (deletion):
+ return []
+
zone_ret = aws_run('ec2 describe-availability-zones')
zones = zone_ret['AvailabilityZones']
available_sites = [zone['ZoneName'] for zone in zones]
diff --git a/planetstack/ec2_observer/steps/sync_sites.py b/planetstack/ec2_observer/steps/sync_sites.py
index 7a5c0dc..c8d6490 100644
--- a/planetstack/ec2_observer/steps/sync_sites.py
+++ b/planetstack/ec2_observer/steps/sync_sites.py
@@ -12,6 +12,8 @@
requested_interval=3600
def fetch_pending(self, deletion):
+ if (deletion):
+ return []
deployment = Deployment.objects.filter(Q(name="Amazon EC2"))[0]
current_site_deployments = SiteDeployments.objects.filter(Q(deployment=deployment))
diff --git a/planetstack/ec2_observer/steps/sync_users.py b/planetstack/ec2_observer/steps/sync_users.py
index d742186..030e360 100644
--- a/planetstack/ec2_observer/steps/sync_users.py
+++ b/planetstack/ec2_observer/steps/sync_users.py
@@ -16,6 +16,9 @@
requested_interval=0
def fetch_pending(self, deletion):
+ if (deletion):
+ return []
+
users = User.objects.filter(Q(enacted__lt=F('updated')) | Q(enacted=None))
if (users):
key_sig = aws_run('ec2 describe-key-pairs')