Ejemplo n.º 1
0
    def snapshot(self):
        logger.debug("Making snapshot")
        for obj_data in self.conf.objects:
            logger.debug("Dumping: %s", obj_data)
            driver = Driver.getDriver(obj_data, self.conf)
            driver.snapshot()
        logger.debug("Archiving dump directory: %s", self.conf.target)

        compress(self.conf.target, self.conf.compression_level)

        with open(self.conf.lastdump, "w") as fo:
            fo.write("{0}.tar.xz".format(self.conf.target))
        return "{0}.tar.xz".format(self.conf.target)
Ejemplo n.º 2
0
 def snapshot(self):
     logger.debug("Making snapshot")
     for obj_data in self.conf.objects:
         logger.debug("Dumping: %s", obj_data)
         driver = Driver.getDriver(obj_data, self.conf)
         driver.snapshot()
     logger.debug("Archiving dump directory: %s", self.conf.target)
     execute("tar zcf {0}.tgz -C {1} {2}"
             "".format(self.conf.target, os.path.dirname(self.conf.target),
                       os.path.basename(self.conf.target)))
     execute("rm -r {0}".format(self.conf.target))
     with open(self.conf.lastdump, "w") as fo:
         fo.write("{0}.tgz".format(self.conf.target))
     return "{0}.tgz".format(self.conf.target)
Ejemplo n.º 3
0
    def snapshot(self):
        logger.debug("Making snapshot")
        utils.execute("rm -rf {0}".format(os.path.dirname(self.conf.target)))
        for obj_data in self.conf.objects:
            logger.debug("Dumping: %s", obj_data)
            driver = Driver.getDriver(obj_data, self.conf)
            driver.snapshot()
        logger.debug("Archiving dump directory: %s", self.conf.target)

        utils.compress(self.conf.target, self.conf.compression_level)

        with open(self.conf.lastdump, "w") as fo:
            fo.write("{0}.tar.xz".format(self.conf.target))
        return "{0}.tar.xz".format(self.conf.target)
Ejemplo n.º 4
0
 def snapshot(self):
     logger.debug("Making snapshot")
     for obj_data in self.conf.objects:
         logger.debug("Dumping: %s", obj_data)
         driver = Driver.getDriver(obj_data, self.conf)
         driver.snapshot()
     logger.debug("Archiving dump directory: %s", self.conf.target)
     execute("tar zcf {0}.tgz -C {1} {2}"
             "".format(self.conf.target,
                       os.path.dirname(self.conf.target),
                       os.path.basename(self.conf.target)))
     execute("rm -r {0}".format(self.conf.target))
     with open(self.conf.lastdump, "w") as fo:
         fo.write("%s.tgz" % self.conf.target)
     return "%s.tgz" % self.conf.target
Ejemplo n.º 5
0
 def action_single(self, obj, action='snapshot'):
     driver = Driver.getDriver(obj, self.conf)
     try:
         return getattr(driver, action)()
     except fabric.exceptions.NetworkError:
         self.conf.on_network_error(obj)
Ejemplo n.º 6
0
 def action_single(self, object, action='snapshot'):
     driver = Driver.getDriver(object, self.conf)
     try:
         return getattr(driver, action)()
     except fabric.exceptions.NetworkError:
         self.conf.on_network_error(object)