I'm using Elasticsearch Curator version 5.5 (Windows zip package) CLI and trying to get the exit code after running it but the documentation and what I'm getting don't seem to match. (Documentation: https://www.elastic.co/guide/en/elasticsearch/client/curator/current/exit-codes.html)
Running curator, no matter what happens with the processing, I'm always getting an exit code of 0, even if I malform or miss pieces of the config file or action file. I can get an exit code of 2 if I specify the wrong location of the config file but this exit code isn't listed in the documentation. Am I missing something or getting the wrong exit code somehow? I would expect that if there is an error in the syntax of the config or action files that I should get a -1 exit code. Does the exit code ONLY change if there's an error during running the action file?
Example of what I'm running in PowerShell to get the exit code:
.\curator.exe --config Path\To\curator.yml --dry-run Path\To\action.yml
$LastExitCode #This always returns 0 unless the path to curator.yml is wrong
I'm the author of Curator. I don't do extensive testing in Windows, but the test suite that does run in Travis CI across the latest minor release versions of python 2.7, 3.5, and 3.6, as well as those of Elasticsearch 5.x and 6.x (it's quite a large matrix). The tests do include many which check for specific exit codes.
I'm not a Windows developer, and cannot speak in any degree of authority whether the exit codes would behave the same way in Windows as they do in a POSIX (Unix) environment. I do not have any 2
exit codes explicitly coded into Curator at all, so that exit code surprises me. The codes -1
, 0
, and 1
are expected in many instances, and are covered in specific tests. Specifically, only action failures and empty list conditions (if ignore_empty_list
is false
) will trigger an exit code of 1
, while non-specific exceptions and command-line misconfigurations will exit with -1
. Everything else should exit with a 0
. I do not know why you received a 2
exit code, as that's not one I provide.
I don't recall that I have ever executed the test suite in Windows. If you can launch a local Elasticsearch node (127.0.0.1
, on port 9200
), I'd love to hear the outcome. You can run the tests with python setup.py test
from a cloned repository (https://github.com/elastic/curator/curator.git). Be sure to test the 5.5
branch, and not master
. This is synced up with the current release, which is 5.5.2
as of this writing.