diff options
author | Kenny Woodson <kwoodson@redhat.com> | 2015-02-05 14:18:09 -0500 |
---|---|---|
committer | Kenny Woodson <kwoodson@redhat.com> | 2015-02-05 14:18:09 -0500 |
commit | 55b7f22404da7a0cfcdbce467e9581f6b8509320 (patch) | |
tree | bac3cb599c1e4fc9790153ddfc7b7b82f29e43e1 /bin/ossh | |
parent | 912ba64e80dc3e086df4e9b65577fe490ff37c70 (diff) | |
download | openshift-55b7f22404da7a0cfcdbce467e9581f6b8509320.tar.gz openshift-55b7f22404da7a0cfcdbce467e9581f6b8509320.tar.bz2 openshift-55b7f22404da7a0cfcdbce467e9581f6b8509320.tar.xz openshift-55b7f22404da7a0cfcdbce467e9581f6b8509320.zip |
Updated tab completion as well as respecting ssh config files.
Diffstat (limited to 'bin/ossh')
-rwxr-xr-x | bin/ossh | 17 |
1 files changed, 9 insertions, 8 deletions
@@ -84,6 +84,7 @@ class Ossh(object): '''Determine host name and user name for SSH. ''' self.env = None + self.user = None re_env = re.compile('\.(int|stg|prod|ops)') search = re_env.search(self.args.host) @@ -104,10 +105,6 @@ class Ossh(object): self.host = self.args.host if self.args.login_name: self.user = self.args.login_name - else: - self.user = os.environ['USER'] - - def get_hosts(self): '''Query our host inventory and return a dict where the format @@ -192,8 +189,12 @@ class Ossh(object): ''' try: cmd = '/usr/bin/ssh' - ssh_args = [cmd, '-l%s' % self.user] - #ssh_args = [cmd, ] + + # shell args start with the program name in position 1 + ssh_args = [cmd, ] + + if self.user: + ssh_args.append('-l%s' % self.user) if self.args.verbose: ssh_args.append('-vvv') @@ -211,9 +212,9 @@ class Ossh(object): # Assume we have one and only one. hostname, server_info = result[0] - ip = server_info['ec2_ip_address'] + dns = server_info['ec2_public_dns_name'] - ssh_args.append(ip) + ssh_args.append(dns) #last argument if self.args.command: |