Skip to content
This repository has been archived by the owner on Apr 22, 2020. It is now read-only.

Commit

Permalink
verify that url: is actually in the configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Hanzelmann committed Aug 11, 2015
1 parent a766310 commit 5e68905
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion zmon_cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,17 @@ def get_config_data():
if os.path.exists(fn):
with open(fn) as fd:
data = yaml.safe_load(fd)
else:
raise Exception("Config file not found: ~/.zmon-cli.yaml")

return validate_config(data)


def validate_config(data):
if "user" not in data or "password" not in data:
raise Exception("Config file not found/properly configured: ~/.zmon-cli.yaml with user: and password:")
raise Exception("Config file not properly configured: keys 'user' and 'password' are missing")
if "url" not in data:
raise Exception("Config file not properly configured: key 'url' is missing")

return data

Expand Down

0 comments on commit 5e68905

Please sign in to comment.