Handle string conversion of remote methods and better logging.
Since we turn off allow_dotted_names option on XML RPC server. So any string
conversion, like str(FAFTClient.method), i.e. FAFTClient.method.__str__, failed
via XML RPC call. We printed a fixed string "<remote_method>" before.
We now create the _dispatch() method to handle this case.
BUG=chromium-os:22598
TEST=run_remote_tests.sh --remote=$REMOTE_IP -a "xml_config=$OVERLAY_XML \
servo_vid=0x18d1 servo_pid=0x5001" TryFwB/control.normal
Change-Id: I26a646636752aa758416b383ffff78d967e20012
Reviewed-on: https://gerrit.chromium.org/gerrit/12664
Commit-Ready: Tom Wai-Hong Tam <waihong@chromium.org>
Reviewed-by: Tom Wai-Hong Tam <waihong@chromium.org>
Tested-by: Tom Wai-Hong Tam <waihong@chromium.org>
diff --git a/server/cros/faftsequence.py b/server/cros/faftsequence.py
index 7a44a5e..c809405 100644
--- a/server/cros/faftsequence.py
+++ b/server/cros/faftsequence.py
@@ -484,25 +484,6 @@
self.servo.warm_reset()
- def _str_action(self, action):
- """Convert the action function into a readable string.
-
- The simple str() doesn't work on remote objects since we disable
- allow_dotted_names flag when we launch the SimpleXMLRPCServer.
- So this function handles the exception in this case.
-
- Args:
- action: A function.
-
- Returns:
- A readable string.
- """
- try:
- return str(action)
- except xmlrpclib.Fault:
- return '<remote method>'
-
-
def _call_action(self, action_tuple):
"""Call the action function with/without arguments.
@@ -518,7 +499,7 @@
args = action_tuple[1:]
if callable(action):
logging.info('calling %s with parameter %s' % (
- self._str_action(action), str(action_tuple[1])))
+ str(action), str(action_tuple[1])))
return action(*args)
else:
logging.info('action is not callable!')
@@ -526,7 +507,7 @@
action = action_tuple
if action is not None:
if callable(action):
- logging.info('calling %s' % self._str_action(action))
+ logging.info('calling %s' % str(action))
return action()
else:
logging.info('action is not callable!')
@@ -593,6 +574,10 @@
def run_faft_sequence(self):
"""Run FAFT sequence which was previously registered."""
sequence = self._faft_sequence
+ index = 1
for step in sequence:
+ logging.info('======== Running FAFT sequence step %d ========' %
+ index)
# Don't reboot in the last step.
self.run_faft_step(step, no_reboot=(step is sequence[-1]))
+ index += 1