Ejemplo n.º 1
0
 def save_state(self):
     """ Save state to :attr:`cachefile`.  If caching and
     state is handled by the package library, then this function
     does not need to be implemented. """
     cache = open(self.cachefile, 'wb')
     cPickle.dump((self.pkgnames, self.deps, self.provides,
                   self.essentialpkgs, self.recommends), cache, 2)
     cache.close()
Ejemplo n.º 2
0
 def save_state(self):
     """ Save state to :attr:`cachefile`.  If caching and
     state is handled by the package library, then this function
     does not need to be implemented. """
     cache = open(self.cachefile, 'wb')
     cPickle.dump((self.pkgnames, self.deps, self.provides,
                   self.essentialpkgs), cache, 2)
     cache.close()
Ejemplo n.º 3
0
 def save_state(self):
     """ If using the builtin yum parser, save state to
     :attr:`cachefile`.  If using the Python yum libraries, yum
     handles caching and state and this method is a no-op."""
     if not self.use_yum:
         cache = open(self.cachefile, 'wb')
         cPickle.dump((self.packages, self.deps, self.provides,
                       self.filemap, self.url_map), cache, 2)
         cache.close()
Ejemplo n.º 4
0
Archivo: Yum.py Proyecto: zenazn/bcfg2
 def save_state(self):
     """ If using the builtin yum parser, save state to
     :attr:`cachefile`.  If using the Python yum libraries, yum
     handles caching and state and this method is a no-op."""
     if not self.use_yum:
         cache = open(self.cachefile, 'wb')
         cPickle.dump((self.packages, self.deps, self.provides,
                       self.filemap, self.url_map), cache, 2)
         cache.close()
Ejemplo n.º 5
0
    def _save(self):
        """ Save any saved data to a file """
        saved_data = []
        try:
            while not self.queue.empty():
                saved_data.append(self.queue.get_nowait())
        except Empty:
            pass

        try:
            savefile = open(self.save_file, 'w')
            cPickle.dump(saved_data, savefile)
            savefile.close()
            self.logger.info("Saved pending Reporting data")
        except (IOError, TypeError):
            err = sys.exc_info()[1]
            self.logger.warning("Failed to save pending data: %s" % err)
Ejemplo n.º 6
0
    def _save(self):
        """Save any pending data to a file."""
        pending_data = []
        try:
            while not self.work_queue.empty():
                (metadata, xdata) = self.work_queue.get_nowait()
                data = \
                    lxml.etree.tostring(xdata,
                                        xml_declaration=False).decode("UTF-8")
                pending_data.append((metadata.hostname, data))
        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 (IOError, TypeError):
            err = sys.exc_info()[1]
            self.logger.warning("Failed to save pending data: %s" % err)
Ejemplo n.º 7
0
    def _save(self):
        """Save any pending data to a file."""
        pending_data = []
        try:
            while not self.work_queue.empty():
                (metadata, xdata) = self.work_queue.get_nowait()
                data = \
                    lxml.etree.tostring(xdata,
                                        xml_declaration=False).decode("UTF-8")
                pending_data.append((metadata.hostname, data))
        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 (IOError, TypeError):
            err = sys.exc_info()[1]
            self.logger.warning("Failed to save pending data: %s" % err)
Ejemplo n.º 8
0
Archivo: Apt.py Proyecto: ab/bcfg2
 def save_state(self):
     cache = open(self.cachefile, 'wb')
     cPickle.dump((self.pkgnames, self.deps, self.provides,
                   self.essentialpkgs), cache, 2)
     cache.close()
Ejemplo n.º 9
0
Archivo: Yum.py Proyecto: ab/bcfg2
 def save_state(self):
     if not self.use_yum:
         cache = open(self.cachefile, 'wb')
         cPickle.dump((self.packages, self.deps, self.provides,
                       self.filemap, self.url_map), cache, 2)
         cache.close()
Ejemplo n.º 10
0
Archivo: Pac.py Proyecto: Bcfg2/bcfg2
 def save_state(self):
     cache = open(self.cachefile, 'wb')
     cPickle.dump((self.pkgnames, self.deps, self.provides,
                   self.recommends, self.pacgroups), cache, 2)
     cache.close()
Ejemplo n.º 11
0
 def save_state(self):
     cache = open(self.cachefile, 'wb')
     cPickle.dump((self.pkgnames, self.deps, self.provides, self.recommends,
                   self.pacgroups), cache, 2)
     cache.close()