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

Added check to consul.yaml.erb for 'tags:' #479

Merged
merged 1 commit into from
Nov 29, 2017

Conversation

grogancolin
Copy link
Contributor

@grogancolin grogancolin commented Oct 11, 2017

I noticed when you don't pass a tag to
default['datadog']['consul']['instances'], it prints an empty tags section.

instances:
  - url: http://127.0.0.1:8500
    new_leader_checks: false
    catalog_checks: true
    service_whitelist: []
    tags:

This messes up with this line in the check.

The consul check is then failing with

2017-10-11 10:52:32 UTC | ERROR | dd.collector | checks.consul(__init__.py:814) | Check 'consul' instance #0 failed
Traceback (most recent call last):
  File "/opt/datadog-agent/agent/checks/__init__.py", line 797, in run
    self.check(copy.deepcopy(instance))
  File "/opt/datadog-agent/agent/checks.d/consul.py", line 240, in check
    for tag in instance.get('tags', []):
TypeError: 'NoneType' object is not iterable

This adds an extra check to the template so it also checks if the 'tags' section actually has elements.

I noticed when you don't pass a tag to
`default['datadog']['consul']['instances']`, it prints an empty

    tags:

section in the yaml.
This messes up with the templated code, as to the yaml parser,
    the tag exists, it's just not an array, so
    [this](https://github.com/DataDog/integrations-core/blob/master/consul/check.py#L240] line fails.
Copy link
Member

@olivielpeau olivielpeau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌 Good catch @grogancolin, thanks!

@olivielpeau olivielpeau added this to the 2.13.0 milestone Nov 29, 2017
@olivielpeau olivielpeau merged commit 584ee00 into DataDog:master Nov 29, 2017
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

Successfully merging this pull request may close these issues.

2 participants