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:
parent
0465a75c56
commit
5bda1c0eee
@ -25,8 +25,10 @@ from pipes import quote
|
|||||||
from devlib.exception import TargetTransientError, TargetStableError
|
from devlib.exception import TargetTransientError, TargetStableError
|
||||||
from devlib.utils.misc import check_output
|
from devlib.utils.misc import check_output
|
||||||
|
|
||||||
|
|
||||||
PACKAGE_BIN_DIRECTORY = os.path.join(os.path.dirname(__file__), 'bin')
|
PACKAGE_BIN_DIRECTORY = os.path.join(os.path.dirname(__file__), 'bin')
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=redefined-outer-name
|
# pylint: disable=redefined-outer-name
|
||||||
def kill_children(pid, signal=signal.SIGKILL):
|
def kill_children(pid, signal=signal.SIGKILL):
|
||||||
with open('/proc/{0}/task/{0}/children'.format(pid), 'r') as fd:
|
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)
|
kill_children(cpid, signal)
|
||||||
os.kill(cpid, signal)
|
os.kill(cpid, signal)
|
||||||
|
|
||||||
|
|
||||||
class LocalConnection(object):
|
class LocalConnection(object):
|
||||||
|
|
||||||
name = 'local'
|
name = 'local'
|
||||||
|
host = 'localhost'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def connected_as_root(self):
|
def connected_as_root(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user