Modify nodes to hosts
Change-Id: Idccfdefc5f54e5292a071d51a80eb398d215df7b
This commit is contained in:
parent
20a6274d58
commit
e4211c9e6b
gyanclient/v1
@ -14,7 +14,7 @@ from keystoneauth1 import loading
|
|||||||
from keystoneauth1 import session as ksa_session
|
from keystoneauth1 import session as ksa_session
|
||||||
|
|
||||||
from gyanclient.common import httpclient
|
from gyanclient.common import httpclient
|
||||||
from gyanclient.v1 import nodes
|
from gyanclient.v1 import hosts
|
||||||
from gyanclient.v1 import models
|
from gyanclient.v1 import models
|
||||||
from gyanclient.v1 import versions
|
from gyanclient.v1 import versions
|
||||||
|
|
||||||
@ -116,7 +116,7 @@ class Client(object):
|
|||||||
session=session,
|
session=session,
|
||||||
api_version=api_version,
|
api_version=api_version,
|
||||||
**client_kwargs)
|
**client_kwargs)
|
||||||
self.nodes = nodes.NodeManager(self.http_client)
|
self.hosts = hosts.HostManager(self.http_client)
|
||||||
self.models = models.ModelManager(self.http_client)
|
self.models = models.ModelManager(self.http_client)
|
||||||
self.versions = versions.VersionManager(self.http_client)
|
self.versions = versions.VersionManager(self.http_client)
|
||||||
|
|
||||||
|
@ -18,31 +18,31 @@ from gyanclient.common import utils
|
|||||||
from gyanclient import exceptions
|
from gyanclient import exceptions
|
||||||
|
|
||||||
|
|
||||||
class Node(base.Resource):
|
class Host(base.Resource):
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "<Node %s>" % self._info
|
return "<Host %s>" % self._info
|
||||||
|
|
||||||
|
|
||||||
class NodeManager(base.Manager):
|
class HostManager(base.Manager):
|
||||||
resource_class = Node
|
resource_class = Host
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _path(id=None):
|
def _path(id=None):
|
||||||
|
|
||||||
if id:
|
if id:
|
||||||
return '/v1/ml-nodes/%s' % id
|
return '/v1/hosts/%s' % id
|
||||||
else:
|
else:
|
||||||
return '/v1/ml-nodes'
|
return '/v1/hosts'
|
||||||
|
|
||||||
def list_nodes(self, **kwargs):
|
def list_hosts(self, **kwargs):
|
||||||
"""Retrieve a list of Nodes.
|
"""Retrieve a list of Hosts.
|
||||||
|
|
||||||
:returns: A list of nodes.
|
:returns: A list of hosts.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
return self._list_pagination(self._path(''),
|
return self._list_pagination(self._path(''),
|
||||||
"nodes")
|
"hosts")
|
||||||
|
|
||||||
def get(self, id):
|
def get(self, id):
|
||||||
try:
|
try:
|
@ -24,23 +24,23 @@ from gyanclient.common import utils as gyan_utils
|
|||||||
from gyanclient import exceptions as exc
|
from gyanclient import exceptions as exc
|
||||||
|
|
||||||
|
|
||||||
def _show_node(node):
|
def _show_host(host):
|
||||||
utils.print_dict(node._info)
|
utils.print_dict(host._info)
|
||||||
|
|
||||||
|
|
||||||
@utils.arg('node-id',
|
@utils.arg('host-id',
|
||||||
metavar='<node-id>',
|
metavar='<host-id>',
|
||||||
help='ID or name of the node to show.')
|
help='ID or name of the host to show.')
|
||||||
def do_node_show(cs, args):
|
def do_host_show(cs, args):
|
||||||
"""Show details of a Node."""
|
"""Show details of a Host."""
|
||||||
opts = {}
|
opts = {}
|
||||||
opts['node_id'] = args.node_id
|
opts['host_id'] = args.host_id
|
||||||
opts = gyan_utils.remove_null_parms(**opts)
|
opts = gyan_utils.remove_null_parms(**opts)
|
||||||
node = cs.nodes.get(**opts)
|
host = cs.hosts.get(**opts)
|
||||||
_show_node(node)
|
_show_host(host)
|
||||||
|
|
||||||
|
|
||||||
def do_node_list(cs, args):
|
def do_host_list(cs, args):
|
||||||
"""List Nodes"""
|
"""List Hosts"""
|
||||||
nodes = cs.nodes.list_nodes()
|
hosts = cs.hosts.list_hosts()
|
||||||
gyan_utils.list_nodes(nodes)
|
gyan_utils.list_hosts(hosts)
|
@ -10,12 +10,12 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# 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 models_shell
|
||||||
from gyanclient.v1 import versions_shell
|
from gyanclient.v1 import versions_shell
|
||||||
|
|
||||||
COMMAND_MODULES = [
|
COMMAND_MODULES = [
|
||||||
nodes_shell,
|
hosts_shell,
|
||||||
models_shell,
|
models_shell,
|
||||||
versions_shell
|
versions_shell
|
||||||
]
|
]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user