예제 #1
0
파일: metrique.py 프로젝트: young8/metrique
def rsync(args):
    compress = not args.nocompress
    utils.rsync(args.ssh_host,
                args.ssh_user,
                args.targets,
                compress,
                prefix=HOSTNAME)
예제 #2
0
def test_rsync():
    from metrique.utils import rsync, sys_call, rand_chars, remove_file
    from metrique.utils import read_file
    #remove_file(f_1)
    #remove_file(dest, force=True)
    if not sys_call('which rsync'):
        return   # skip this test if rsync isn't available
    fname = rand_chars(prefix='rsync')
    path = os.path.join(cache_dir, fname)
    with open(path, 'w') as f:
        f.write('test')
    dest = os.path.join(tmp_dir, 'rsync')
    rsync(targets=path, dest=dest)
    assert read_file(os.path.join(dest, fname)) == 'test'
    with open(path, 'w') as f:
        f.write('test 2')
    rsync(targets=path, dest=dest)
    assert read_file(os.path.join(dest, fname)) == 'test 2'
    remove_file(path, force=True)
    remove_file(dest, force=True)
예제 #3
0
def test_rsync():
    from metrique.utils import rsync, sys_call, rand_chars, remove_file
    from metrique.utils import read_file
    #remove_file(f_1)
    #remove_file(dest, force=True)
    if not sys_call('which rsync'):
        return  # skip this test if rsync isn't available
    fname = rand_chars(prefix='rsync')
    path = os.path.join(cache_dir, fname)
    with open(path, 'w') as f:
        f.write('test')
    dest = os.path.join(tmp_dir, 'rsync')
    rsync(targets=path, dest=dest)
    assert read_file(os.path.join(dest, fname)) == 'test'
    with open(path, 'w') as f:
        f.write('test 2')
    rsync(targets=path, dest=dest)
    assert read_file(os.path.join(dest, fname)) == 'test 2'
    remove_file(path, force=True)
    remove_file(dest, force=True)
예제 #4
0
def rsync(args):
    compress = not args.nocompress
    utils.rsync(args.ssh_host, args.ssh_user, args.targets,
                compress, prefix=HOSTNAME)