Remove list_nodes method from cluster

It makes little to no sense to have a separate list_nodes method.
All nodes can be listed from the same table and same URI.  The only
difference is that we will have a cluster_id as filters in this case.
This commit is contained in:
tengqm 2015-01-07 14:38:32 +08:00
parent 8058f54c9c
commit db0afea068
2 changed files with 28 additions and 10 deletions
senlinclient/v1

@ -102,14 +102,6 @@ class ClusterManager(base.BaseManager):
"""Delete a cluster."""
self._delete("/clusters/%s" % cluster_id)
def list_nodes(self, cluster_id):
# kwargs contains nodes to be added
cluster = self.get(cluster_id)
resp, body = self.client.json_request(
'GET',
'/clusters/%s/nodes' % cluster.identifier)
return body
def add_node(self, cluster_id, node_id):
headers = self.client.credentials_headers()
cluster = self.get(cluster_id)

@ -250,12 +250,38 @@ def do_cluster_show(sc, args):
}
utils.print_dict(cluster.to_dict(), formatters=formatters)
@utils.arg('-s', '--show-deleted', default=False, action="store_true",
help=_('Include soft-deleted nodes if any.'))
@utils.arg('-f', '--filters', metavar='<KEY1=VALUE1;KEY2=VALUE2...>',
help=_('Filter parameters to apply on returned nodes. '
'This can be specified multiple times, or once with '
'parameters separated by a semicolon.'),
action='append')
@utils.arg('-l', '--limit', metavar='<LIMIT>',
help=_('Limit the number of nodes returned.'))
@utils.arg('-m', '--marker', metavar='<ID>',
help=_('Only return nodes that appear after the given node ID.'))
@utils.arg('id', metavar='<NAME or ID>',
help=_('Name or ID of cluster to nodes from.'))
def do_cluster_node_list(sc, args):
'''List nodes from cluster.'''
sc.clusters.list_nodes(args.id)
fields = ['id', 'name', 'index', 'status', 'physical_id', 'created_time']
kwargs = {
'cluster_id': args.id,
'show_deleted': args.show_deleted,
'filters': utils.format_parameters(args.filters),
'limit': args.limit,
'marker': args.marker,
}
try:
nodes = sc.nodes.list(**kwargs)
except exc.HTTPNotFound:
msg = _('No node matching criteria is found')
raise exc.CommandError(msg)
utils.print_list(nodes, fields, sortby_index=5)
@utils.arg('-n', '--nodes', metavar='<NODE_IDs>',