From bb4389165850cfe6a80efa4514fc116fe3f985d5 Mon Sep 17 00:00:00 2001 From: Peter Silva Date: Fri, 13 Dec 2024 09:08:51 -0500 Subject: [PATCH 1/2] fix #1283 disable new config --- sarracenia/sr.py | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/sarracenia/sr.py b/sarracenia/sr.py index 41f29d632..dbb431678 100755 --- a/sarracenia/sr.py +++ b/sarracenia/sr.py @@ -1608,15 +1608,25 @@ def disable(self): logging.error("cannot disable %s while it is running! " % f) continue - state_file_cfg = self.user_cache_dir + os.sep + c + os.sep + cfg - state_file_cfg_disabled = state_file_cfg + os.sep + 'disabled' - if os.path.exists(state_file_cfg_disabled): + if self.configs[c][cfg]['options'].statehost: + state_file_dir = self.user_cache_dir + os.sep + self.hostdir + os.sep + f.replace('/', os.sep) + else: + state_file_dir = self.user_cache_dir + os.sep + f.replace('/', os.sep) + + logger.critical( f"{state_file_dir=}" ) + if not os.path.isdir(state_file_dir): + os.makedirs(state_file_dir, exist_ok=True) + + state_file_disabled = state_file_dir + os.sep + 'disabled' + logger.critical( f"{state_file_disabled=}" ) + + if os.path.exists(state_file_disabled): logging.error("%s is already disabled! " % f) continue - if os.path.exists(state_file_cfg): - with open(state_file_cfg_disabled, 'w') as f: - f.write('') - logging.info(c + '/' + cfg) + + with open(state_file_disabled, 'w') as f: + f.write('') + logging.info(c + '/' + cfg) def edit(self): From c90d74c03053885772a45588d4cfb8bfededa074 Mon Sep 17 00:00:00 2001 From: Peter Silva Date: Fri, 13 Dec 2024 11:57:48 -0500 Subject: [PATCH 2/2] remove leftover debug prints, that would break on older OS --- sarracenia/sr.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/sarracenia/sr.py b/sarracenia/sr.py index dbb431678..2b9d05cc3 100755 --- a/sarracenia/sr.py +++ b/sarracenia/sr.py @@ -1613,12 +1613,10 @@ def disable(self): else: state_file_dir = self.user_cache_dir + os.sep + f.replace('/', os.sep) - logger.critical( f"{state_file_dir=}" ) if not os.path.isdir(state_file_dir): os.makedirs(state_file_dir, exist_ok=True) state_file_disabled = state_file_dir + os.sep + 'disabled' - logger.critical( f"{state_file_disabled=}" ) if os.path.exists(state_file_disabled): logging.error("%s is already disabled! " % f)