Пример #1
0
 def nodes(self, id=None, name=None):
     for node_dict in self.node_ls(id=id, name=name):
         node_id = node_dict['ID']
         node = DockerNode(self, node_id, inspect=node_dict)
         if self._node_prefix and not node.name.startswith(self._node_prefix):
             continue
         yield node
Пример #2
0
 def node_update(self, node_id, **kwopts):
     node = DockerNode.from_id(self, node_id)
     spec = node.inspect['Spec']
     if 'label_add' in kwopts:
         kwopts['labels'] = spec.get('Labels', {})
         kwopts['labels'].update(kwopts.pop('label_add'))
     spec.update(self._create_docker_api_spec('node_spec', dict, kwopts))
     return self._client.update_node(node.id, node.version, node_spec=spec)
Пример #3
0
 def nodes(self, id=None, name=None):
     for node_dict in self.node_ls(id=id, name=name):
         node_id = node_dict['ID'].strip(' *')
         node_name = node_dict['HOSTNAME']
         if self._node_prefix and not node_name.startswith(self._node_prefix):
             continue
         task_list = filter(lambda x: x['NAME'].startswith(self._name_prefix), self.node_ps(node_id))
         yield DockerNode.from_cli(self, node_dict, task_list)
Пример #4
0
 def node_update(self, node_id, **kwopts):
     node = DockerNode.from_id(self, node_id)
     spec = node.inspect['Spec']
     if 'label_add' in kwopts:
         kwopts['labels'] = spec.get('Labels', {})
         kwopts['labels'].update(kwopts.pop('label_add'))
     spec.update(self._create_docker_api_spec('node_spec', dict, kwopts))
     return self._client.update_node(node.id, node.version, node_spec=spec)
Пример #5
0
 def nodes(self, id=None, name=None):
     for node_dict in self.node_ls(id=id, name=name):
         node_id = node_dict['ID'].strip(' *')
         node_name = node_dict['HOSTNAME']
         if self._node_prefix and not node_name.startswith(self._node_prefix):
             continue
         task_list = filter(lambda x: x['NAME'].startswith(self._name_prefix), self.node_ps(node_id))
         yield DockerNode.from_cli(self, node_dict, task_list)