Example #1
0
def run_cmd_on_host(hostname, cmd, stdin, stdout, stderr):
    base_cmd = abstract_ssh.make_ssh_command()
    full_cmd = "%s %s \"%s\"" % (base_cmd, hostname,
                                 server_utils.sh_escape(cmd))

    return subprocess.Popen(full_cmd, stdin=stdin, stdout=stdout,
                            stderr=stderr, shell=True)
Example #2
0
 def ssh_command(self, connect_timeout=30, options='', alive_interval=300):
     """
     Construct an ssh command with proper args for this host.
     """
     options = "%s %s" % (options, self.master_ssh_option)
     base_cmd = abstract_ssh.make_ssh_command(user=self.user, port=self.port,
                                             opts=options,
                                             hosts_file=self.known_hosts_fd,
                                             connect_timeout=connect_timeout,
                                             alive_interval=alive_interval)
     return "%s %s" % (base_cmd, self.hostname)
Example #3
0
 def ssh_command(self, connect_timeout=30, options='', alive_interval=300):
     """
     Construct an ssh command with proper args for this host.
     """
     options = "%s %s" % (options, self.master_ssh_option)
     base_cmd = abstract_ssh.make_ssh_command(
         user=self.user,
         port=self.port,
         opts=options,
         hosts_file=self.known_hosts_file,
         connect_timeout=connect_timeout,
         alive_interval=alive_interval)
     return "%s %s" % (base_cmd, self.hostname)
Example #4
0
 def ssh_command(self, connect_timeout=30, options=''):
     """Construct an ssh command with proper args for this host."""
     base_cmd = abstract_ssh.make_ssh_command(self.user, self.port,
                                              options, connect_timeout)
     return "%s %s" % (base_cmd, self.hostname)