feat: Allow turning on new services even from older clients

This commit is contained in:
Inex Code 2024-12-23 23:02:24 +03:00
parent bab2f17581
commit 84729382ea
No known key found for this signature in database

View file

@ -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):