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

Projects
None yet
2 participants
@grogancolin
Copy link
Contributor

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.

Added check to consul.yaml.erb for 'tags:'
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.
@olivielpeau
Copy link
Member

olivielpeau left a comment

👌 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

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.