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

Add support for multiple tags via key/value #186

Closed
wants to merge 3 commits into from

Conversation

lightpriest
Copy link

A new pull request (previous is #183) without a version change and with a more strict test for Hash implementation.


Enables setting tags from different attribute levels, backward compatible.

Suppose you have role A which acts on two environments B and C.
This patch enables setting this on the role:

{
  "datadog": {
    "tags": {
      "cluster": "A"
    }
  }
}

And these on the different environments:

{
  "datadog": {
    "tags": {
      "environment": "B"
    }
  }
}

{
  "datadog": {
    "tags": {
      "environment": "C"
    }
  }
}

Will result in datadog.conf having tags: cluster:A,environment:B and tags: cluster:A,environment:C respectively. String version of the tags should still work. To remove a tag in a higher precedence level, set it to an empty string.

This is also reported in #170.

Provide the ability to add tags on different attribute levels. Chef will merge
the attributes together and the template will generate the list from them.

To "remove" a tag on a higher precedence level, set it to an empty string.
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling a21c37c on Fewbytes:support-multiple-kv-tags into 7280fe6 on DataDog:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling a21c37c on Fewbytes:support-multiple-kv-tags into 7280fe6 on DataDog:master.

@miketheman miketheman added this to the Next Major milestone Apr 8, 2015
@miketheman
Copy link
Contributor

@lightpriest Getting back to this feature now. Looks like it can't be merged - there might be a conflict in the datadog.conf somewhere.

Also, is there any tests you might write with ChefSpec to validate the template outcome of passing in the tags attribute?

@lightpriest
Copy link
Author

@miketheman I added a spec for this, imitating the structure of the other specs. I also tried to add a commit that would fix the merge conflict, but I guess it wasn't enough.

The conflict is in a comment section in attributes/default.rb and after my commit I think it should be even simpler to merge. If that's a problem, I'll open another pull-request.

@jslusher
Copy link

+1 for this!

@miketheman
Copy link
Contributor

Closing, as superseded with #296

Thanks for the contribution!

@miketheman miketheman closed this Apr 21, 2016
miketheman pushed a commit that referenced this pull request Apr 21, 2016
* Extract datadog tags into a template var
* Support strings and hashes
* Update docs for tag attribute
* Add test coverage for tags (string, hash, empty hash value)

Closes #186
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants