Пример #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()
Пример #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()
Пример #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()
Пример #4
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()
Пример #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)
Пример #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)
Пример #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)
Пример #8
0
Файл: Apt.py Проект: 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()
Пример #9
0
Файл: Yum.py Проект: 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()
Пример #10
0
Файл: Pac.py Проект: 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()
Пример #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()