store result of initscript in /var/tmp that is not in memory, for easier troubleshooting
[tests.git] / system / config_default.py
index 9bd90d4..43912ac 100644 (file)
@@ -340,18 +340,19 @@ def keys (options,index):
 initscript_by_name="""#!/bin/bash
 command=$1; shift
 slicename=$1; shift
-stamp="the_script_name"
-stampfile=/tmp/$stamp.stamp
+stamp="initscript_by_name"
+stampfile=/var/tmp/$stamp.stamp
+date=$(date)
 
-echo "Running initscript with command=$command and slicename=$slicename"
+echo $date "Running initscript with command=$command and slicename=$slicename"
 
 function start () {
-  (echo Starting test initscript: $stamp on slicename $slicename ; date) >> $stampfile
-  echo "This is the stdout of the sliver $slicename initscript $command (exp. start) pid=$$" 
-  echo "This is the stderr of the sliver $slicename initscript $command (exp. start) pid=$$" 1>&2
+  (echo $date Starting test initscript: $stamp on slicename $slicename ; date) >> $stampfile
+  echo $date "This is the stdout of the sliver $slicename initscript $command (exp. start) pid=$$"
+  echo $date "This is the stderr of the sliver $slicename initscript $command (exp. start) pid=$$" 1>&2
 }
 function stop () {
-  echo "Removing stamp $stampfile"
+  echo $date "Removing stamp $stampfile"
   rm -f $stampfile
 }
 function restart () {
@@ -366,12 +367,12 @@ restart) restart ;;
 esac
 """
 
-initscript_by_code=initscript_by_name.replace("the_script_name","the_script_code")
+initscript_by_code=initscript_by_name.replace("initscript_by_name","initscript_by_code")
 
 # one single initscript in the InitScripts table
 def initscripts(options,index): 
     return [ { 'initscript_fields' : { 'enabled' : True,
-                                       'name':'the_script_name',
+                                       'name':'initscript_by_name',
                                        'script' : initscript_by_name,
                                        }},
              ]
@@ -393,16 +394,17 @@ def slices (options,index):
                        'sitename' : login_base(index),
                        'owner' : 'pi',
                        }
-        # 1st one has an initscript_code
+        # 1st one has an initscript by code
         if i%3==1:
             slice_spec['initscriptcode']=initscript_by_code
-            slice_spec['initscriptstamp']='the_script_code'
-        # 2nd one has an initscript (name)
+            slice_spec['initscriptstamp']='initscript_by_code'
+        # 2nd one has an initscript by name
         elif i%3==2:
-            slice_spec['initscriptname']='the_script_name'
-            slice_spec['initscriptstamp']='the_script_name'
+            slice_spec['initscriptname']='initscript_by_name'
+            slice_spec['initscriptstamp']='initscript_by_name'
         # 3rd one is omf-friendly
         else:
+            # potentially turned off with config_no_omf
             slice_spec ['omf-friendly'] = True
         return slice_spec
     # usual index is 1, additional plc's then get 2...
@@ -483,6 +485,7 @@ def plc (options,index) :
         'PLC_ROOT_USER' : 'root@test.onelab.eu',
         'PLC_ROOT_PASSWORD' : 'test++',
         'PLC_SLICE_PREFIX' : 'auto',
+        'PLC_HRN_ROOT': sfa_root(index),
         'PLC_SHORTNAME' : 'Rlab',
         'PLC_MAIL_ENABLED':'false',
         'PLC_MAIL_SUPPORT_ADDRESS' : 'thierry.parmentelat@inria.fr',