Removing sctp module load from Apex
[apex.git] / lib / python / apex / deploy_settings.py
index 3583646..2a9d5a6 100644 (file)
@@ -11,6 +11,8 @@
 import yaml
 import logging
 
+from .common import utils
+
 REQ_DEPLOY_SETTINGS = ['sdn_controller',
                        'odl_version',
                        'sdn_l3',
@@ -20,9 +22,10 @@ REQ_DEPLOY_SETTINGS = ['sdn_controller',
                        'sfc',
                        'vpn',
                        'vpp',
-                       'ceph']
+                       'ceph',
+                       'gluon']
 
-OPT_DEPLOY_SETTINGS = ['performance', 'vsperf', 'ceph_device']
+OPT_DEPLOY_SETTINGS = ['performance', 'vsperf', 'ceph_device', 'yardstick']
 
 VALID_ROLES = ['Controller', 'Compute', 'ObjectStorage']
 VALID_PERF_OPTS = ['kernel', 'nova', 'vpp']
@@ -67,6 +70,15 @@ class DeploySettings(dict):
         if not isinstance(deploy_options, dict):
             raise DeploySettingsException("deploy_options should be a list")
 
+        if ('gluon' in self['deploy_options'] and
+           'vpn' in self['deploy_options']):
+                if (self['deploy_options']['gluon'] is True and
+                   self['deploy_options']['vpn'] is False):
+                        raise DeploySettingsException(
+                            "Invalid deployment configuration: "
+                            "If gluon is enabled, "
+                            "vpn also needs to be enabled")
+
         for setting, value in deploy_options.items():
             if setting not in REQ_DEPLOY_SETTINGS + OPT_DEPLOY_SETTINGS:
                 raise DeploySettingsException("Invalid deploy_option {} "
@@ -82,6 +94,8 @@ class DeploySettings(dict):
             if req_set not in deploy_options:
                 if req_set == 'dataplane':
                     self['deploy_options'][req_set] = 'ovs'
+                elif req_set == 'ceph':
+                    self['deploy_options'][req_set] = True
                 else:
                     self['deploy_options'][req_set] = False
 
@@ -163,12 +177,7 @@ class DeploySettings(dict):
         if 'performance' in self['deploy_options']:
             bash_str += self._dump_performance()
         bash_str += self._dump_deploy_options_array()
-
-        if path:
-            with open(path, 'w') as file:
-                file.write(bash_str)
-        else:
-            print(bash_str)
+        utils.write_str(bash_str, path)
 
 
 class DeploySettingsException(Exception):