diff --git a/selfprivacy_api/migrations/update_services_flake_list.py b/selfprivacy_api/migrations/update_services_flake_list.py index 02671e8..88f7307 100644 --- a/selfprivacy_api/migrations/update_services_flake_list.py +++ b/selfprivacy_api/migrations/update_services_flake_list.py @@ -3,17 +3,6 @@ from selfprivacy_api.jobs import JobStatus, Jobs from selfprivacy_api.services.flake_service_manager import FlakeServiceManager -CORRECT_SERVICES_LIST = { - "bitwarden": "git+https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-config.git?ref=flakes&dir=sp-modules/bitwarden", - "gitea": "git+https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-config.git?ref=flakes&dir=sp-modules/gitea", - "jitsi-meet": "git+https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-config.git?ref=flakes&dir=sp-modules/jitsi-meet", - "nextcloud": "git+https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-config.git?ref=flakes&dir=sp-modules/nextcloud", - "ocserv": "git+https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-config.git?ref=flakes&dir=sp-modules/ocserv", - "pleroma": "git+https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-config.git?ref=flakes&dir=sp-modules/pleroma", - "simple-nixos-mailserver": "git+https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-config.git?ref=flakes&dir=sp-modules/simple-nixos-mailserver", - "roundcube": "git+https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-config.git?ref=flakes&dir=sp-modules/roundcube", -} - class UpdateServicesFlakeList(Migration): """Check if all required services are in the flake list""" @@ -25,12 +14,13 @@ class UpdateServicesFlakeList(Migration): return "Check if all required services are in the flake list" def is_migration_needed(self): - for key, value in manager.services.items(): - if key not in CORRECT_SERVICES_LIST: + with FlakeServiceManager() as manager: + if "roundcube" not in manager.services: return True def migrate(self): - with FlakeServiceManager: - for key, value in CORRECT_SERVICES_LIST.items(): - if key not in manager.services: - manager.services[key] = value + with FlakeServiceManager() as manager: + if "roundcube" not in manager.services: + manager.services[ + "roundcube" + ] = "git+https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-config.git?ref=flakes&dir=sp-modules/roundcube"