Fixed tabulations
diff --git a/planetstack/ec2_observer/steps/sync_site_deployments.py b/planetstack/ec2_observer/steps/sync_site_deployments.py
index 54df732..7c24f68 100644
--- a/planetstack/ec2_observer/steps/sync_site_deployments.py
+++ b/planetstack/ec2_observer/steps/sync_site_deployments.py
@@ -8,43 +8,43 @@
import pdb
class SyncSiteDeployments(SyncStep):
- requested_interval=86400
- provides=[SiteDeployments]
+ requested_interval=86400
+ provides=[SiteDeployments]
- def fetch_pending(self, deletion):
+ 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]
+ zone_ret = aws_run('ec2 describe-availability-zones')
+ zones = zone_ret['AvailabilityZones']
+ available_sites = [zone['ZoneName'] for zone in zones]
- current_sites = []
- for s in available_sites:
- site = Site.objects.filter(Q(name=s))
- if (site):
- current_sites.append(site[0])
+ current_sites = []
+ for s in available_sites:
+ site = Site.objects.filter(Q(name=s))
+ if (site):
+ current_sites.append(site[0])
- # OK not to catch exception
- # The syncstep should catch it
- # At any rate, we should not run if there are no deployments
- deployment = Deployment.objects.filter(Q(name="Amazon EC2"))[0]
- current_site_deployments = SiteDeployments.objects.filter(Q(deployment=deployment))
- site_dict = {}
+ # OK not to catch exception
+ # The syncstep should catch it
+ # At any rate, we should not run if there are no deployments
+ deployment = Deployment.objects.filter(Q(name="Amazon EC2"))[0]
+ current_site_deployments = SiteDeployments.objects.filter(Q(deployment=deployment))
+ site_dict = {}
- for sd in current_site_deployments:
- site_dict[sd.site]=sd
+ for sd in current_site_deployments:
+ site_dict[sd.site]=sd
- updated_site_deployments = []
- for site in current_sites:
- try:
- site_record = site_dict[site]
- except KeyError:
- sd = SiteDeployments(site=site,deployment=deployment,tenant_id=base64.urlsafe_b64encode(os.urandom(12)))
- updated_site_deployments.append(sd)
+ updated_site_deployments = []
+ for site in current_sites:
+ try:
+ site_record = site_dict[site]
+ except KeyError:
+ sd = SiteDeployments(site=site,deployment=deployment,tenant_id=base64.urlsafe_b64encode(os.urandom(12)))
+ updated_site_deployments.append(sd)
- return updated_site_deployments
+ return updated_site_deployments
- def sync_record(self, site_deployment):
- site_deployment.save()
+ def sync_record(self, site_deployment):
+ site_deployment.save()