Skip to content

KeyError: 'graphite' raised when graphite key is not in config.yaml #72

Open
@dxniel7402

Description

When running the project with a config.yaml file that doesn't include the graphite key, the following error is raised:

Traceback (most recent call last):
  ...
  File "/app/trawler.py", line 55, in __init__
    if self.config['graphite']['enabled']:
KeyError: 'graphite'

This seems to indicate that the graphite key is expected in the config.yaml file, although it's not included in example configurations or documented.

Steps to Reproduce:

  1. Clone the project.
  2. Run the tests: SECRETS=test-assets coverage run --source . -m py.test
  3. Run the application with a config.yaml that doesn't include the graphite key: python3 trawler.py --config deployment/config.yaml

Expected Behavior:

The application should either run without requiring the graphite key or should provide a more descriptive error message if the key is required.

Suggested Solution:

Document the graphite Key: Update the example config.yaml file and documentation to include the graphite key. For example:

# Example configuration file
trawler:
  frequency: 10
  use_kubeconfig: false
logging: 
  level: debug
  filters: trawler:trace
  format: pretty
prometheus:
  port: 63512
  enabled: true
graphite:
  enabled: false
nets:
  datapower:
    enabled: true
    username: admin
    namespace: apic
  manager:
    enabled: true
    username: admin
    namespace: apic
  analytics:
    enabled: true
    namespace: apic

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions