fix(services): ocserv and jitsi were returning wrong volumes too
parent
3bff43a6bf
commit
6660e1d9d5
|
@ -3,16 +3,13 @@ import base64
|
||||||
import subprocess
|
import subprocess
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
from selfprivacy_api.jobs import Job, Jobs
|
from selfprivacy_api.jobs import Job
|
||||||
from selfprivacy_api.services.generic_service_mover import FolderMoveNames, move_service
|
|
||||||
from selfprivacy_api.services.generic_status_getter import (
|
from selfprivacy_api.services.generic_status_getter import (
|
||||||
get_service_status,
|
|
||||||
get_service_status_from_several_units,
|
get_service_status_from_several_units,
|
||||||
)
|
)
|
||||||
from selfprivacy_api.services.service import Service, ServiceDnsRecord, ServiceStatus
|
from selfprivacy_api.services.service import Service, ServiceDnsRecord, ServiceStatus
|
||||||
from selfprivacy_api.utils import ReadUserData, WriteUserData, get_domain
|
from selfprivacy_api.utils import ReadUserData, WriteUserData, get_domain
|
||||||
from selfprivacy_api.utils.block_devices import BlockDevice
|
from selfprivacy_api.utils.block_devices import BlockDevice, BlockDevices
|
||||||
from selfprivacy_api.utils.huey import huey
|
|
||||||
import selfprivacy_api.utils.network as network_utils
|
import selfprivacy_api.utils.network as network_utils
|
||||||
from selfprivacy_api.services.jitsi.icon import JITSI_ICON
|
from selfprivacy_api.services.jitsi.icon import JITSI_ICON
|
||||||
|
|
||||||
|
@ -87,18 +84,27 @@ class Jitsi(Service):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def stop():
|
def stop():
|
||||||
subprocess.run(["systemctl", "stop", "jitsi-videobridge.service"])
|
subprocess.run(
|
||||||
subprocess.run(["systemctl", "stop", "jicofo.service"])
|
["systemctl", "stop", "jitsi-videobridge.service"],
|
||||||
|
check=False,
|
||||||
|
)
|
||||||
|
subprocess.run(["systemctl", "stop", "jicofo.service"], check=False)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def start():
|
def start():
|
||||||
subprocess.run(["systemctl", "start", "jitsi-videobridge.service"])
|
subprocess.run(
|
||||||
subprocess.run(["systemctl", "start", "jicofo.service"])
|
["systemctl", "start", "jitsi-videobridge.service"],
|
||||||
|
check=False,
|
||||||
|
)
|
||||||
|
subprocess.run(["systemctl", "start", "jicofo.service"], check=False)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def restart():
|
def restart():
|
||||||
subprocess.run(["systemctl", "restart", "jitsi-videobridge.service"])
|
subprocess.run(
|
||||||
subprocess.run(["systemctl", "restart", "jicofo.service"])
|
["systemctl", "restart", "jitsi-videobridge.service"],
|
||||||
|
check=False,
|
||||||
|
)
|
||||||
|
subprocess.run(["systemctl", "restart", "jicofo.service"], check=False)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_configuration():
|
def get_configuration():
|
||||||
|
@ -118,7 +124,7 @@ class Jitsi(Service):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_drive() -> str:
|
def get_drive() -> str:
|
||||||
return "sda1"
|
return BlockDevices().get_root_block_device().name
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_dns_records() -> typing.List[ServiceDnsRecord]:
|
def get_dns_records() -> typing.List[ServiceDnsRecord]:
|
||||||
|
|
|
@ -2,12 +2,11 @@
|
||||||
import base64
|
import base64
|
||||||
import subprocess
|
import subprocess
|
||||||
import typing
|
import typing
|
||||||
from selfprivacy_api.jobs import Job, Jobs
|
from selfprivacy_api.jobs import Job
|
||||||
from selfprivacy_api.services.generic_service_mover import FolderMoveNames, move_service
|
|
||||||
from selfprivacy_api.services.generic_status_getter import get_service_status
|
from selfprivacy_api.services.generic_status_getter import get_service_status
|
||||||
from selfprivacy_api.services.service import Service, ServiceDnsRecord, ServiceStatus
|
from selfprivacy_api.services.service import Service, ServiceDnsRecord, ServiceStatus
|
||||||
from selfprivacy_api.utils import ReadUserData, WriteUserData
|
from selfprivacy_api.utils import ReadUserData, WriteUserData
|
||||||
from selfprivacy_api.utils.block_devices import BlockDevice
|
from selfprivacy_api.utils.block_devices import BlockDevice, BlockDevices
|
||||||
from selfprivacy_api.services.ocserv.icon import OCSERV_ICON
|
from selfprivacy_api.services.ocserv.icon import OCSERV_ICON
|
||||||
import selfprivacy_api.utils.network as network_utils
|
import selfprivacy_api.utils.network as network_utils
|
||||||
|
|
||||||
|
@ -77,15 +76,15 @@ class Ocserv(Service):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def stop():
|
def stop():
|
||||||
subprocess.run(["systemctl", "stop", "ocserv.service"])
|
subprocess.run(["systemctl", "stop", "ocserv.service"], check=False)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def start():
|
def start():
|
||||||
subprocess.run(["systemctl", "start", "ocserv.service"])
|
subprocess.run(["systemctl", "start", "ocserv.service"], check=False)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def restart():
|
def restart():
|
||||||
subprocess.run(["systemctl", "restart", "ocserv.service"])
|
subprocess.run(["systemctl", "restart", "ocserv.service"], check=False)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_configuration():
|
def get_configuration():
|
||||||
|
@ -101,7 +100,7 @@ class Ocserv(Service):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_drive() -> str:
|
def get_drive() -> str:
|
||||||
return "sda1"
|
return BlockDevices().get_root_block_device().name
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_dns_records() -> typing.List[ServiceDnsRecord]:
|
def get_dns_records() -> typing.List[ServiceDnsRecord]:
|
||||||
|
|
|
@ -218,3 +218,12 @@ class BlockDevices(metaclass=SingletonMetaclass):
|
||||||
if mountpoint in block_device.mountpoints:
|
if mountpoint in block_device.mountpoints:
|
||||||
block_devices.append(block_device)
|
block_devices.append(block_device)
|
||||||
return block_devices
|
return block_devices
|
||||||
|
|
||||||
|
def get_root_block_device(self) -> BlockDevice:
|
||||||
|
"""
|
||||||
|
Return the root block device.
|
||||||
|
"""
|
||||||
|
for block_device in self.block_devices:
|
||||||
|
if "/" in block_device.mountpoints:
|
||||||
|
return block_device
|
||||||
|
raise RuntimeError("No root block device found")
|
||||||
|
|
Loading…
Reference in New Issue