Esempio n. 1
0
    def _lt_command(self, local, remote):
        """
        Remote url: lantorrent://hostname:port/path.
        """

        if remote[:len(self.scheme)] != self.scheme:
            raise InvalidInput(
                "get command invalid lantorrent url, not %s %s" %
                (self.scheme, remote))

        url = remote
        lt_exe = self.p.get_arg_or_none(wc_args.EXTRA_ARGS)
        if lt_exe == None:
            raise InvalidInput(
                "the prop-extra-args parameter must be used and be a path to the remote execution script"
            )

        (xfer_scheme, xfer_user, xfer_pw, xfer_host, xfer_port,
         xfer_path) = url_parse(url)

        if xfer_port == None:
            xfer_port = 22

        if xfer_user:
            self.c.log.info("allowing client to specify this account: %s" %
                            xfer_user)
        else:
            self.c.log.debug("client did not specify account")

            # if default is not specified, we just uses current account
            if self.sshuser:
                self.c.log.debug("using the default ssh account")
                xfer_user = self.sshuser
            else:
                self.c.log.debug("using the program runner for ssh account")

        if xfer_user:
            xfer_user = xfer_user + "@"
        else:
            xfer_user = ""
        try:
            import uuid
            rid = str(uuid.uuid1())
        except:
            import commands
            rid = commands.getoutput("uuidgen")
        cmd = self.ssh + " %d %s%s %s %s %s %s %s:%d" % (
            xfer_port, xfer_user, xfer_host, lt_exe, xfer_path, local, rid,
            self.ltip, self.ltport)

        self.c.log.debug("lantorrent command %s " % (cmd))

        return cmd
Esempio n. 2
0
    def _lt_command(self, local, remote):
        """
        Remote url: lantorrent://hostname:port/path.
        """

        if remote[:len(self.scheme)] != self.scheme:
            raise InvalidInput("get command invalid lantorrent url, not %s %s" % (self.scheme, remote))

        url = remote
        lt_exe = self.p.get_arg_or_none(wc_args.EXTRA_ARGS)
        if lt_exe == None:
            raise InvalidInput("the prop-extra-args parameter must be used and be a path to the remote execution script")

        (xfer_scheme, xfer_user, xfer_pw, xfer_host, xfer_port, xfer_path) =url_parse(url)
 
        if xfer_port == None:
            xfer_port = 22

        if xfer_user:
            self.c.log.info("allowing client to specify this account: %s" % xfer_user) 
        else:
            self.c.log.debug("client did not specify account") 

            # if default is not specified, we just uses current account
            if self.sshuser:
                self.c.log.debug("using the default ssh account") 
                xfer_user = self.sshuser
            else:
                self.c.log.debug("using the program runner for ssh account") 

        if xfer_user:
            xfer_user = xfer_user + "@"
        else:
            xfer_user = ""
        try:
            import uuid
            rid = str(uuid.uuid1())
        except:
            import commands
            rid = commands.getoutput("uuidgen")
        cmd = self.ssh + " %d %s%s %s %s %s %s %s:%d" % (xfer_port, xfer_user, xfer_host, lt_exe, xfer_path, local, rid, self.ltip, self.ltport)

        self.c.log.debug("lantorrent command %s " % (cmd))

        return cmd
Esempio n. 3
0
 def _parse_url(this, url):
     scheme = "cp://"
     if url[: len(scheme)] != scheme:
         raise InvalidInput("invalid cp url, not cp:// " + url)
     (s, user, pw, host, port, path) = url_parse(url)
     return path
Esempio n. 4
0
 def _parse_url(this, url):
     scheme = "cp://"
     if url[:len(scheme)] != scheme:
         raise InvalidInput("invalid cp url, not cp:// " + url)
     (s, user, pw, host, port, path) = url_parse(url)
     return path