run_node: add label to RunNode class

this allows specifying a label on each run node that can be used
to filter/select specific nodes.

Change-Id: Ib6a977007f56d6ff9ff029aaf049a75fb5d5e1dd
This commit is contained in:
Andre Puschmann 2021-03-10 20:32:45 +01:00 committed by Pau Espin Pedrol
parent 001ca8595d
commit 3fc74d353a
1 changed files with 8 additions and 3 deletions

View File

@ -30,13 +30,14 @@ class RunNode(log.Origin):
T_LOCAL = 'local'
T_REM_SSH = 'ssh'
def __init__(self, type=None, run_addr=None, ssh_user=None, ssh_addr=None, run_label=None, ssh_port=None, adb_serial_id=None):
def __init__(self, type=None, run_addr=None, ssh_user=None, ssh_addr=None, run_label=None, label=None, ssh_port=None, adb_serial_id=None):
super().__init__(log.C_RUN, 'runnode')
self._type = type
self._run_addr = run_addr
self._ssh_user = ssh_user
self._ssh_addr = ssh_addr
self._run_label = run_label
self._label = label
self._ssh_port = ssh_port
self._adb_serial_id = adb_serial_id
if not self._type:
@ -57,8 +58,8 @@ class RunNode(log.Origin):
def from_conf(cls, conf):
return cls(conf.get('run_type', None), conf.get('run_addr', None),
conf.get('ssh_user', None), conf.get('ssh_addr', None),
conf.get('run_label', None), conf.get('ssh_port', None),
conf.get('adb_serial_id', None))
conf.get('run_label', None), conf.get('label', None),
conf.get('ssh_port', None), conf.get('adb_serial_id', None))
@classmethod
def schema(cls):
@ -68,6 +69,7 @@ class RunNode(log.Origin):
'ssh_user': schema.STR,
'ssh_addr': schema.IPV4,
'run_label': schema.STR,
'label': schema.STR,
'ssh_port': schema.STR,
'adb_serial_id': schema.STR,
}
@ -94,6 +96,9 @@ class RunNode(log.Origin):
def run_label(self):
return self._run_label
def label(self):
return self._label
def ssh_port(self):
return self._ssh_port