Skip to content

Commit

Permalink
[auto-discovery] tpl_tags can also be dicts apparently - parse them.
Browse files Browse the repository at this point in the history
  • Loading branch information
truthbk committed Jul 17, 2017
1 parent 3411289 commit 5181cdd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion utils/service_discovery/sd_docker_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,11 @@ def _fill_tpl(self, state, c_id, instance_tpl, variables, tags=None):
# add default tags to the instance
if tags:
tpl_tags = instance_tpl.get('tags', [])
tags += tpl_tags if isinstance(tpl_tags, list) else [tpl_tags]
if isinstance(tpl_tags, dict):
for key, val in tpl_tags.iteritems():
tags.append("{}:{}".format(key, val))
else:
tags += tpl_tags if isinstance(tpl_tags, list) else [tpl_tags]
instance_tpl['tags'] = list(set(tags))

for var in variables:
Expand Down

0 comments on commit 5181cdd

Please sign in to comment.