示例#1
0
 def __init__(self, easy_ec2, instance_id, key_location, description=None,
              kernel_id=None, ramdisk_id=None):
     self.ec2 = easy_ec2
     self.host = self.ec2.get_instance(instance_id)
     if self.host.state != 'running':
         raise exception.InstanceNotRunning(self.host.id, self.host.state,
                                            self.host.dns_name)
     self.host_ssh = sshutils.SSHClient(self.host.dns_name, username='******',
                                        private_key=key_location)
     self.description = description
     self.kernel_id = kernel_id or self.host.kernel
     self.ramdisk_id = ramdisk_id or self.host.ramdisk
示例#2
0
 def ssh(self):
     if not self._ssh:
         self._ssh = sshutils.SSHClient(self.instance.dns_name,
                                        username=self.user,
                                        private_key=self.key_location)
     return self._ssh
示例#3
0
 def ssh(self):
     if not self._ssh:
         self._ssh = sshutils.SSHClient(self.addr,
                                        username=self.user,
                                        private_key=self.key_location)
     return self._ssh