Skip to content

Commit ed1d936

Browse files
Merge pull request #1584 from benjamin1313/agent-prefix
agentwrapper: Allow specifying agent prefix
2 parents 5ccf749 + a1141a3 commit ed1d936

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

labgrid/util/agentwrapper.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,13 @@ def __init__(self, host=None):
4646
agent = os.path.join(
4747
os.path.abspath(os.path.dirname(__file__)),
4848
'agent.py')
49+
agent_prefix = os.environ.get("LG_AGENT_PREFIX", "")
4950
if host:
5051
# copy agent.py and run via ssh
5152
with open(agent, 'rb') as agent_fd:
5253
agent_data = agent_fd.read()
5354
agent_hash = hashlib.sha256(agent_data).hexdigest()
54-
agent_remote = f'.labgrid_agent_{agent_hash}.py'
55+
agent_remote = os.path.join(agent_prefix, f'.labgrid_agent_{agent_hash}.py')
5556
connect_timeout = get_ssh_connect_timeout()
5657
ssh_opts = f'ssh -x -o ConnectTimeout={connect_timeout} -o PasswordAuthentication=no'.split()
5758
subprocess.check_call(

man/labgrid-client.1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ CI pipelines where the username may not be consistent between pipeline stages.
124124
.sp
125125
Set the connection timeout when using SSH (The \fBConnectTimeout\fP option). If
126126
unspecified, defaults to 30 seconds.
127+
.SS LG_AGENT_PREFIX
128+
.sp
129+
Add a prefix to \fB\&.labgrid_agent_{agent_hash}.py\fP allowing specification for
130+
where on the exporter it should be uploaded to.
127131
.SH MATCHES
128132
.sp
129133
Match patterns are used to assign a resource to a specific place. The format is:

man/labgrid-client.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,11 @@ LG_SSH_CONNECT_TIMEOUT
116116
Set the connection timeout when using SSH (The ``ConnectTimeout`` option). If
117117
unspecified, defaults to 30 seconds.
118118

119+
LG_AGENT_PREFIX
120+
~~~~~~~~~~~~~~~~~~~~~~
121+
Add a prefix to ``.labgrid_agent_{agent_hash}.py`` allowing specification for
122+
where on the exporter it should be uploaded to.
123+
119124
MATCHES
120125
-------
121126
Match patterns are used to assign a resource to a specific place. The format is:

0 commit comments

Comments
 (0)