Ejemplo n.º 1
0
    def setup_manager(self, hosts, args, opts):
        localargs = args[0:-1]
        remote = args[-1]
        if not re.match("^/", remote):
            print("Remote path %s must be an absolute path" % remote)
            sys.exit(3)
        manager = ScpManager(opts)
        for host, port, user in hosts:
            cmd = ['scp', '-qC']
            if opts.options:
                for opt in opts.options:
                    cmd += ['-o', opt]
            if port:
                cmd += ['-P', port]
            if opts.recursive:
                cmd.append('-r')
            if opts.extra:
                cmd.extend(opts.extra)
            cmd.extend(localargs)
            if user:
                cmd.append('%s@%s:%s' % (user, host, remote))
            else:
                cmd.append('%s:%s' % (host, remote))
            t = Task(host, port, user, cmd, opts)
            manager.add_task(t)

        return manager
Ejemplo n.º 2
0
    def setup_manager(self, hosts, args, opts):
        localargs = args[0:-1]
        remote = args[-1]
        if not re.match("^/", remote):
            print("Remote path %s must be an absolute path" % remote)
            sys.exit(3)
        manager = ScpManager(opts)
        for host, port, user in hosts:
            cmd = ['scp', '-qC']
            if opts.options:
                for opt in opts.options:
                    cmd += ['-o', opt]
            if port:
                cmd += ['-P', port]
            if opts.recursive:
                cmd.append('-r')
            if opts.extra:
                cmd.extend(opts.extra)
            cmd.extend(localargs)
            if user:
                cmd.append('%s@%s:%s' % (user, host, remote))
            else:
                cmd.append('%s:%s' % (host, remote))
            t = Task(host, port, user, cmd, opts)
            manager.add_task(t)

        return manager
Ejemplo n.º 3
0
    def setup_manager(self, hosts, args, opts):
        remote = args[0]
        local = args[1]
        if not re.match("^/", remote):
            print("Remote path %s must be an absolute path" % remote)
            sys.exit(3)

        for host, port, user in hosts:
            if opts.localdir:
                dirname = "%s/%s" % (opts.localdir, host)
            else:
                dirname = host
            if not os.path.exists(dirname):
                os.mkdir(dirname)

        manager = ScpManager(opts)
        for host, port, user in hosts:
            if opts.localdir:
                localpath = "%s/%s/%s" % (opts.localdir, host, local)
            else:
                localpath = "%s/%s" % (host, local)
            cmd = ['scp', '-qC']
            if opts.options:
                for opt in opts.options:
                    cmd += ['-o', opt]
            if port:
                cmd += ['-P', port]
            if opts.recursive:
                cmd.append('-r')
            if opts.extra:
                cmd.extend(opts.extra)
            if user:
                cmd.append('%s@%s:%s' % (user, host, remote))
            else:
                cmd.append('%s:%s' % (host, remote))
            cmd.append(localpath)
            t = Task(host, port, user, cmd, opts)
            manager.add_task(t)

        return manager
Ejemplo n.º 4
0
    def setup_manager(self, hosts, args, opts):
        remote = args[0]
        local = args[1]
        if not re.match("^/", remote):
            print("Remote path %s must be an absolute path" % remote)
            sys.exit(3)

        for host, port, user in hosts:
            if opts.localdir:
                dirname = "%s/%s" % (opts.localdir, host)
            else:
                dirname = host
            if not os.path.exists(dirname):
                os.mkdir(dirname)

        manager = ScpManager(opts)
        for host, port, user in hosts:
            if opts.localdir:
                localpath = "%s/%s/%s" % (opts.localdir, host, local)
            else:
                localpath = "%s/%s" % (host, local)
            cmd = ['scp', '-qC']
            if opts.options:
                for opt in opts.options:
                    cmd += ['-o', opt]
            if port:
                cmd += ['-P', port]
            if opts.recursive:
                cmd.append('-r')
            if opts.extra:
                cmd.extend(opts.extra)
            if user:
                cmd.append('%s@%s:%s' % (user, host, remote))
            else:
                cmd.append('%s:%s' % (host, remote))
            cmd.append(localpath)
            t = Task(host, port, user, cmd, opts)
            manager.add_task(t)

        return manager
Ejemplo n.º 5
0
    def setup_manager(self, hosts, args, opts):
        local = args[0]
        remote = args[1]
        if not re.match("^/", remote):
            print("Remote path %s must be an absolute path" % remote)
            sys.exit(3)

        manager = ScpManager(opts)
        for host, port, user in hosts:
            ssh = ['ssh']
            if opts.options:
                for opt in opts.options:
                    ssh += ['-o', opt]
            if port:
                ssh += ['-p', port]
            if opts.ssh_args:
                ssh += [opts.ssh_args]

            cmd = ['rsync', '-e', ' '.join(ssh)]
            if opts.verbose:
                cmd.append('-v')
            if opts.recursive:
                cmd.append('-r')
            if opts.archive:
                cmd.append('-a')
            if opts.compress:
                cmd.append('-z')
            if opts.extra:
                cmd.extend(opts.extra)
            cmd.append(local)
            if user:
                cmd.append('%s@%s:%s' % (user, host, remote))
            else:
                cmd.append('%s:%s' % (host, remote))
            t = Task(host, port, user, cmd, opts)
            manager.add_task(t)

        return manager
Ejemplo n.º 6
0
    def setup_manager(self, hosts, args, opts):
        local = args[0]
        remote = args[1]
        if not re.match("^/", remote):
            print("Remote path %s must be an absolute path" % remote)
            sys.exit(3)

        manager = ScpManager(opts)
        for host, port, user in hosts:
            ssh = ['ssh']
            if opts.options:
                for opt in opts.options:
                    ssh += ['-o', opt]
            if port:
                ssh += ['-p', port]
            if opts.ssh_args:
                ssh += [opts.ssh_args]

            cmd = ['rsync', '-e', ' '.join(ssh)]
            if opts.verbose:
                cmd.append('-v')
            if opts.recursive:
                cmd.append('-r')
            if opts.archive:
                cmd.append('-a')
            if opts.compress:
                cmd.append('-z')
            if opts.extra:
                cmd.extend(opts.extra)
            cmd.append(local)
            if user:
                cmd.append('%s@%s:%s' % (user, host, remote))
            else:
                cmd.append('%s:%s' % (host, remote))
            t = Task(host, port, user, cmd, opts)
            manager.add_task(t)

        return manager