🌐 AI搜索 & 代理 主页
Skip to content
This repository was archived by the owner on Apr 15, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions consul/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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',
Expand Down
1 change: 0 additions & 1 deletion tests/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down