From 1bb539c514330c6964f2aa4885ac7726d94a8ca3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Quentin=20Th=C3=A9bault?= Date: Mon, 23 Sep 2024 09:54:38 +0900 Subject: [PATCH] update ioc_json.py - fix location logic --- iocage_lib/ioc_json.py | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/iocage_lib/ioc_json.py b/iocage_lib/ioc_json.py index a3edbce3..0636edf5 100644 --- a/iocage_lib/ioc_json.py +++ b/iocage_lib/ioc_json.py @@ -1868,18 +1868,17 @@ def json_set_value(self, prop, _import=False, default=False): conf["type"] = "template" - self.location = new_location.lstrip( + if self.zpool.prefix == '': + self.location = new_location.lstrip(self.pool) + else: + self.location = new_location.lstrip( os.path.join(self.zpool.name, self.zpool.prefix) - ).replace( + ) + self.location = self.location.replace( "/iocage", self.iocroot ) print('new_location=', new_location) - print('lstrip=', new_location.lstrip( - os.path.join(self.zpool.name, self.zpool.prefix) - ) - ) - print('iocroot=', self.iocroot) - print('location=', self.location) + print('location=', location) iocage_lib.ioc_common.logit( { @@ -1901,12 +1900,16 @@ def json_set_value(self, prop, _import=False, default=False): ds = Dataset(new_location) ds.rename(old_location, {'force_unmount': True}) conf["type"] = "jail" - self.location = old_location.lstrip( + if self.zpool.prefix == '': + self.location = old_location.lstrip(self.pool) + else: + self.location = old_location.lstrip( os.path.join(self.zpool.name, self.zpool.prefix) - ).replace( + ) + self.location = self.location.replace( "/iocage", self.iocroot ) - print('location 1903=', self.location) + print('location 1912=', self.location) ds.set_property('readonly', 'off') self.json_check_prop(key, value, conf, default)