From 4d1299d67883a2e1c8cf5884cd156fd76db4b7cf Mon Sep 17 00:00:00 2001 From: Marc Bonnici Date: Fri, 20 Sep 2019 15:56:02 +0100 Subject: [PATCH] Target: Allow for any `TargetError` when checking for root On some unrooted devices the checking of root status can cause other error types, therefore update `except` statement to accommodate these. --- devlib/target.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/devlib/target.py b/devlib/target.py index 94c21d0..8fc0e8e 100644 --- a/devlib/target.py +++ b/devlib/target.py @@ -46,7 +46,8 @@ from devlib.module import get_module from devlib.platform import Platform from devlib.exception import (DevlibTransientError, TargetStableError, TargetNotRespondingError, TimeoutError, - TargetTransientError, KernelConfigKeyError) # pylint: disable=redefined-builtin + TargetTransientError, KernelConfigKeyError, + TargetError) # pylint: disable=redefined-builtin from devlib.utils.ssh import SshConnection from devlib.utils.android import AdbConnection, AndroidProperties, LogcatMonitor, adb_command, adb_disconnect, INTENT_FLAGS from devlib.utils.misc import memoized, isiterable, convert_new_lines @@ -116,7 +117,7 @@ class Target(object): try: self.execute('ls /', timeout=5, as_root=True) self._is_rooted = True - except (TargetStableError, TimeoutError): + except(TargetError, TimeoutError): self._is_rooted = False return self._is_rooted or self.connected_as_root