refactor(services): add get_folders() to the rest of the services

This commit is contained in:
Houkime 2023-04-17 13:47:49 +00:00
parent 0207b5a473
commit 8a4f256c12
5 changed files with 20 additions and 0 deletions

View file

@ -115,6 +115,10 @@ class Jitsi(Service):
storage_usage += get_storage_usage("/var/lib/jitsi-meet")
return storage_usage
@staticmethod
def get_folders() -> typing.List[str]:
return ["/var/lib/jitsi-meet"]
@staticmethod
def get_drive() -> str:
return "sda1"

View file

@ -100,6 +100,10 @@ class MailServer(Service):
def get_storage_usage() -> int:
return get_storage_usage("/var/vmail")
@staticmethod
def get_folders() -> typing.List[str]:
return ["/var/vmail", "/var/sieve"]
@staticmethod
def get_drive() -> str:
with utils.ReadUserData() as user_data:

View file

@ -122,6 +122,10 @@ class Nextcloud(Service):
"""
return get_storage_usage("/var/lib/nextcloud")
@staticmethod
def get_folders() -> typing.List[str]:
return ["/var/lib/nextcloud"]
@staticmethod
def get_drive() -> str:
"""Get the name of disk where Nextcloud is installed."""

View file

@ -117,5 +117,9 @@ class Ocserv(Service):
def get_storage_usage() -> int:
return 0
@staticmethod
def get_folders() -> typing.List[str]:
return []
def move_to_volume(self, volume: BlockDevice) -> Job:
raise NotImplementedError("ocserv service is not movable")

View file

@ -103,6 +103,10 @@ class Pleroma(Service):
storage_usage += get_storage_usage("/var/lib/postgresql")
return storage_usage
@staticmethod
def get_folders() -> typing.List[str]:
return ["/var/lib/pleroma", "/var/lib/postgresql"]
@staticmethod
def get_drive() -> str:
with ReadUserData() as user_data: