diff options
author | Thomas Wiest <twiest@redhat.com> | 2015-04-13 16:35:55 -0400 |
---|---|---|
committer | Thomas Wiest <twiest@redhat.com> | 2015-04-13 16:35:55 -0400 |
commit | fa08dd34159e16c574f551cd48d7194f5888a128 (patch) | |
tree | 532cfbda0bf52adb27559b35882c3a8d82e3fb63 /bin | |
parent | 1cb4ba976599e6e4fd18568f7dc46b58db5b4161 (diff) | |
download | openshift-fa08dd34159e16c574f551cd48d7194f5888a128.tar.gz openshift-fa08dd34159e16c574f551cd48d7194f5888a128.tar.bz2 openshift-fa08dd34159e16c574f551cd48d7194f5888a128.tar.xz openshift-fa08dd34159e16c574f551cd48d7194f5888a128.zip |
fixed bug in opssh where it wouldn't actually run pssh
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/opssh | 30 |
1 files changed, 7 insertions, 23 deletions
@@ -41,30 +41,12 @@ class Opssh(object): self.aws.print_host_types() return 0 - hosts = None - if self.args.host_type is not None and \ + if self.args.host_type is not None or \ self.args.env is not None: - # Both env and host-type specified - hosts = self.aws.get_host_list(host_type=self.args.host_type, \ - env=self.args.env) + return self.run_pssh() - if self.args.host_type is None and \ - self.args.env is not None: - # Only env specified - hosts = self.aws.get_host_list(env=self.args.env) - - if self.args.host_type is not None and \ - self.args.env is None: - # Only host-type specified - hosts = self.aws.get_host_list(host_type=self.args.host_type) - - if hosts is None: - # We weren't able to determine what they wanted to do - raise ArgumentError("Invalid combination of arguments") - - for host in hosts: - print host - return 0 + # We weren't able to determine what they wanted to do + raise ArgumentError("Invalid combination of arguments") def run_pssh(self): """Actually run the pssh command based off of the supplied options @@ -82,7 +64,9 @@ class Opssh(object): if self.args.errdir: pssh_args.extend(["--errdir", self.args.errdir]) - hosts = self.aws.get_host_list(self.args.host_type, self.args.env) + hosts = self.aws.get_host_list(host_type=self.args.host_type, + env=self.args.env) + with tempfile.NamedTemporaryFile(prefix='opssh-', delete=True) as f: for h in hosts: f.write(h + os.linesep) |