MCPcopy
hub / github.com/docker/docker-py / update_node

Method update_node

docker/api/swarm.py:383–416  ·  view source on GitHub ↗

Update the node's configuration Args: node_id (string): ID of the node to be updated. version (int): The version number of the node object being updated. This is required to avoid conflicting writes. node_spec (dict): Configurati

(self, node_id, version, node_spec=None)

Source from the content-addressed store, hash-verified

381
382 @utils.minimum_version('1.24')
383 def update_node(self, node_id, version, node_spec=None):
384 """
385 Update the node's configuration
386
387 Args:
388
389 node_id (string): ID of the node to be updated.
390 version (int): The version number of the node object being
391 updated. This is required to avoid conflicting writes.
392 node_spec (dict): Configuration settings to update. Any values
393 not provided will be removed. Default: ``None``
394
395 Returns:
396 `True` if the request went through.
397
398 Raises:
399 :py:class:`docker.errors.APIError`
400 If the server returns an error.
401
402 Example:
403
404 >>> node_spec = {'Availability': 'active',
405 'Name': 'node-name',
406 'Role': 'manager',
407 'Labels': {'foo': 'bar'}
408 }
409 >>> client.api.update_node(node_id='24ifsmvkjbyhk', version=8,
410 node_spec=node_spec)
411
412 """
413 url = self._url('/nodes/{0}/update?version={1}', node_id, str(version))
414 res = self._post_json(url, data=node_spec)
415 self._raise_for_status(res)
416 return True
417
418 @utils.minimum_version('1.24')
419 def update_swarm(self, version, swarm_spec=None,

Callers 3

test_update_nodeMethod · 0.80
test_node_updateMethod · 0.80
updateMethod · 0.80

Calls 3

_urlMethod · 0.80
_post_jsonMethod · 0.80
_raise_for_statusMethod · 0.80

Tested by 2

test_update_nodeMethod · 0.64
test_node_updateMethod · 0.64