-
Notifications
You must be signed in to change notification settings - Fork 151
Allow output gathering for working hosts when one or more hosts have failures #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi there, thank you for the feedback. The issue is that if an exception occurs at Command execution does not stop, it's just that output is not retrieved due to the exception. Will have to think about how best to handle this gracefully while still allowing user to get output for the remainder of the host list. Exceptions will need to be caught regardless. |
…case where the host lists contains one or more failing hosts. Refactored run_command to allow raising an exception on errors or not
Have started adding a keyword argument to turn on/off exception raising in This will allow you to make a decision on whether or not you want exceptions raised on errors or placeholder output containing exception object returned instead, along output for the remainder of the host list. As this is new behaviour and is backwards compatible with the existing API it will be released in a new point release. NB - |
… as argument to exceptions so that output can be updated correctly for the host the exception occured for. Updated test_pssh_client_run_command_get_output_explicit for changed get_output interface - Resolves #32
Finally got some time to finish this at the output branch. There is a back-wards incompatible change to a public API function, Feel free to install the output branch in the meantime but be aware that not all exceptions are yet being tested for partial failures and looking at the code it is likely that Exhaustive tests for this new behaviour will be in before output branch is merged. With the changes in that branch, to cause output = client.run_command('cmd', stop_on_errors=False) If a host in the host list has an exception, its output will contain an If you have been using output = {}
for cmd in cmds:
# output variable gets updated in-place for every cmd's output
client.get_output(cmd, output) from output = client.get_output(commands=cmds) |
…case where the host lists contains one or more failing hosts. Refactored run_command to allow raising an exception on errors or not
… as argument to exceptions so that output can be updated correctly for the host the exception occured for. Updated test_pssh_client_run_command_get_output_explicit for changed get_output interface - Resolves #32
When executing say client.run_command(...) over many hosts there is the possibility that a single host has problems. Maybe there is a nice way to recover when a single hosts fails? but I didn't see how to so this easily at present. Right now an exception is thrown and things stop. A nice way to recover would be good. In fact our example actually tests some of the hosts and sometimes they don't respond or they are switched off, etc. etc.
The text was updated successfully, but these errors were encountered: