From 5bda1c0eee516d875b742820c66e5c93292c2a71 Mon Sep 17 00:00:00 2001 From: Sergei Trofimov Date: Thu, 9 Jan 2020 16:45:44 +0000 Subject: [PATCH] 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. --- devlib/host.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/devlib/host.py b/devlib/host.py index e040b16..11f48b9 100644 --- a/devlib/host.py +++ b/devlib/host.py @@ -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):