Remove node_join and node_leave operations

Removing these methods to further simplify things.
May need to add them back in future.
This commit is contained in:
tengqm
2015-01-07 15:13:51 +08:00
parent bf1a130363
commit fae801ce06
2 changed files with 17 additions and 23 deletions

View File

@@ -93,23 +93,6 @@ class NodeManager(base.BaseManager):
'/nodes/%s' % node_id)
return Node(self, body['node'])
def join(self, node_id, cluster_id):
'''Make node join the specified cluster.'''
headers = self.client.credentials_headers()
data = {'cluster_id': cluster_id}
resp, body = self.client.json_request(
'POST',
'/nodes/%s/cluster' % node_id,
data=data, headers=headers)
return body
def leave(self, node_id):
'''Make node leave its current cluster.'''
resp, body = self.client.json_request(
'POST',
'/nodes/%s/cluster' % node_id)
return body
def profile(self, node_id):
'''Get the profile spec for a specific node as a parsed JSON.'''
resp, body = self.client.json_request(

View File

@@ -424,24 +424,29 @@ def do_node_delete(sc, args):
do_node_list(sc)
@utils.arg('-n', '--name', metavar='<NAME>',
help=_('New name for the node.'))
@utils.arg('-p', '--profile', metavar='<PROFILE ID>',
help=_('ID of new profile to use.'))
@utils.arg('-r', '--role', metavar='<ROLE>',
help=_('Role for this node in the specific cluster.'))
@utils.arg('-g', '--tags', metavar='<KEY1=VALUE1;KEY2=VALUE2...>',
help=_('Tag values to be attached to the node. '
'This can be specified multiple times, or once with tags'
'separated by a semicolon.'),
action='append')
@utils.arg('id', metavar='<NAME or ID>',
help=_('Name or ID of node to update.'))
@utils.arg('id', metavar='<ID>',
help=_('ID of node to update.'))
def do_node_update(sc, args):
'''Update the node.'''
fields = {
'id': args.id,
'name': args.name,
'role': args.role,
'profile': args.profile,
'tags': utils.format_parameters(args.tags),
}
sc.nodes.update(**fields)
sc.nodes.update(args.id, **fields)
do_node_list(sc)
@@ -449,7 +454,10 @@ def do_node_update(sc, args):
help=_('Name or ID of node to operate on.'))
def do_node_leave(sc, args):
'''Make node leave its current cluster.'''
sc.nodes.leave(args.id)
kwargs = {
'cluster_id': '',
}
do_node_update(args.id, **kwargs)
do_node_list(sc)
@@ -459,7 +467,10 @@ def do_node_leave(sc, args):
help=_('Name or ID of node to operate on.'))
def do_node_join(sc, args):
'''Make node join the specified cluster.'''
sc.nodes.join(args.id, args.cluster)
kwargs = {
'cluster_id': args.cluster,
}
do_node_update(args.id, **kwargs)
do_node_list(sc)