Enhance dut-control error processing

When dut-control is passed a non existent parameter name or an
inappropriate parameter value, it generates a Python stack trace which
is sometimes too much to digest.

This change suggests to add some exception processing to make sure
that error messages are more succinct. ServoClientError class is
enhanced to process xmlrpclib.Fault error string to filter out the
actual error message.

A wrapper main() function is added to make it easier to install the
exception handler.

   . install the updated version of dut-control (while in chroot):

     cros_workon --host start hdctools
     sudo emerge hdctools

   . try running dut-control with bogus parameters

   $ dut-control pwren_gatex
   Problem getting 'pwren_gatex' :: No control named pwren_gatex
   $ dut-control -i pwren_gatex
   Problem docstring 'pwren_gatex' :: No control pwren_gatex
   $ dut-control rec_mode:xyz
   Problem setting 'rec_mode' to 'xyz' :: Map onoff_i doesn't contain key xyz

  . verify that is still works otherwise:

   $ dut-control cpu_uart_en
   $ dut-control cpu_uart_en:on

   $ dut-control cpu_uart_en

Change-Id: I2b02508fee858201d882bbe09985597eb92c8776
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/26194
1 file changed