1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-01-31 02:00:45 +00:00

host: add host attribute to LocalConnection

Add a host attribute (hard-coded to "localhost") to LocalConnection to
make it easier to seamlessly swap it out with ssh connection.
This commit is contained in:
Sergei Trofimov 2020-01-09 16:45:44 +00:00 committed by Marc Bonnici
parent 0465a75c56
commit 5bda1c0eee

View File

@ -25,8 +25,10 @@ from pipes import quote
from devlib.exception import TargetTransientError, TargetStableError
from devlib.utils.misc import check_output
PACKAGE_BIN_DIRECTORY = os.path.join(os.path.dirname(__file__), 'bin')
# pylint: disable=redefined-outer-name
def kill_children(pid, signal=signal.SIGKILL):
with open('/proc/{0}/task/{0}/children'.format(pid), 'r') as fd:
@ -34,9 +36,11 @@ def kill_children(pid, signal=signal.SIGKILL):
kill_children(cpid, signal)
os.kill(cpid, signal)
class LocalConnection(object):
name = 'local'
host = 'localhost'
@property
def connected_as_root(self):