nix-servo/fast-servo/linien-server-cli.patch

74 lines
3.2 KiB
Diff

diff --git a/linien-client/linien_client/deploy.py b/linien-client/linien_client/deploy.py
index 7355cc3..876f1ec 100644
--- a/linien-client/linien_client/deploy.py
+++ b/linien-client/linien_client/deploy.py
@@ -83,14 +83,14 @@ def start_remote_server(
if (local_version != remote_version) and not ("dev" in local_version):
raise InvalidServerVersionException(local_version, remote_version)
- logger.debug("Sending credentials")
- conn.run(
- 'python3 -c "from linien_common.communication import write_hash_to_file;'
- f"write_hash_to_file('{hash_username_and_password(device.username, device.password)}')\"", # noqa E501
- out_stream=out_stream,
- err_stream=out_stream,
- warn=True,
- )
+ # logger.debug("Sending credentials")
+ # conn.run(
+ # 'python3 -c "from linien_common.communication import write_hash_to_file;'
+ # f"write_hash_to_file('{hash_username_and_password(device.username, device.password)}')\"", # noqa E501
+ # out_stream=out_stream,
+ # err_stream=out_stream,
+ # warn=True,
+ # )
logger.debug("Starting server")
conn.run(
diff --git a/linien-server/linien_server/cli.py b/linien-server/linien_server/cli.py
index 7781c74..827d04f 100644
--- a/linien-server/linien_server/cli.py
+++ b/linien-server/linien_server/cli.py
@@ -44,20 +44,19 @@ class LinienServerCLI:
def start(self) -> None:
"""Start the Linien server as a systemd service."""
- copy_systemd_service_file()
logger.info("Starting Linien server")
- subprocess.run(["systemctl", "start", "linien-server.service"])
+ subprocess.run(["sv", "up", "/etc/service/linien-server"])
logger.info("Started Linien server")
def stop(self) -> None:
"""Stop the Linien server running as a systemd service."""
logger.info("Stopping Linien server")
- subprocess.run(["systemctl", "stop", "linien-server.service"])
+ subprocess.run(["sv", "down", "/etc/service/linien-server"])
logger.info("Stopped Linien server")
def status(self) -> None:
"""Check the status of the Linien server."""
- subprocess.run(["journalctl", "-u", "linien-server.service"])
+ subprocess.run(["sv", "status", "/etc/service/linien-server"])
def run(self, fake: bool = False, host: Optional[str] = None) -> None:
"""
@@ -89,15 +88,14 @@ class LinienServerCLI:
def enable(self) -> None:
"""Enable the Linien server to start on boot."""
- copy_systemd_service_file()
logger.info("Enabling Linien server")
- subprocess.run(["systemctl", "enable", "linien-server.service"])
+ subprocess.run(["rm", "/etc/service/linien-server/down"])
logger.info("Enabled Linien server")
def disable(self) -> None:
"""Disable the Linien server from starting on boot."""
logger.info("Disabling Linien server")
- subprocess.run(["systemctl", "disable", "linien-server.service"])
+ subprocess.run(["touch", "/etc/service/linien-server/down"])
logger.info("Disabled Linien server")