Skip to content

Commit

Permalink
Merge pull request #3478 from DataDog/charly/sd_multiannotations_tags
Browse files Browse the repository at this point in the history
[autodiscovery] annotations with multi instances bug
  • Loading branch information
hkaj authored Aug 21, 2017
2 parents e1edf23 + 0e6ff98 commit 8ac4fc9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions utils/service_discovery/sd_docker_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,13 +491,17 @@ def _get_config_templates(self, identifier, **platform_kwargs):

return templates

def _fill_tpl(self, state, c_id, instance_tpl, variables, tags=None):
def _fill_tpl(self, state, c_id, instance_tpl, variables, c_tags=None):
"""Add container tags to instance templates and build a
dict from template variable names and their values."""
var_values = {}
c_image = state.inspect_container(c_id).get('Config', {}).get('Image', '')

# add default tags to the instance
# add only default c_tags to the instance to avoid duplicate tags from conf
if c_tags:
tags = c_tags[:] # shallow copy of the c_tags array
else:
tags = []
if tags:
tpl_tags = instance_tpl.get('tags', [])
if isinstance(tpl_tags, dict):
Expand Down

0 comments on commit 8ac4fc9

Please sign in to comment.