diff options
author | Thomas Wiest <twiest@users.noreply.github.com> | 2015-04-09 15:18:13 -0400 |
---|---|---|
committer | Thomas Wiest <twiest@users.noreply.github.com> | 2015-04-09 15:18:13 -0400 |
commit | 3f6ca82df4bd1eb3986a4692412c3adc9b048e60 (patch) | |
tree | 902da6f439d7ad576a6f75af9602ff931a358da6 | |
parent | 1ccff35b334a45f5037f7965a906b5f1ac8d893d (diff) | |
parent | 6d0b77b9f3dbd439aa7e2d1d877e121214f284a8 (diff) | |
download | openshift-3f6ca82df4bd1eb3986a4692412c3adc9b048e60.tar.gz openshift-3f6ca82df4bd1eb3986a4692412c3adc9b048e60.tar.bz2 openshift-3f6ca82df4bd1eb3986a4692412c3adc9b048e60.tar.xz openshift-3f6ca82df4bd1eb3986a4692412c3adc9b048e60.zip |
Merge pull request #146 from twiest/pr
fixed bug where opssh would throw an exception if pssh returned a non-zero exit code
-rwxr-xr-x | bin/opssh | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -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 |