Ticket #524 (closed defect: fixed)

Opened 15 years ago

Last modified 15 years ago

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:


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/", line 129, in Install
    self.states[entry] = func(entry)
  File "/usr/lib/python2.5/site-packages/Bcfg2/Client/Tools/", 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.

---    2008-02-28 17:38:09.000000000 -0600
+++ /usr/lib/python2.5/site-packages/Bcfg2/Client/Tools/        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')))
+                    exists = False
                 except OSError:
           "Failed to unlink %s" % (entry.get('name')))
                     return False

Thank you.


Change History

comment:1 Changed 15 years ago by desai

  • Status changed from new to closed
  • Resolution set to fixed
  • Milestone set to Bcfg2 0.9.5 Release

Committed in [efc0cbc2305b02c89c5f2bc7d670a992cb6db7d1] (SVN r4393) and queued for inclusion in Bug reports with patches attached are the best. Thanks!

WARNING! You need to establish a session before you can create or edit tickets. Otherwise the ticket will get treated as spam.


Add a comment

Modify Ticket

Change Properties
<Author field>
as closed
The resolution will be deleted. Next status will be 'reopened'

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.