Commit 73fb4d7c authored by dobli's avatar dobli
Browse files

Use proper escape for backslashes and enable service

parent 03917724
...@@ -1505,12 +1505,18 @@ def device_link_menu(base_dir): ...@@ -1505,12 +1505,18 @@ def device_link_menu(base_dir):
""" """
machine = docker_client_prompt(" to link device on") machine = docker_client_prompt(" to link device on")
device = qust.select("What device should be linked?", device = qust.select("What device should be linked?",
choices=USB_DEVICES).ask() choices=USB_DEVICES, style=st).ask()
# Start systemd service that ensures link
link_cmd = f"sudo systemctl start swarm-device@" + \ # Start systemd service that ensures link (escapes of backslash needed)
f"{device}\\\\x20openhab.service" link_cmd_start = f"sudo systemctl status swarm-device@" + \
execute_command_on_machine(link_cmd, machine) f"{device}\\\\\\\\x20openhab.service"
print(f"Linked device {device} to openHAB service") link_cmd_enable = f"sudo systemctl status swarm-device@" + \
f"{device}\\\\\\\\x20openhab.service"
# Needs enable to keep after reboot
execute_command_on_machine(link_cmd_start, machine)
execute_command_on_machine(link_cmd_enable, machine)
print(f"Linked device {device} to openHAB service on machine {machine}")
# *** Menu Helper Functions *** # *** Menu Helper Functions ***
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment