Skip to content
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

Display warning when Nakadi SQL URL is not specified. #107

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions clin/run.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python3
import logging
import os
import sys
from pathlib import Path
from typing import Tuple, Optional

Expand Down Expand Up @@ -245,6 +246,12 @@ def dump(
logging.error(f"Environment not found in configuration: {env}")
exit(-1)

if not config.environments[env].nakadi_sql_url:
print(
f"Configuration key nakadi_sql_url was not defined for your environment {env}. You won't be able to dump Nakadi SQL.",
file=sys.stderr,
)

nakadi = Nakadi(config.environments[env].nakadi_url, token)
entity = nakadi.get_event_type(event_type)

Expand All @@ -261,9 +268,9 @@ def dump(
)

if output.lower() == "yaml":
logging.info(pretty_yaml(payload))
print(pretty_yaml(payload))
elif output.lower() == "json":
logging.info(pretty_json(payload))
print(pretty_json(payload))
else:
logging.error("Invalid output format: %s", output)
exit(-1)
Expand Down
2 changes: 2 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,10 @@ override/replace another.
environments:
staging:
nakadi_url: https://nakadi-staging.local
nakadi_sql_url: https://nakadi-sql-staging.local
production:
nakadi_url: https://nakadi-production.local
nakadi_sql_url: https://nakadi-sql-production.local
```

## Manifests format
Expand Down