Modify ↓
Ticket #548 (closed defect: fixed)
bcfg2 fails to create new files when in paranoid mode
Reported by: | [email protected]… | 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
Note: See
TracTickets for help on using
tickets.
Fixed in r4585