1
0
mirror of https://github.com/checktheroads/hyperglass synced 2024-05-11 05:55:08 +00:00

github actions ci additions [skip ci]

This commit is contained in:
checktheroads
2021-01-01 14:23:15 -07:00
parent 925a9ad334
commit a4f041469a
4 changed files with 111 additions and 23 deletions

View File

@@ -383,19 +383,9 @@ def migrate_static_assets(app_path):
callback(msg, a=a, b=b)
def install_systemd(app_path):
"""Installs generated systemd file to system's systemd directory.
def install_systemd(app_path: Path) -> bool:
"""Installs generated systemd file to system's systemd directory."""
Arguments:
app_path {Path} -- hyperglass runtime path
Raises:
ClickException: Raised if the /etc/systemd/system does not exist
ClickException: Raised if the symlinked file does not exit
Returns:
{bool} -- True if successful
"""
service = app_path / "hyperglass.service"
systemd = Path("/etc/systemd/system")
installed = systemd / "hyperglass.service"
@@ -403,12 +393,16 @@ def install_systemd(app_path):
if not systemd.exists():
error("{e} does not exist. Unable to install systemd service.", e=systemd)
installed.symlink_to(service)
try:
installed.symlink_to(service)
if not installed.exists():
warning("Unable to symlink {s} to {d}", s=service, d=installed)
else:
success("Symlinked {s} to {d}", s=service, d=installed)
if not installed.exists():
error("Unable to symlink {s} to {d}", s=service, d=installed)
except PermissionError:
warning("Permission denied to {f}. Systemd service not installed.", f=installed)
success("Symlinked {s} to {d}", s=service, d=installed)
return True