add enable_build bit to XOS (untested)
diff --git a/xos/core/models/xosmodel.py b/xos/core/models/xosmodel.py
index 9b6de82..4942241 100644
--- a/xos/core/models/xosmodel.py
+++ b/xos/core/models/xosmodel.py
@@ -13,6 +13,7 @@
bootstrap_ui_port = models.IntegerField(help_text="Port for XOS UI", default=81)
db_container_name = StrippedCharField(max_length=200, help_text="name of XOS db container", default="xos_db")
docker_project_name = StrippedCharField(max_length=200, help_text="docker project name")
+ enable_build = models.BooleanField(help_text="True if Onboarding Synchronizer should build XOS as necessary", default=True)
def __unicode__(self): return u'%s' % (self.name)
diff --git a/xos/synchronizers/onboarding/steps/sync_servicecontroller.py b/xos/synchronizers/onboarding/steps/sync_servicecontroller.py
index 6c7af35..77d8e12 100644
--- a/xos/synchronizers/onboarding/steps/sync_servicecontroller.py
+++ b/xos/synchronizers/onboarding/steps/sync_servicecontroller.py
@@ -3,7 +3,7 @@
import base64
from django.db.models import F, Q
from xos.config import Config
-from synchronizers.base.syncstep import SyncStep
+from synchronizers.base.syncstep import SyncStep, DeferredException
from core.models import XOS, ServiceController
from xos.logger import Logger, logging
from synchronizers.base.ansible import run_template
@@ -29,6 +29,9 @@
def sync_record(self, sc):
logger.info("Sync'ing ServiceController %s" % sc)
+ if sc.xos and (not sc.xos.enable_build):
+ raise DeferredException("XOS build is currently disabled")
+
unready = self.check_controller_unready(sc)
if unready:
raise Exception("Controller %s has unready resources: %s" % (str(sc), ",".join([str(x) for x in unready])))
diff --git a/xos/synchronizers/onboarding/steps/sync_xos.py b/xos/synchronizers/onboarding/steps/sync_xos.py
index e39a765..dec7a34 100644
--- a/xos/synchronizers/onboarding/steps/sync_xos.py
+++ b/xos/synchronizers/onboarding/steps/sync_xos.py
@@ -3,7 +3,7 @@
import base64
from django.db.models import F, Q
from xos.config import Config
-from synchronizers.base.syncstep import SyncStep
+from synchronizers.base.syncstep import SyncStep, DeferredException
from core.models import XOS
from xos.logger import Logger, logging
from synchronizers.base.ansible import run_template
@@ -29,6 +29,9 @@
def sync_record(self, xos):
logger.info("Sync'ing XOS %s" % xos)
+ if (not xos.enable_build):
+ raise DeferredException("XOS build is currently disabled")
+
self.create_docker_compose()
dockerfiles = [self.create_ui_dockerfile()]
diff --git a/xos/tosca/custom_types/xos.m4 b/xos/tosca/custom_types/xos.m4
index 2a0c496..d4f771b 100644
--- a/xos/tosca/custom_types/xos.m4
+++ b/xos/tosca/custom_types/xos.m4
@@ -23,6 +23,10 @@
type: string
required: false
description: Docker project name
+ enable_build:
+ type: boolean
+ required: false
+ description: True if XOS build should be enabled
tosca.nodes.XOSVolume:
diff --git a/xos/tosca/custom_types/xos.yaml b/xos/tosca/custom_types/xos.yaml
index 6efd9f5..10518d7 100644
--- a/xos/tosca/custom_types/xos.yaml
+++ b/xos/tosca/custom_types/xos.yaml
@@ -53,6 +53,10 @@
type: string
required: false
description: Docker project name
+ enable_build:
+ type: boolean
+ required: false
+ description: True if XOS build should be enabled
tosca.nodes.XOSVolume:
diff --git a/xos/tosca/resources/xosmodel.py b/xos/tosca/resources/xosmodel.py
index f1731ac..188bb4f 100644
--- a/xos/tosca/resources/xosmodel.py
+++ b/xos/tosca/resources/xosmodel.py
@@ -12,7 +12,7 @@
class XOSXOS(XOSResource):
provides = "tosca.nodes.XOS"
xos_model = XOS
- copyin_props = ["ui_port", "bootstrap_ui_port", "docker_project_name"]
+ copyin_props = ["ui_port", "bootstrap_ui_port", "docker_project_name", "enable_build"]
class XOSVolume(XOSResource):
provides = "tosca.nodes.XOSVolume"