remove file and delete service_message in synchronizer.
Change-Id: I58349df77e1ff4fb973e341f508cbad7f3eff0f9
diff --git a/xos/synchronizer/steps/sync_vsgw.py b/xos/synchronizer/steps/sync_vsgw.py
new file mode 100644
index 0000000..ddc06e9
--- /dev/null
+++ b/xos/synchronizer/steps/sync_vsgw.py
@@ -0,0 +1,40 @@
+import os
+import sys
+from django.db.models import Q, F
+from services.vsgw.models import VSGWService, VSGWTenant
+from synchronizers.base.SyncInstanceUsingAnsible import SyncInstanceUsingAnsible
+
+parentdir = os.path.join(os.path.dirname(__file__), "..")
+sys.path.insert(0, parentdir)
+
+class SyncVSGWTenant(SyncInstanceUsingAnsible):
+
+ provides = [VSGWTenant]
+
+ observes = VSGWTenant
+
+ requested_interval = 0
+
+ template_name = "sync_vsgw.yaml"
+
+ service_key_name = "/opt/xos/synchronizers/vsgw/vsgw_private_key"
+
+ def __init__(self, *args, **kwargs):
+ super(SyncVSGWTenant, self).__init__(*args, **kwargs)
+
+ def fetch_pending(self, deleted):
+
+ if (not deleted):
+ objs = VSGWTenant.get_tenant_objects().filter(
+ Q(enacted__lt=F('updated')) | Q(enacted=None), Q(lazy_blocked=False))
+ else:
+ # If this is a deletion we get all of the deleted tenants..
+ objs = VSGWTenant.get_deleted_tenant_objects()
+
+ return objs
+
+ def get_extra_attributes(self, o):
+ fields = {}
+ fields['tenant_message'] = o.tenant_message
+ return fields
+