Add new commands for ssh hosts and pats.
Signed-off-by: Pino de Candia <giuseppe.decandia@gmail.com>
This commit is contained in:
parent
7d250150e0
commit
3d1216ab30
@ -26,13 +26,14 @@ LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
_columns = ['IP', 'Chassis', 'LPort']
|
||||
_names = ['IP', 'Chassis', 'Neutron Port ID']
|
||||
|
||||
|
||||
class ListPATCommand(command.Lister):
|
||||
"""List PATs"""
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListCACommand, self).get_parser(prog_name)
|
||||
parser = super(ListPATCommand, self).get_parser(prog_name)
|
||||
common.add_all_common_options(parser)
|
||||
return parser
|
||||
|
||||
@ -40,4 +41,4 @@ class ListPATCommand(command.Lister):
|
||||
client = self.app.client_manager.ssh
|
||||
common.set_all_common_headers(client, parsed_args)
|
||||
data = get_all(client.pat.list)
|
||||
return _columns, (utils.get_item_properties(s, _columns) for s in data)
|
||||
return _names, (utils.get_item_properties(s, _columns) for s in data)
|
||||
|
@ -16,10 +16,12 @@
|
||||
from keystoneauth1 import adapter
|
||||
|
||||
from tatuclient import exceptions
|
||||
from tatuclient.v1.ca import CAController
|
||||
from tatuclient.v1.hostcert import HostCertController
|
||||
from tatuclient.v1.usercert import UserCertController
|
||||
from tatuclient import version
|
||||
from tatuclient.v1.ca import CAController
|
||||
from tatuclient.v1.host import HostController
|
||||
from tatuclient.v1.hostcert import HostCertController
|
||||
from tatuclient.v1.pat import PATController
|
||||
from tatuclient.v1.usercert import UserCertController
|
||||
|
||||
|
||||
class TatuAdapter(adapter.LegacyJsonAdapter):
|
||||
@ -108,7 +110,7 @@ class Client(object):
|
||||
)
|
||||
|
||||
self.ca = CAController(self)
|
||||
self.host = HostController
|
||||
self.host = HostController(self)
|
||||
self.hostcert = HostCertController(self)
|
||||
self.usercert = UserCertController(self)
|
||||
self.pat = PATController(self)
|
||||
self.usercert = UserCertController(self)
|
||||
|
@ -15,11 +15,11 @@
|
||||
from tatuclient.v1.base import V1Controller
|
||||
|
||||
|
||||
class PATController(V1Controller):
|
||||
class HostController(V1Controller):
|
||||
|
||||
def list(self, criterion=None, marker=None, limit=None):
|
||||
url = self.build_url('/hosts', criterion, marker, limit)
|
||||
return self._get(url, response_key='pats')
|
||||
return self._get(url, response_key='hosts')
|
||||
|
||||
def get(self, host_id):
|
||||
return self._get('/hosts/%s' % (host_id))
|
||||
|
@ -19,7 +19,7 @@ class HostCertController(V1Controller):
|
||||
|
||||
def list(self, criterion=None, marker=None, limit=None):
|
||||
url = self.build_url('/hostcerts', criterion, marker, limit)
|
||||
return self._get(url, response_key='hosts')
|
||||
return self._get(url, response_key='certs')
|
||||
|
||||
def get(self, host_id, fingerprint):
|
||||
return self._get('/hostcerts/%s/%s' % (host_id, fingerprint))
|
||||
|
@ -27,7 +27,7 @@ class UserCertController(V1Controller):
|
||||
|
||||
def list(self, criterion=None, marker=None, limit=None):
|
||||
url = self.build_url('/usercerts', criterion, marker, limit)
|
||||
return self._get(url, response_key='users')
|
||||
return self._get(url, response_key='certs')
|
||||
|
||||
def get(self, serial):
|
||||
return self._get('/usercerts/%s' % serial)
|
||||
|
Loading…
x
Reference in New Issue
Block a user