From 27c392d970f919aa3e230a0a723e60d78d157eed Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Mon, 14 May 2012 10:21:24 -0400 Subject: fixed OptionParser FAM race condition --- src/lib/Bcfg2/Options.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lib/Bcfg2/Options.py b/src/lib/Bcfg2/Options.py index dfb062341..f77dcff85 100644 --- a/src/lib/Bcfg2/Options.py +++ b/src/lib/Bcfg2/Options.py @@ -428,7 +428,11 @@ class OptionParser(OptionSet): self.optinfo = args def HandleEvent(self, event): - if not self['configfile'].endswith(event.filename): + if 'configfile' not in self or not isinstance(self['configfile'], str): + # we haven't parsed options yet, or CFILE wasn't included + # in the options + return + if os.path.basename(self['configfile']) != event.filename: print("Got event for unknown file: %s" % event.filename) return if event.code2str() == 'deleted': -- cgit v1.2.3-1-g7c22