示例#1
0
文件: Plugin.py 项目: stpierre/bcfg2
    def save(self):
        """Save any pending data to a file."""
        pending_data = []
        try:
            while not self.work_queue.empty():
                (metadata, data) = self.work_queue.get_nowait()
                try:
                    pending_data.append((metadata.hostname,
                                         lxml.etree.tostring(data,
                                                             xml_declaration=False).decode("UTF-8")))
                except:
                    err = sys.exc_info()[1]
                    self.logger.warning("Dropping interaction for %s: %s" %
                                        (metadata.hostname, err))
        except Empty:
            pass

        try:
            savefile = open(self.pending_file, 'w')
            cPickle.dump(pending_data, savefile)
            savefile.close()
            self.logger.info("Saved pending %s data" % self.name)
        except:
            err = sys.exc_info()[1]
            self.logger.warning("Failed to save pending data: %s" % err)
示例#2
0
 def save_state(self):
     if not self.use_yum:
         cache = file(self.cachefile, 'wb')
         cPickle.dump((self.packages, self.deps, self.provides,
                       self.filemap, self.url_map), cache, 2)
         cache.close()
示例#3
0
文件: Apt.py 项目: mkdfh/bcfg2-dev
 def save_state(self):
     cache = file(self.cachefile, 'wb')
     cPickle.dump((self.pkgnames, self.deps, self.provides), cache, 2)
     cache.close()
示例#4
0
 def save_state(self):
     cache = file(self.cachefile, 'wb')
     cPickle.dump((self.pkgnames, self.deps, self.provides),
                  cache, 2)
     cache.close()
示例#5
0
文件: Yum.py 项目: calvinchengx/bcfg2
 def save_state(self):
     if not self.use_yum:
         cache = file(self.cachefile, 'wb')
         cPickle.dump((self.packages, self.deps, self.provides,
                       self.filemap, self.url_map), cache, 2)
         cache.close()
示例#6
0
文件: Apt.py 项目: stpierre/bcfg2
 def save_state(self):
     cache = open(self.cachefile, 'wb')
     cPickle.dump((self.pkgnames, self.deps, self.provides,
                   self.essentialpkgs), cache, 2)
     cache.close()
示例#7
0
 def save_state(self):
     cache = BUILTIN_FILE_TYPE(self.cachefile, 'wb')
     cPickle.dump((self.packages, self.deps, self.provides,
                   self.filemap, self.url_map), cache, 2)
     cache.close()