decidedly
[tests.git] / system / TestMapper.py
index 8b9e915..7d0547f 100644 (file)
@@ -1,11 +1,12 @@
 #
-# Thierry Parmentelat - INRIA Sophia Antipolis 
+# Thierry Parmentelat <thierry.parmentelat@inria.fr>
+# Copyright (C) 2010 INRIA 
+#
 #
 # mapper class
 # 
 # this works on a spec as defined in a config file
-# and allows to remap various fields, typically to another testbox 
-# see an example in config_onelab_testbox32.py
+# and allows to remap various fields on the local substrate
 # 
 
 import utils
@@ -35,7 +36,7 @@ class TestMapper:
     def apply_first_map (self, type, name, obj, maplist):
         for (map_pattern,rename_dict) in maplist:
             if utils.match (name,map_pattern):
-                if not self.options.quiet:
+                if self.options.verbose:
                     utils.header("TestMapper/%s : applying rules '%s' on %s"%(type,map_pattern,name))
                 for (k,v) in rename_dict.iteritems():
                     # apply : separator
@@ -45,20 +46,23 @@ class TestMapper:
                     for step in path[:-1]:
                         if not o.has_key(step):
                             o[step]={}
-                            if not self.options.quiet:
+                            if self.options.verbose:
                                 utils.header ("WARNING : created step %s in path %s on %s %s"%(
                                         step,path,type,name))
                         o=o[step]
                     # last step is the one for side-effect
                     step=path[-1]
-                    if not self.options.quiet:
+                    if self.options.verbose:
                         if not o.has_key(step):
                             utils.header ("WARNING : inserting key %s for path %s on %s %s"%(
                                     step,path,type,name))
                     # apply formatting if '%s' found in the value
+                    if v is None:
+                        if self.options.verbose: print "TestMapper WARNING - None value - ignored, key=",k
+                        continue
                     if v.find('%s')>=0:
                         v=v%obj[k]
-                    if not self.options.quiet:
+                    if self.options.verbose:
                         print("TestMapper, rewriting %s: %s into %s"%(name,k,v))
                     o[step]=v
                 # only apply first rule