Package starcluster :: Package commands :: Module sshnode
[hide private]
[frames] | no frames]

Source Code for Module starcluster.commands.sshnode

 1  #!/usr/bin/env python 
 2   
 3  from completers import NodeCompleter 
 4   
 5   
6 -class CmdSshNode(NodeCompleter):
7 """ 8 sshnode <cluster> <node> 9 10 SSH to a cluster node 11 12 Examples: 13 14 $ starcluster sshnode mycluster master 15 $ starcluster sshnode mycluster node001 16 ... 17 18 or same thing in shorthand: 19 20 $ starcluster sshnode mycluster 0 21 $ starcluster sshnode mycluster 1 22 ... 23 """ 24 names = ['sshnode', 'sn'] 25
26 - def addopts(self, parser):
27 parser.add_option("-u", "--user", dest="user", action="store", 28 type="string", default='root', 29 help="login as USER (defaults to root)")
30
31 - def execute(self, args):
32 if len(args) != 2: 33 self.parser.error( 34 "please specify a <cluster> and <node> to connect to") 35 scluster = args[0] 36 ids = args[1:] 37 for id in ids: 38 self.cm.ssh_to_cluster_node(scluster, id, user=self.opts.user)
39