Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

agentwrapper: Allow specifying agent prefix #1584

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion labgrid/util/agentwrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,13 @@ def __init__(self, host=None):
agent = os.path.join(
os.path.abspath(os.path.dirname(__file__)),
'agent.py')
agent_prefix = os.environ.get("LG_AGENT_PREFIX", "")
if host:
# copy agent.py and run via ssh
with open(agent, 'rb') as agent_fd:
agent_data = agent_fd.read()
agent_hash = hashlib.sha256(agent_data).hexdigest()
agent_remote = f'.labgrid_agent_{agent_hash}.py'
agent_remote = os.path.join(agent_prefix, f'.labgrid_agent_{agent_hash}.py')
connect_timeout = get_ssh_connect_timeout()
ssh_opts = f'ssh -x -o ConnectTimeout={connect_timeout} -o PasswordAuthentication=no'.split()
subprocess.check_call(
Expand Down
4 changes: 4 additions & 0 deletions man/labgrid-client.1
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ CI pipelines where the username may not be consistent between pipeline stages.
.sp
Set the connection timeout when using SSH (The \fBConnectTimeout\fP option). If
unspecified, defaults to 30 seconds.
.SS LG_AGENT_PREFIX
.sp
Add a prefix to \fB\&.labgrid_agent_{agent_hash}.py\fP allowing specification for
where on the exporter it should be uploaded to.
.SH MATCHES
.sp
Match patterns are used to assign a resource to a specific place. The format is:
Expand Down
5 changes: 5 additions & 0 deletions man/labgrid-client.rst
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ LG_SSH_CONNECT_TIMEOUT
Set the connection timeout when using SSH (The ``ConnectTimeout`` option). If
unspecified, defaults to 30 seconds.

LG_AGENT_PREFIX
~~~~~~~~~~~~~~~~~~~~~~
Add a prefix to ``.labgrid_agent_{agent_hash}.py`` allowing specification for
where on the exporter it should be uploaded to.

MATCHES
-------
Match patterns are used to assign a resource to a specific place. The format is:
Expand Down