mirror of
https://github.com/ARM-software/devlib.git
synced 2025-01-31 10:10:46 +00:00
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.
This commit is contained in:
parent
d4f3316120
commit
4d1299d678
@ -46,7 +46,8 @@ from devlib.module import get_module
|
|||||||
from devlib.platform import Platform
|
from devlib.platform import Platform
|
||||||
from devlib.exception import (DevlibTransientError, TargetStableError,
|
from devlib.exception import (DevlibTransientError, TargetStableError,
|
||||||
TargetNotRespondingError, TimeoutError,
|
TargetNotRespondingError, TimeoutError,
|
||||||
TargetTransientError, KernelConfigKeyError) # pylint: disable=redefined-builtin
|
TargetTransientError, KernelConfigKeyError,
|
||||||
|
TargetError) # pylint: disable=redefined-builtin
|
||||||
from devlib.utils.ssh import SshConnection
|
from devlib.utils.ssh import SshConnection
|
||||||
from devlib.utils.android import AdbConnection, AndroidProperties, LogcatMonitor, adb_command, adb_disconnect, INTENT_FLAGS
|
from devlib.utils.android import AdbConnection, AndroidProperties, LogcatMonitor, adb_command, adb_disconnect, INTENT_FLAGS
|
||||||
from devlib.utils.misc import memoized, isiterable, convert_new_lines
|
from devlib.utils.misc import memoized, isiterable, convert_new_lines
|
||||||
@ -116,7 +117,7 @@ class Target(object):
|
|||||||
try:
|
try:
|
||||||
self.execute('ls /', timeout=5, as_root=True)
|
self.execute('ls /', timeout=5, as_root=True)
|
||||||
self._is_rooted = True
|
self._is_rooted = True
|
||||||
except (TargetStableError, TimeoutError):
|
except(TargetError, TimeoutError):
|
||||||
self._is_rooted = False
|
self._is_rooted = False
|
||||||
|
|
||||||
return self._is_rooted or self.connected_as_root
|
return self._is_rooted or self.connected_as_root
|
||||||
|
Loading…
x
Reference in New Issue
Block a user