summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Wiest <twiest@users.noreply.github.com>2015-04-13 16:42:12 -0400
committerThomas Wiest <twiest@users.noreply.github.com>2015-04-13 16:42:12 -0400
commitc9a25aeb65c91beed3ce5c90e73ab7118ceff545 (patch)
tree532cfbda0bf52adb27559b35882c3a8d82e3fb63
parent1cb4ba976599e6e4fd18568f7dc46b58db5b4161 (diff)
parentfa08dd34159e16c574f551cd48d7194f5888a128 (diff)
downloadopenshift-c9a25aeb65c91beed3ce5c90e73ab7118ceff545.tar.gz
openshift-c9a25aeb65c91beed3ce5c90e73ab7118ceff545.tar.bz2
openshift-c9a25aeb65c91beed3ce5c90e73ab7118ceff545.tar.xz
openshift-c9a25aeb65c91beed3ce5c90e73ab7118ceff545.zip
Merge pull request #153 from twiest/pr
fixed bug in opssh where it wouldn't actually run pssh
-rwxr-xr-xbin/opssh30
1 files changed, 7 insertions, 23 deletions
diff --git a/bin/opssh b/bin/opssh
index 5fb447318..a4fceb6a8 100755
--- a/bin/opssh
+++ b/bin/opssh
@@ -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)