diff options
author | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2012-05-14 10:21:24 -0400 |
---|---|---|
committer | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2012-05-14 10:21:24 -0400 |
commit | 27c392d970f919aa3e230a0a723e60d78d157eed (patch) | |
tree | 5314ae8e1f3eb6095aa6db73fa0ddac770668d70 /src/lib/Bcfg2/Options.py | |
parent | ab412f596313405e2a7f95c43acef21c93406f57 (diff) | |
download | bcfg2-27c392d970f919aa3e230a0a723e60d78d157eed.tar.gz bcfg2-27c392d970f919aa3e230a0a723e60d78d157eed.tar.bz2 bcfg2-27c392d970f919aa3e230a0a723e60d78d157eed.zip |
fixed OptionParser FAM race condition
Diffstat (limited to 'src/lib/Bcfg2/Options.py')
-rw-r--r-- | src/lib/Bcfg2/Options.py | 6 |
1 files changed, 5 insertions, 1 deletions
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': |