Skip to content

Commit 9280f5f

Browse files
authored
Merge pull request labgrid-project#1794 from vzlu/minor-helper-updates
Minor helper updates
2 parents cb7b04f + 5e4119a commit 9280f5f

4 files changed

Lines changed: 14 additions & 5 deletions

File tree

contrib/systemd/labgrid-exporter.service

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ EnvironmentFile=-/etc/environment
1111
ExecStart=/path/to/labgrid/venv/bin/labgrid-exporter /etc/labgrid/exporter.yaml
1212
Restart=always
1313
RestartSec=30
14+
# Replace 'DynamicUser=yes' with 'User=labgrid' and 'Group=labgrid' when using labgrid helpers with sudo.
1415
DynamicUser=yes
1516
# Adjust to your distribution (most often "dialout" or "tty")
1617
SupplementaryGroups=dialout plugdev

doc/getting_started.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,15 @@ Follow these instructions to install the systemd files on your machine(s):
379379
installation paths of your distribution.
380380
#. Adapt the ``ExecStart`` paths of the service files to the respective Python
381381
virtual environments of the coordinator and exporter.
382+
#. If you use labgrid helpers (see :file:`helpers/`) with sudo on exporter,
383+
replace ``DynamicUser`` with ``User`` and ``Group`` in the
384+
:file:`labgrid-exporter.service`:
385+
386+
.. code-block::
387+
388+
User=labgrid
389+
Group=labgrid
390+
382391
#. Adjust the ``SupplementaryGroups`` option in the
383392
:file:`labgrid-exporter.service` file to your distribution so that the
384393
exporter gains read and write access on TTY devices (for ``ser2net``); most

helpers/labgrid-bound-connect

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python3
1+
#!/usr/bin/python3
22

33
# This is intended to be used via sudo. For example, add via visudo:
44
# %developers ALL = NOPASSWD: /usr/local/sbin/labgrid-bound-connect
@@ -15,7 +15,7 @@ def main(ifname, address, port):
1515
raise ValueError("Empty interface name.")
1616
if any((c == "/" or c.isspace()) for c in ifname):
1717
raise ValueError(f"Interface name '{ifname}' contains invalid characters.")
18-
if len(ifname) > 16:
18+
if len(ifname) > 15:
1919
raise ValueError(f"Interface name '{ifname}' is too long.")
2020

2121
address = ipaddress.ip_address(address)
@@ -36,7 +36,7 @@ def main(ifname, address, port):
3636
raise RuntimeError(f"Invalid IP version '{address.version}'")
3737

3838
# Delete the IP lookup cache for the address in case it is stale
39-
subprocess.run(["ip", "neigh", "del", str(address), "dev", ifname],
39+
subprocess.run(["ip", "neigh", "del", str(address), "dev", ifname],
4040
stdout=subprocess.DEVNULL,
4141
stderr=subprocess.DEVNULL
4242
)
@@ -78,4 +78,3 @@ if __name__ == "__main__":
7878
import traceback
7979
traceback.print_exc()
8080
print(f"ERROR: {e}", file=sys.stderr)
81-

helpers/labgrid-raw-interface

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def main(program, options):
3838
raise ValueError("Empty interface name.")
3939
if any((c == "/" or c.isspace()) for c in options.ifname):
4040
raise ValueError(f"Interface name '{options.ifname}' contains invalid characters.")
41-
if len(options.ifname) > 16:
41+
if len(options.ifname) > 15:
4242
raise ValueError(f"Interface name '{options.ifname}' is too long.")
4343

4444
denylist = get_denylist()

0 commit comments

Comments
 (0)