From 84729382ea5f689e5b9991c72f31af262f5cd82d Mon Sep 17 00:00:00 2001 From: Inex Code Date: Mon, 23 Dec 2024 23:02:24 +0300 Subject: [PATCH] feat: Allow turning on new services even from older clients --- selfprivacy_api/services/templated_service.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/selfprivacy_api/services/templated_service.py b/selfprivacy_api/services/templated_service.py index 8abdf17..6ee5195 100644 --- a/selfprivacy_api/services/templated_service.py +++ b/selfprivacy_api/services/templated_service.py @@ -294,6 +294,18 @@ class TemplatedService(Service): def enable(self): """Enable the service. Usually this means enabling systemd unit.""" + if "location" in self.options: + name = self.get_id() + with WriteUserData() as user_data: + if "modules" not in user_data: + user_data["modules"] = {} + if name not in user_data["modules"]: + user_data["modules"][name] = {} + if "location" not in user_data["modules"][name]: + user_data["modules"][name]["location"] = ( + BlockDevices().get_root_block_device().name + ) + self._set_enable(True) def disable(self):