From c01e4bc1e749dd6ffe3640d36622ee367ba038fe Mon Sep 17 00:00:00 2001 From: Luca Valtulina Date: Thu, 13 Feb 2020 15:57:58 -0300 Subject: [PATCH] register node meta in catalog if present --- consul/base.py | 9 +++++---- tests/test_base.py | 1 - 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/consul/base.py b/consul/base.py index ee6ab254..2d3f2e7d 100755 --- a/consul/base.py +++ b/consul/base.py @@ -1129,8 +1129,8 @@ def register(self, *token* is an optional `ACL token`_ to apply to this request. - *node_meta* is an optional meta data used for filtering, a - dictionary formatted as {k1:v1, k2:v2}. + *node_meta* is an optional meta data used for registering + meta data to a node. This manipulates the health check entry, but does not setup a script or TTL to actually update the status. The full documentation @@ -1152,9 +1152,10 @@ def register(self, data['WriteRequest'] = {'Token': token} params.append(('token', token)) if node_meta: + nm = {} for nodemeta_name, nodemeta_value in node_meta.items(): - params.append(('node-meta', '{0}:{1}'. - format(nodemeta_name, nodemeta_value))) + nm[nodemeta_name] = nodemeta_value + data['NodeMeta'] = nm return self.agent.http.put( CB.bool(), '/v1/catalog/register', diff --git a/tests/test_base.py b/tests/test_base.py index ef76a9fa..cc9077a9 100755 --- a/tests/test_base.py +++ b/tests/test_base.py @@ -55,7 +55,6 @@ def _should_support_node_meta(c): c.catalog.nodes, c.catalog.services, lambda **kw: c.catalog.service('foo', **kw), - lambda **kw: c.catalog.register('foo', 'bar', **kw), # health lambda **kw: c.health.service('foo', **kw), lambda **kw: c.health.checks('foo', **kw),