Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #1283 disable new config #1343

Merged
merged 2 commits into from
Dec 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions sarracenia/sr.py
Original file line number Diff line number Diff line change
Expand Up @@ -1608,15 +1608,23 @@ 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)

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'

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):
Expand Down
Loading