예제 #1
0
    def syncold(self, filename, remove=False):
        """ sync with old config data """
        if os.path.isfile(filename):
            synckey = "persistconfig-syncold"
            oldconfig = Persist(filename)
            if not oldconfig.data.has_key(synckey):
                rlog(10, 'persistconfig', "syncing old config %s with \
persistconfig" % filename)
                for i, j in oldconfig.data.iteritems():
                    if i == synckey:
                        continue
                    if j and not self.get(i):
                        self.set(i, oldconfig.data[i])
                oldconfig.data[synckey] = time.localtime()
                oldconfig.save()
            del oldconfig
            if remove:
                os.unlink(filename)