From 0207b5a4734c5daba840b347e9d639ebfde6b82b Mon Sep 17 00:00:00 2001 From: Houkime <> Date: Mon, 17 Apr 2023 12:54:21 +0000 Subject: [PATCH] fix(services): use get_foldername() for moving around --- selfprivacy_api/services/bitwarden/__init__.py | 2 +- selfprivacy_api/services/gitea/__init__.py | 2 +- selfprivacy_api/services/service.py | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/selfprivacy_api/services/bitwarden/__init__.py b/selfprivacy_api/services/bitwarden/__init__.py index a3ed94e..90763bd 100644 --- a/selfprivacy_api/services/bitwarden/__init__.py +++ b/selfprivacy_api/services/bitwarden/__init__.py @@ -160,7 +160,7 @@ class Bitwarden(Service): job, [ FolderMoveNames( - name="bitwarden", + name=Bitwarden.get_foldername(folder), bind_location=folder, group="vaultwarden", owner="vaultwarden", diff --git a/selfprivacy_api/services/gitea/__init__.py b/selfprivacy_api/services/gitea/__init__.py index de7d858..a07ccd1 100644 --- a/selfprivacy_api/services/gitea/__init__.py +++ b/selfprivacy_api/services/gitea/__init__.py @@ -158,7 +158,7 @@ class Gitea(Service): job, [ FolderMoveNames( - name="gitea", + name=Gitea.get_foldername(folder), bind_location=folder, group="gitea", owner="gitea", diff --git a/selfprivacy_api/services/service.py b/selfprivacy_api/services/service.py index 9a7663a..9ca8eba 100644 --- a/selfprivacy_api/services/service.py +++ b/selfprivacy_api/services/service.py @@ -140,6 +140,10 @@ class Service(ABC): # def get_folders() -> str: # pass + @staticmethod + def get_foldername(path: str) -> str: + return path.split("/")[-1] + @abstractmethod def move_to_volume(self, volume: BlockDevice) -> Job: pass