Flavour oriented configuration
authorMohamed Larabi <mohamed.larabi@inria.fr>
Fri, 31 Aug 2012 14:10:58 +0000 (16:10 +0200)
committerMohamed Larabi <mohamed.larabi@inria.fr>
Mon, 17 Sep 2012 12:13:37 +0000 (14:13 +0200)
config/default_config.xml
config/sfa-config-tty

index 6d80712..6aa3df9 100644 (file)
@@ -327,6 +327,22 @@ Thierry Parmentelat
       </variablelist>
     </category>
 
       </variablelist>
     </category>
 
+    <!-- ======================================== -->
+    <category id="sfa_nitos">
+      <name></name>
+      <description>The settings that tell this SFA instance how to interact with the NITOS testbed.</description>
+
+      <variablelist>
+        <variable id="url" type="string">
+          <name>XMLRPC URL</name>
+          <value>http://195.251.17.239:8080/RPC2</value>
+          <description>URL for the NITOS Scheduler xmlrpc API</description>
+        </variable>
+      </variablelist>
+    </category>
+
+    <!-- ======================================== -->
+
   </variables>
 
   <comps>
   </variables>
 
   <comps>
index 0b708e2..fe3aab3 100755 (executable)
@@ -29,11 +29,14 @@ usual_variables = [
     "SFA_AGGREGATE_HOST",
     "SFA_SM_HOST",
     "SFA_DB_HOST",
     "SFA_AGGREGATE_HOST",
     "SFA_SM_HOST",
     "SFA_DB_HOST",
-    "SFA_PLC_URL",
-    "SFA_PLC_USER",
-    "SFA_PLC_PASSWORD",
     ]
 
     ]
 
+flavour_xml_section_hash = { \
+    'pl':'sfa_plc',
+    'openstack':'sfa_nova',
+    'fd':'sfa_federica',
+    'nitos':'sfa_nitos'
+    }
 configuration={ \
     'name':'sfa',
     'service':"sfa",
 configuration={ \
     'name':'sfa',
     'service':"sfa",
@@ -401,11 +404,23 @@ def mainloop (cdef, cread, cwrite, default_config, site_config, consolidated_con
                    (service,service))
         elif command in "uU":
             global usual_variables
                    (service,service))
         elif command in "uU":
             global usual_variables
+            global flavour_xml_section_hash
             try:
                 for varname in usual_variables:
                     (category,variable) = cdef.locate_varname(varname)
                     if not (category is None and variable is None):
                         prompt_variable(cdef, cread, cwrite, category, variable, False)
             try:
                 for varname in usual_variables:
                     (category,variable) = cdef.locate_varname(varname)
                     if not (category is None and variable is None):
                         prompt_variable(cdef, cread, cwrite, category, variable, False)
+                
+                # set the driver variable according to the already set flavour 
+                generic_flavour = cwrite.items('sfa')[0][1]
+                for section in cdef.sections():
+                     if generic_flavour in flavour_xml_section_hash and flavour_xml_section_hash[generic_flavour] == section:
+                         for item in cdef.items(section):
+                              category = section
+                              variable = item[0]
+                              prompt_variable(cdef, cread, cwrite, category, variable, False)
+                         break
+
             except Exception, inst:
                 if (str(inst) != 'BailOut'):
                     raise
             except Exception, inst:
                 if (str(inst) != 'BailOut'):
                     raise