Skip to content

Commit

Permalink
Make import_dashboards have non-zero exit code on error (#3252)
Browse files Browse the repository at this point in the history
* Always set exit status of 1 on error

Previously, a failure in ImportKibana or ImportArchive methods would print an
error, but the exit status would be set to 0.

In addition, the ImportDir method would return nil instead of an error when
asked to import a directory which did not exist. This would end up printing
several error messages to the console but ultimately causing an exit status of
0.

* Fix English grammar in errors with s/fail/failed/

Most of the error messages were things like "fail to" which reads better as
"failed to".

* Use assertEqual to check the return code from import_dashboards

The test failure message now includes the stdout & stderr output from the
script for easier debugging.

* Look for Kibana index in _meta/kibana, not etc/kibana

* Fix spelling of "visualization" in status message

* Make ImportKibana and ImportDir smarter about missing dirs

If someone passes a -dir that doesn't exist at all, that's an error. If the
dir does exist but it does not have either an index-pattern or dashboard
subdir, that is also an error.

Similarly, if they request -only-index or --only-dashboards and the
corresponding subdir doesn't exist that's an error.

We check all of this in ImportKibana, so we no longer pass non-existent
subdirs to ImportDir, meaning it can assume that the dir exists.

* Standardize error message casing and use of periods

I also added a little more detail to a few error messages and tweaked the
grammar in a few spots.

* Send all error output to os.stderr

* Add a -quiet option to to suppress all status messages

* Skip the dashboard import test entirely for now (see #3370)
  • Loading branch information
autarch authored and andrewkroh committed Jan 13, 2017
1 parent ccf69ca commit 6043bd4
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 66 deletions.
Loading

0 comments on commit 6043bd4

Please sign in to comment.