service controller sync step
diff --git a/xos/synchronizers/onboarding/steps/sync_servicecontroller.py b/xos/synchronizers/onboarding/steps/sync_servicecontroller.py
new file mode 100644
index 0000000..d148b4d
--- /dev/null
+++ b/xos/synchronizers/onboarding/steps/sync_servicecontroller.py
@@ -0,0 +1,46 @@
+import os
+import sys
+import base64
+from django.db.models import F, Q
+from xos.config import Config
+from synchronizers.base.syncstep import SyncStep
+from core.models import XOS, ServiceController
+from xos.logger import Logger, logging
+from synchronizers.base.ansible import run_template
+
+# xosbuilder will be in steps/..
+parentdir = os.path.join(os.path.dirname(__file__),"..")
+sys.path.insert(0,parentdir)
+
+from xosbuilder import XOSBuilder
+
+logger = Logger(level=logging.INFO)
+
+class SyncServiceController(SyncStep, XOSBuilder):
+ provides=[ServiceController]
+ observes=ServiceController
+ requested_interval=0
+ playbook = "sync_servicecontroller.yaml"
+
+ def __init__(self, **args):
+ SyncStep.__init__(self, **args)
+ XOSBuilder.__init__(self)
+
+ def sync_record(self, sc):
+ logger.info("Sync'ing ServiceController %s" % sc)
+
+ dockerfiles = [self.create_ui_dockerfile()]
+ tenant_fields = {"dockerfiles": dockerfiles,
+ "build_dir": self.build_dir,
+ "ansible_tag": sc.__class__.__name__ + "_" + str(sc.id)}
+
+ path="servicecontroller"
+ res = run_template(self.playbook, tenant_fields, path=path)
+
+ def delete_record(self, m):
+ pass
+
+ def fetch_pending(self, deleted=False):
+ pend = super(SyncServiceController, self).fetch_pending(deleted)
+ return pend
+
diff --git a/xos/synchronizers/onboarding/steps/sync_servicecontroller.yaml b/xos/synchronizers/onboarding/steps/sync_servicecontroller.yaml
new file mode 100644
index 0000000..9431427
--- /dev/null
+++ b/xos/synchronizers/onboarding/steps/sync_servicecontroller.yaml
@@ -0,0 +1,20 @@
+---
+- hosts: 127.0.0.1
+ connection: local
+
+ vars:
+ dockerfiles:
+ {% for dockerfile in dockerfiles %}
+ - docker_image_name: {{ dockerfile.docker_image_name }}
+ dockerfile_fn: {{ dockerfile.dockerfile_fn }}
+ {% endfor %}
+
+ tasks:
+ {% for dockerfile in dockerfiles %}
+ - name: build_docker_{{ dockerfile.docker_image_name }}
+ shell: chdir={{ build_dir }} docker build -f {{ dockerfile.dockerfile_fn }} --rm -t {{ dockerfile.docker_image_name }} .
+ {% endfor %}
+
+# - build_dockers:
+# shell: docker build -f {{ '{{' }} item.dockerfile_fn {{ '}}' }} --rm -t {{ '{{' }} item.docker_image_name {{ '}}' }} .
+# with items: "dockerfiles"