示例#1
0
 def deltmp(self):
     """Delete temporary directories"""
     assert not os.system("rm -rf testfiles/output "
                          "testfiles/restore_out testfiles/cache")
     assert not os.system("mkdir testfiles/output testfiles/cache")
     backend = duplicity.backend.get_backend(backend_url)
     bl = backend.list()
     if bl:
         backend.delete(backend.list())
     backend.close()
示例#2
0
 def deltmp(self):
     """Delete temporary directories"""
     assert not os.system("rm -rf testfiles/output "
                          "testfiles/restore_out testfiles/cache")
     assert not os.system("mkdir testfiles/output testfiles/cache")
     backend = duplicity.backend.get_backend(backend_url)
     bl = backend.list()
     if bl:
         backend.delete(backend.list())
     backend.close()
示例#3
0
 def setUp(self):
     self.class_args = []
     assert not os.system("tar xzf testfiles.tar.gz > /dev/null 2>&1")
     assert not os.system("rm -rf testfiles/output testfiles/largefiles " "testfiles/restore_out testfiles/cache")
     assert not os.system("mkdir testfiles/output testfiles/cache")
     backend = duplicity.backend.get_backend(backend_url)
     bl = backend.list()
     if bl:
         backend.delete(backend.list())
     backend.close()
示例#4
0
 def setUp(self):
     self.class_args = []
     assert not os.system("tar xzf testfiles.tar.gz > /dev/null 2>&1")
     assert not os.system("rm -rf testfiles/output testfiles/largefiles "
                          "testfiles/restore_out testfiles/cache")
     assert not os.system("mkdir testfiles/output testfiles/cache")
     backend = duplicity.backend.get_backend(backend_url)
     bl = backend.list()
     if bl:
         backend.delete(backend.list())
     backend.close()
示例#5
0
 def cmp_list(l):
     """Assert that backend.list is same as l"""
     blist = backend.list()
     blist.sort()
     l.sort()
     assert blist == l, \
            ("Got list: %s\nWanted: %s\n" % (repr(blist), repr(l)))
示例#6
0
 def cmp_list(l):
     """Assert that backend.list is same as l"""
     blist = backend.list()
     blist.sort()
     l.sort()
     assert blist == l, \
            ("Got list: %s  Wanted: %s\n" % (repr(blist), repr(l)))
def action_list(backend, inp, out):
    result = backend.list()
    out.write(StatusCodes.OK)
    for i in result:
        assert (i.find(b'\0') == -1)
        out.write(i.encode('ascii'))
        out.write(b'\0')
示例#8
0
 def del_tmp(self):
     """Remove all files from test directory"""
     config.set_environ("FTP_PASSWORD", self.password)
     backend = duplicity.backend.get_backend(self.url_string)
     backend.delete(backend.list())
     backend.close()
     """Delete and create testfiles/output"""
     assert not os.system("rm -rf testfiles/output")
     assert not os.system("mkdir testfiles/output")
示例#9
0
 def del_tmp(self):
     """Remove all files from test directory"""
     config.set_environ("FTP_PASSWORD", self.password)
     backend = duplicity.backend.get_backend(self.url_string)
     backend.delete(backend.list())
     backend.close()
     """Delete and create testfiles/output"""
     assert not os.system("rm -rf testfiles/output")
     assert not os.system("mkdir testfiles/output")
def action_list(backend, inp, out):
    if isinstance(backend, duplicity.backends.rsyncbackend.RsyncBackend):
        backend.run_command(" ".join(
            [backend.cmd, "/dev/null", backend.url_string + "/"]))
    result = backend.list()
    out.write(StatusCodes.OK)
    for i in result:
        assert (i.find(b'\0') == -1)
        out.write(i.encode('ascii'))
        out.write(b'\0')
示例#11
0
    def try_fileobj_filename(self, backend, filename):
        """Use get_fileobj_write and get_fileobj_read on filename around"""
        fout = backend.get_fileobj_write(filename)
        fout.write("hello, world!")
        fout.close()
        assert filename in backend.list()

        fin = backend.get_fileobj_read(filename)
        buf = fin.read()
        fin.close()
        assert buf == "hello, world!", buf

        backend.delete ([filename])
示例#12
0
    def try_fileobj_filename(self, backend, filename):
        """Use get_fileobj_write and get_fileobj_read on filename around"""
        fout = backend.get_fileobj_write(filename)
        fout.write("hello, world!")
        fout.close()
        assert filename in backend.list()

        fin = backend.get_fileobj_read(filename)
        buf = fin.read()
        fin.close()
        assert buf == "hello, world!", buf

        backend.delete ([filename])
def main():
    inp = sys.stdin  # For Python 3: .buffer
    out = sys.stdout  # For Python 3: .buffer
    # TODO: extract to some common function
    duplicity.log._logger = duplicity.log.DupLogger("some logger")
    duplicity.backend.import_backends()
    with open("/rw/config/v6-qubes-backup-poc-duplicity-path", "r") as f:
        backend_url = f.read().rstrip("\n")
    backend = duplicity.backend.get_backend(backend_url)
    if backend is None:
        raise Exception("Don't know backend for the URL", backend_url)
    for i in backend.list():
        out.write(b'N')
        write_zero_terminated_ascii(out, i)