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

Source Code for Module starcluster.commands.sshinstance

 1  #!/usr/bin/env python 
 2   
 3  from completers import InstanceCompleter 
 4   
 5   
6 -class CmdSshInstance(InstanceCompleter):
7 """ 8 sshinstance [options] <instance-id> 9 10 SSH to an EC2 instance 11 12 Examples: 13 14 $ starcluster sshinstance i-14e9157c 15 $ starcluster sshinstance ec2-123-123-123-12.compute-1.amazonaws.com 16 17 """ 18 names = ['sshinstance', 'si'] 19 show_dns_names = True 20
21 - def addopts(self, parser):
22 parser.add_option("-u", "--user", dest="user", action="store", 23 type="string", default='root', 24 help="login as USER (defaults to root)")
25
26 - def execute(self, args):
27 if not args: 28 self.parser.error( 29 "please specify an instance id or dns name to connect to") 30 for instance in args: 31 self.nm.ssh_to_node(instance, user=self.opts.user)
32