Use repr for showing invalid values, helps detecting type mismatches
[nepi.git] / src / nepi / core / testbed_impl.py
index 465a557..fd947c0 100644 (file)
@@ -238,10 +238,13 @@ class TestbedController(execute.TestbedController):
             
             # configure action
             factory = self._factories[factory_id]
-            if not getattr(factory, action):
+            if isinstance(action, basestring) and not getattr(factory, action):
                 continue
             def perform_action(guid):
-                getattr(factory, action)(self, guid)
+                if isinstance(action, basestring):
+                    getattr(factory, action)(self, guid)
+                else:
+                    action(self, guid)
                 if postaction:
                     postaction(self, guid)
 
@@ -257,6 +260,10 @@ class TestbedController(execute.TestbedController):
                 else:
                     logger.debug("Performing %s on %s", action, guid)
                     perform_action(guid)
+
+            # sync
+            if runner:
+                runner.sync()
             
             # post hook
             if poststep:
@@ -549,7 +556,7 @@ class TestbedController(execute.TestbedController):
 
     def _validate_testbed_value(self, name, value):
         if not self._attributes.is_attribute_value_valid(name, value):
-            raise AttributeError("Invalid value %s for testbed attribute %s" % \
+            raise AttributeError("Invalid value %r for testbed attribute %s" % \
                 (value, name))
 
     def _validate_box_attribute(self, guid, name):
@@ -561,7 +568,7 @@ class TestbedController(execute.TestbedController):
     def _validate_box_value(self, guid, name, value):
         factory = self._get_factory(guid)
         if not factory.box_attributes.is_attribute_value_valid(name, value):
-            raise AttributeError("Invalid value %s for attribute %s" % \
+            raise AttributeError("Invalid value %r for attribute %s" % \
                 (value, name))
 
     def _validate_factory_attribute(self, guid, name):
@@ -573,7 +580,7 @@ class TestbedController(execute.TestbedController):
     def _validate_factory_value(self, guid, name, value):
         factory = self._get_factory(guid)
         if not factory.is_attribute_value_valid(name, value):
-            raise AttributeError("Invalid value %s for attribute %s" % \
+            raise AttributeError("Invalid value %r for attribute %s" % \
                 (value, name))
 
     def _validate_trace(self, guid, trace_name):