getsentry / infra-event-notifier

Python package to parse topicctl output & send notifications
Apache License 2.0
0 stars 0 forks source link

CLI: FileNotFoundError: [Errno 2] No such file or directory: 'cli_config/configuration.yaml' #14

Closed keeakita closed 3 weeks ago

keeakita commented 4 weeks ago

Looks like we need better logic to find the config in ops/, particularly for terragrunt. When you're in any other working directory it doesn't work properly:

INFO[0010] Executing hook: log_to_datadog                prefix=[/Users/keea/workspace/ops/terragrunt/regions/<snip>
Traceback (most recent call last):
  File "/Users/keea/workspace/ops/.venv-sentry-kube/bin/infra-event-notifier", line 8, in <module>
    sys.exit(main.main())
             ^^^^^^^^^^^
  File "/Users/keea/workspace/ops/.venv-sentry-kube/lib/python3.11/site-packages/infra_event_notifier/main.py", line 29, in main
    args.func(args)
  File "/Users/keea/workspace/ops/.venv-sentry-kube/lib/python3.11/site-packages/infra_event_notifier/cli/terragrunt.py", line 94, in execute
    self._execute_impl(args)
  File "/Users/keea/workspace/ops/.venv-sentry-kube/lib/python3.11/site-packages/infra_event_notifier/cli/terragrunt.py", line 120, in _execute_impl
    sentry_region = SentryKubeConfig().silo_regions[region].sentry_region
                    ^^^^^^^^^^^^^^^^^^
  File "/Users/keea/workspace/ops/.venv-sentry-kube/lib/python3.11/site-packages/infra_event_notifier/cli/terragrunt.py", line 45, in __init__
    with open(config_file_name) as file:
         ^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'cli_config/configuration.yaml'
keeakita commented 4 weeks ago

This is probably caused by the fact that I made some changes copying the logic from sentry-kube since I didn't think the whole thing was necessary, but it looks like it is :/