summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Wiest <twiest@redhat.com>2015-04-09 15:04:17 -0400
committerThomas Wiest <twiest@redhat.com>2015-04-09 15:04:17 -0400
commit6d0b77b9f3dbd439aa7e2d1d877e121214f284a8 (patch)
tree902da6f439d7ad576a6f75af9602ff931a358da6
parent1ccff35b334a45f5037f7965a906b5f1ac8d893d (diff)
downloadopenshift-6d0b77b9f3dbd439aa7e2d1d877e121214f284a8.tar.gz
openshift-6d0b77b9f3dbd439aa7e2d1d877e121214f284a8.tar.bz2
openshift-6d0b77b9f3dbd439aa7e2d1d877e121214f284a8.tar.xz
openshift-6d0b77b9f3dbd439aa7e2d1d877e121214f284a8.zip
fixed bug where opssh would throw an exception if pssh returned a non-zero exit code
-rwxr-xr-xbin/opssh16
1 files changed, 8 insertions, 8 deletions
diff --git a/bin/opssh b/bin/opssh
index ad1aadc29..453da65b4 100755
--- a/bin/opssh
+++ b/bin/opssh
@@ -19,6 +19,7 @@ CONFIG_MAIN_SECTION = 'main'
CONFIG_HOST_TYPE_ALIAS_SECTION = 'host_type_aliases'
CONFIG_INVENTORY_OPTION = 'inventory'
+class ArgumentMismatchError(ValueError): pass
class Opssh(object):
def __init__(self):
@@ -36,21 +37,18 @@ class Opssh(object):
self.aws = awsutil.AwsUtil(self.inventory, self.host_type_aliases)
+ def run(self):
if self.args.list_host_types:
self.aws.print_host_types()
- return
+ return 0
if self.args.env and \
self.args.host_type and \
self.args.command:
- retval = self.run_pssh()
- if retval != 0:
- raise ValueError("pssh run failed")
-
- return
+ return self.run_pssh()
# If it makes it here, we weren't able to determine what they wanted to do
- raise ValueError("Invalid combination of arguments")
+ raise ArgumentMismatchError("Invalid combination of arguments")
def run_pssh(self):
"""Actually run the pssh command based off of the supplied options
@@ -142,5 +140,7 @@ if __name__ == '__main__':
try:
opssh = Opssh()
- except ValueError as e:
+ exitcode = opssh.run()
+ sys.exit(exitcode)
+ except ArgumentMismatchError as e:
print "\nError: %s\n" % e.message