Modify

Ticket #548 (closed defect: fixed)

Opened 13 years ago

Last modified 13 years ago

bcfg2 fails to create new files when in paranoid mode

Reported by: peter@… Owned by: desai
Priority: major Milestone: Bcfg2 0.9.6 Release
Component: bcfg2-client Version: 0.9.x
Keywords: paranoid Cc:

Description

I'm running bcfg2 from trunk. If bcfg2 is running in paranoid mode, it will 'fail' to make a backup of files, simply because they do not exist, and fail to create the ConfigFile?.

Installing ConfigFile /etc/apache2/sites-include/rt
> cp /etc/apache2/sites-include/rt /var/cache/bcfg2/_etc_apache2_sites-include_rt
< cp: cannot stat `/etc/apache2/sites-include/rt': No such file or directory
Failed to create backup file for ConfigFile /etc/apache2/sites-include/rt

Looks like the problem is in line ~404 of Server/Tools?/POSIX.py. My python is weak and I still find the bcfg2 source scary, but this is a crappy way to do it better:

         # If we get here, then the parent directory should exist
        if entry.get("paranoid", False) and self.setup.get("paranoid", False):
            bkupnam = entry.get('name').replace('/', '_')
            try:
                os.stat(entry.get('name'))
                if self.cmd.run("cp %s /var/cache/bcfg2/%s" % (entry.get('name'), bkupnam))[0]:
                    self.logger.error("Failed to create backup file for ConfigFile %s" % \
                                      (entry.get('name')))
                    return False
            except:
                self.logger.debug("%s does not exist, skipping backup." % entry.get('name'))

Attachments

Change History

comment:1 Changed 13 years ago by desai

  • Status changed from new to closed
  • Resolution set to fixed

Fixed in r4585

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

View

Add a comment

Modify Ticket

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


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

 
Note: See TracTickets for help on using tickets.