Sapan Bhatia | 511ea5f | 2014-07-21 22:53:58 -0400 | [diff] [blame] | 1 | import os |
| 2 | import base64 |
| 3 | from django.db.models import F, Q |
| 4 | from planetstack.config import Config |
| 5 | from ec2_observer.syncstep import SyncStep |
| 6 | from core.models.site import * |
| 7 | |
| 8 | class SyncDeployments(SyncStep): |
| 9 | requested_interval=86400 |
| 10 | provides=[Deployment] |
| 11 | |
| 12 | def fetch_pending(self,deletion): |
Sapan Bhatia | e7e4ca1 | 2014-07-22 01:27:02 -0400 | [diff] [blame] | 13 | if (deletion): |
| 14 | return [] |
| 15 | |
Sapan Bhatia | 511ea5f | 2014-07-21 22:53:58 -0400 | [diff] [blame] | 16 | deployments = Deployment.objects.filter(Q(name="Amazon EC2")) |
| 17 | if (not deployments): |
| 18 | deployments = [Deployment(name="Amazon EC2")] |
| 19 | else: |
| 20 | deployments = [] |
| 21 | |
| 22 | return deployments |
| 23 | |
| 24 | def sync_record(self, deployment): |
| 25 | deployment.save() |