[autotest] Handle AutoservRunError when power_supply_info is not found.

For devices that do not have power_supply_info installed, the exception
should be handled to avoid false failure on verify.

BUG=chrome-os-partner:34022
TEST=local verification.

Change-Id: I449d7c9b55307e9510ccb40d341c6b14f9cade0f
Reviewed-on: https://chromium-review.googlesource.com/237961
Trybot-Ready: Dan Shi <dshi@chromium.org>
Tested-by: Dan Shi <dshi@chromium.org>
Reviewed-by: Daniel Erat <derat@chromium.org>
Commit-Queue: Dan Shi <dshi@chromium.org>
diff --git a/server/hosts/cros_host.py b/server/hosts/cros_host.py
index 94e9751..91e9178 100644
--- a/server/hosts/cros_host.py
+++ b/server/hosts/cros_host.py
@@ -1347,6 +1347,9 @@
         @return: The dictionary of power_supply_info, e.g.,
                  {'Line Power': {'online': 'yes', 'type': 'main'},
                   'Battery': {'vendor': 'xyz', 'percentage': '100'}}
+        @raise error.AutoservRunError if power_supply_info tool is not found in
+               the DUT. Caller should handle this error to avoid false failure
+               on verification.
         """
         result = self.run('power_supply_info').stdout.strip()
         info = {}
@@ -1378,7 +1381,7 @@
             info = self.get_power_supply_info()
             logging.info(info)
             return float(info['Battery']['percentage'])
-        except KeyError, ValueError:
+        except (KeyError, ValueError, error.AutoservRunError):
             return None
 
 
@@ -1390,8 +1393,8 @@
         try:
             info = self.get_power_supply_info()
             return info['Line Power']['online'] == 'yes'
-        except KeyError:
-            return False
+        except (KeyError, error.AutoservRunError):
+            return None
 
 
     def _cleanup_poweron(self):
@@ -1585,8 +1588,12 @@
         2. Is power adapter connected.
         """
         logging.info('Battery percentage: %s', self.get_battery_percentage())
-        logging.info('Device %s power adapter connected and charging.',
-                     'has' if self.is_ac_connected() else 'does not have')
+        if self.is_ac_connected() is None:
+            logging.info('Can not determine if the device has power adapter '
+                         'connected.')
+        else:
+            logging.info('Device %s power adapter connected and charging.',
+                         'has' if self.is_ac_connected() else 'does not have')
 
 
     def make_ssh_command(self, user='root', port=22, opts='', hosts_file=None,