Modify ↓
Ticket #524 (closed defect: fixed)
Directory fails if entry is not a directory
Reported by: | [email protected]… | Owned by: | desai |
---|---|---|---|
Priority: | major | Milestone: | Bcfg2 0.9.5 Release |
Component: | bcfg2-client | Version: | |
Keywords: | Cc: |
Description
We use a Directory element for /var/run/console . Another program on the system was deleting it and making it into a file. When we ran bcfg2 we'd get this traceback:
Unexpected failure of install method for entry type Directory Traceback (most recent call last): File "/usr/lib/python2.5/site-packages/Bcfg2/Client/Tools/__init__.py", line 129, in Install self.states[entry] = func(entry) File "/usr/lib/python2.5/site-packages/Bcfg2/Client/Tools/POSIX.py", line 226, in InstallDirectory if not exists: UnboundLocalError: local variable 'exists' referenced before assignment
If we ran it again, it would succeed.
The problem is that the InstallDirectory? method was not setting 'exists' after it unlinked the file.
Here is a patch to fix it.
--- POSIX.py 2008-02-28 17:38:09.000000000 -0600 +++ /usr/lib/python2.5/site-packages/Bcfg2/Client/Tools/POSIX.py 2008-02-28 17:39:36.000000000 -0600 @@ -213,6 +213,7 @@ self.logger.debug("Found a non-directory entry at %s" % (entry.get('name'))) try: os.unlink(entry.get('name')) + exists = False except OSError: self.logger.info("Failed to unlink %s" % (entry.get('name'))) return False
Thank you.
Attachments
Change History
Note: See
TracTickets for help on using
tickets.
Committed in [efc0cbc2305b02c89c5f2bc7d670a992cb6db7d1] (SVN r4393) and queued for inclusion in 0.9.5.8. Bug reports with patches attached are the best. Thanks!