From c8a958d6f0cf0146b5f577e32c9422c482a807c4 Mon Sep 17 00:00:00 2001 From: Peter Silva Date: Sat, 23 Mar 2024 16:06:41 -0400 Subject: [PATCH] fix #982 by checking for statehost in cleanup --- sarracenia/sr.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/sarracenia/sr.py b/sarracenia/sr.py index fc05a331c..ce859997a 100755 --- a/sarracenia/sr.py +++ b/sarracenia/sr.py @@ -1713,10 +1713,16 @@ def cleanup(self): del flow flow=None + # cleanup statefiles for f in self.filtered_configurations: if self.please_stop: break - cache_dir = self.user_cache_dir + os.sep + f.replace('/', os.sep) + + if self.configs[c][cfg]['options'].statehost: + cache_dir = self.user_cache_dir + os.sep + self.hostname + os.sep + f.replace('/', os.sep) + else: + cache_dir = self.user_cache_dir + os.sep + f.replace('/', os.sep) + if os.path.isdir(cache_dir): for state_file in os.listdir(cache_dir): if self.please_stop: @@ -1732,7 +1738,8 @@ def cleanup(self): print('removing state file (dry run): %s' % asf) else: print('removing state file: %s' % asf) - os.unlink(asf) + if os.path.exists(asf): + os.unlink(asf) print_column = 0