Skip to content

Commit

Permalink
Fix exit codes in failure situations
Browse files Browse the repository at this point in the history
  • Loading branch information
amotl committed Apr 23, 2024
1 parent 4c17003 commit 37cb0cb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* Permit invocation without configuration file for ad hoc operations.
In this mode, the Grafana URL can optionally be defined using the
environment variable `GRAFANA_URL`.
* Fix exit codes in failure situations.

## 0.2.0 (2022-02-05)
* Migrated from grafana_api to grafana_client
Expand Down
4 changes: 2 additions & 2 deletions grafana_import/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,10 +262,10 @@ def main():
sys.exit(0)
except Grafana.GrafanaDashboardNotFoundError as exp:
print(f"KO: Dashboard not found in folder '{exp.folder}': {exp.dashboard}")
sys.exit(0)
sys.exit(1)
except Grafana.GrafanaFolderNotFoundError as exp:
print(f"KO: Folder not found: {exp.folder}")
sys.exit(0)
sys.exit(1)
except GrafanaApi.GrafanaBadInputError as exp:
print(f"KO: Removing dashboard failed: {dashboard_name}. Reason: {exp}")
sys.exit(1)
Expand Down

0 comments on commit 37cb0cb

Please sign in to comment.