1 import sys
2 from completers import ClusterCompleter
3
4
6 """
7 sshmaster [options] <cluster> [<remote-command>]
8
9 SSH to a cluster's master node
10
11 Example:
12
13 $ sshmaster mycluster
14
15 You can also execute commands without directly logging in:
16
17 $ starcluster sshmaster mycluster 'cat /etc/hosts'
18 """
19 names = ['sshmaster', 'sm']
20
22 parser.add_option("-u", "--user", dest="user", action="store",
23 type="string", default='root',
24 help="login as USER (defaults to root)")
25
27 if not args:
28 self.parser.error("please specify a cluster")
29 clname = args[0]
30 cmd = ' '.join(args[1:])
31 retval = self.cm.ssh_to_master(clname, user=self.opts.user,
32 command=cmd)
33 if cmd and retval is not None:
34 sys.exit(retval)
35