Exemplo n.º 1
0
    def test_archive(self):
        self.assertEqual([], self.luct_glo.listing())
        inst = LucteriosInstance("inst_e", self.path_dir)
        inst.add()
        path_usr = join(self.path_dir, 'inst_e', 'usr', 'foo')
        makedirs(path_usr)
        with open(join(path_usr, 'myfile'), mode='w+') as myfile:
            myfile.write('boooo!!')

        inst.filename = join(self.path_dir, "inst_e.arc")
        self.assertEqual(True, inst.archive())

        import tarfile
        list_file = []
        with tarfile.open(inst.filename, "r:gz") as tar:
            for tarinfo in tar:
                list_file.append(tarinfo.name)
        list_file.sort()
        self.assertEqual(
            ['dump.json', 'target', 'usr', 'usr/foo', 'usr/foo/myfile'], list_file)

        inst = LucteriosInstance("inst_f", self.path_dir)
        inst.add()
        inst.filename = join(self.path_dir, "inst_e.arc")
        self.assertEqual(True, inst.restore())
        self.assertEqual(True, isdir(join(self.path_dir, 'inst_f', 'usr')))
        self.assertEqual(
            True, isdir(join(self.path_dir, 'inst_f', 'usr', 'foo')))
        self.assertEqual(
            True, isfile(join(self.path_dir, 'inst_f', 'usr', 'foo', 'myfile')))
Exemplo n.º 2
0
 def save_instance(self, instance_name, file_name):
     inst = LucteriosInstance(instance_name)
     inst.filename = file_name
     if inst.archive():
         showinfo(ugettext("Lucterios installer"), ugettext(
             "Instance saved to %s") % file_name)
     else:
         showerror(
             ugettext("Lucterios installer"), ugettext("Instance not saved!"))
     self.refresh(instance_name)
Exemplo n.º 3
0
 def save_instance(self, instance_name, file_name):
     self.stop_current_instance(instance_name)
     inst = LucteriosInstance(instance_name)
     inst.filename = file_name
     if inst.archive():
         showinfo(ugettext_lazy("Lucterios launcher"), ugettext_lazy(
             "Instance saved to %s") % file_name)
     else:
         showerror(
             ugettext_lazy("Lucterios launcher"), ugettext_lazy("Instance not saved!"))
     self.refresh(instance_name)
Exemplo n.º 4
0
 def save_instance(self, instance_name, file_name):
     self.stop_current_instance(instance_name)
     inst = LucteriosInstance(instance_name)
     inst.filename = file_name
     if inst.archive():
         showinfo(ugettext_lazy("Lucterios launcher"),
                  ugettext_lazy("Instance saved to %s") % file_name)
     else:
         showerror(ugettext_lazy("Lucterios launcher"),
                   ugettext_lazy("Instance not saved!"))
     self.refresh(instance_name)
Exemplo n.º 5
0
    def test_archive(self):
        self.assertEqual([], self.luct_glo.listing())
        inst = LucteriosInstance("inst_h", self.path_dir)
        inst.add()
        inst.filename = join(self.path_dir, "inst_h.arc")
        self.assertEqual(True, inst.archive())

        inst = LucteriosInstance("inst_psql", self.path_dir)
        inst.set_database(
            "postgresql:name=" + self.data['dbname'] + ",user=puser,password=123456,host=localhost")
        inst.add()
        inst.filename = join(self.path_dir, "inst_h.arc")
        self.assertEqual(True, inst.restore())
Exemplo n.º 6
0
    def test_archive(self):
        self.assertEqual([], self.luct_glo.listing())
        inst = LucteriosInstance("inst_g", self.path_dir)
        inst.add()
        inst.filename = join(self.path_dir, "inst_g.arc")
        self.assertEqual(True, inst.archive())

        inst = LucteriosInstance("inst_mysql", self.path_dir)
        inst.set_database(
            "mysql:name=testv2,user=myuser,password=123456,host=localhost")
        inst.add()
        inst.filename = join(self.path_dir, "inst_g.arc")
        self.assertEqual(True, inst.restore())