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

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

Open
dxniel7402 opened this issue Aug 29, 2023 · 3 comments
Open

Comments

@dxniel7402
Copy link

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
@rickymoorhouse
Copy link
Member

This shouldn't be required - will look at how this can be handled better. As yet I'm also unaware of anyone using trawler with graphite

rickymoorhouse added a commit that referenced this issue Aug 30, 2023
rickymoorhouse added a commit that referenced this issue Dec 5, 2023
fix for #72

Signed-off-by: Ricky Moorhouse <[email protected]>
rickymoorhouse added a commit that referenced this issue Dec 5, 2023
@wdrdres3qew5ts21
Copy link
Member

I'm still encounter the same error as of latest git clone version.
@rickymoorhouse
image

Seem like I still need to put "graphite" key into yaml otherwise I will got the error
image

rickymoorhouse added a commit that referenced this issue Apr 11, 2024
@rickymoorhouse
Copy link
Member

Ah looks like I missed a place in the fix - have an additional fix coming

rickymoorhouse added a commit that referenced this issue Apr 11, 2024
rickymoorhouse added a commit that referenced this issue Apr 11, 2024
* fix: only try and get token if password set

Signed-off-by: Ricky Moorhouse <[email protected]>

* fix: additional graphite reference

#72
Signed-off-by: Ricky Moorhouse <[email protected]>

---------

Signed-off-by: Ricky Moorhouse <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants