Ticket #915 (closed defect: fixed)
lock file does not work with python >= 2.5
Reported by: | https://me.yahoo.com/a/2SlxL.p_rsQD.KxOt3q32tWWsQ--#39bec | Owned by: | desai |
---|---|---|---|
Priority: | major | Milestone: | Bcfg2 1.1.0 Release |
Component: | bcfg2-client | Version: | 1.0 |
Keywords: | Cc: |
Description
The bcfg2 agent uses fatal_error, which raises a SystemExit? exception, to abort after finding a lock file. This code is wrapped in a general try...except block though. In older versions of python, SystemExit? was uncatchable, but that is no longer true. This means that the agent will continue to try to configure the system even if a lock file exists.
For example:
$ cat test.py try:
raise SystemExit?(1)
except:
pass
print 'got here' try:
raise SystemExit?(1)
except Exception:
pass
print 'got here' $ python -V Python 2.6.4 $ python test.py got here $
As you can see, in newer versions of Python SystemExit? does not inherit from Exception, so you can fix the problem by using "except Exception:" instead.
Resolved in [5a816f593df6c51faaf8e1480bc6651bddb82b78] (SVN r6061)