From e4211c9e6b1bcd5f8fbc408483f36615327396b0 Mon Sep 17 00:00:00 2001 From: bharath Date: Tue, 9 Oct 2018 23:46:43 +0530 Subject: [PATCH] Modify nodes to hosts Change-Id: Idccfdefc5f54e5292a071d51a80eb398d215df7b --- gyanclient/v1/client.py | 4 +-- gyanclient/v1/{nodes.py => hosts.py} | 22 +++++++-------- .../v1/{nodes_shell.py => hosts_shell.py} | 28 +++++++++---------- gyanclient/v1/shell.py | 4 +-- 4 files changed, 29 insertions(+), 29 deletions(-) rename gyanclient/v1/{nodes.py => hosts.py} (73%) rename gyanclient/v1/{nodes_shell.py => hosts_shell.py} (67%) diff --git a/gyanclient/v1/client.py b/gyanclient/v1/client.py index 0dc415a..5c3b639 100644 --- a/gyanclient/v1/client.py +++ b/gyanclient/v1/client.py @@ -14,7 +14,7 @@ from keystoneauth1 import loading from keystoneauth1 import session as ksa_session from gyanclient.common import httpclient -from gyanclient.v1 import nodes +from gyanclient.v1 import hosts from gyanclient.v1 import models from gyanclient.v1 import versions @@ -116,7 +116,7 @@ class Client(object): session=session, api_version=api_version, **client_kwargs) - self.nodes = nodes.NodeManager(self.http_client) + self.hosts = hosts.HostManager(self.http_client) self.models = models.ModelManager(self.http_client) self.versions = versions.VersionManager(self.http_client) diff --git a/gyanclient/v1/nodes.py b/gyanclient/v1/hosts.py similarity index 73% rename from gyanclient/v1/nodes.py rename to gyanclient/v1/hosts.py index fb5c1e2..30a1869 100644 --- a/gyanclient/v1/nodes.py +++ b/gyanclient/v1/hosts.py @@ -18,34 +18,34 @@ from gyanclient.common import utils from gyanclient import exceptions -class Node(base.Resource): +class Host(base.Resource): def __repr__(self): - return "" % self._info + return "" % self._info -class NodeManager(base.Manager): - resource_class = Node +class HostManager(base.Manager): + resource_class = Host @staticmethod def _path(id=None): if id: - return '/v1/ml-nodes/%s' % id + return '/v1/hosts/%s' % id else: - return '/v1/ml-nodes' + return '/v1/hosts' - def list_nodes(self, **kwargs): - """Retrieve a list of Nodes. + def list_hosts(self, **kwargs): + """Retrieve a list of Hosts. - :returns: A list of nodes. + :returns: A list of hosts. """ return self._list_pagination(self._path(''), - "nodes") + "hosts") def get(self, id): try: return self._list(self._path(id))[0] except IndexError: - return None \ No newline at end of file + return None diff --git a/gyanclient/v1/nodes_shell.py b/gyanclient/v1/hosts_shell.py similarity index 67% rename from gyanclient/v1/nodes_shell.py rename to gyanclient/v1/hosts_shell.py index 0c52c4a..766c4a3 100644 --- a/gyanclient/v1/nodes_shell.py +++ b/gyanclient/v1/hosts_shell.py @@ -24,23 +24,23 @@ from gyanclient.common import utils as gyan_utils from gyanclient import exceptions as exc -def _show_node(node): - utils.print_dict(node._info) +def _show_host(host): + utils.print_dict(host._info) -@utils.arg('node-id', - metavar='', - help='ID or name of the node to show.') -def do_node_show(cs, args): - """Show details of a Node.""" +@utils.arg('host-id', + metavar='', + help='ID or name of the host to show.') +def do_host_show(cs, args): + """Show details of a Host.""" opts = {} - opts['node_id'] = args.node_id + opts['host_id'] = args.host_id opts = gyan_utils.remove_null_parms(**opts) - node = cs.nodes.get(**opts) - _show_node(node) + host = cs.hosts.get(**opts) + _show_host(host) -def do_node_list(cs, args): - """List Nodes""" - nodes = cs.nodes.list_nodes() - gyan_utils.list_nodes(nodes) +def do_host_list(cs, args): + """List Hosts""" + hosts = cs.hosts.list_hosts() + gyan_utils.list_hosts(hosts) diff --git a/gyanclient/v1/shell.py b/gyanclient/v1/shell.py index 5eeadaa..70254d5 100644 --- a/gyanclient/v1/shell.py +++ b/gyanclient/v1/shell.py @@ -10,12 +10,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -from gyanclient.v1 import nodes_shell +from gyanclient.v1 import hosts_shell from gyanclient.v1 import models_shell from gyanclient.v1 import versions_shell COMMAND_MODULES = [ - nodes_shell, + hosts_shell, models_shell, versions_shell ]