This commit is contained in:
Pino de Candia 2018-02-14 22:45:00 -06:00
commit 28ecc7505b
5 changed files with 9 additions and 42 deletions

View File

@ -39,7 +39,6 @@ openstack.ssh.v1 =
ssh_usercert_create = tatuclient.v1.cli.usercert:CreateUserCertCommand
ssh_usercert_list = tatuclient.v1.cli.usercert:ListUserCertCommand
ssh_usercert_show = tatuclient.v1.cli.usercert:ShowUserCertCommand
usercert_cert_show = tatuclient.v1.cli.usercert:ShowUserCertCertCommand
ssh_usercert_revoke = tatuclient.v1.cli.usercert:RevokeUserCertCommand
ssh_host_list = tatuclient.v1.cli.host:ListHostCommand
@ -47,13 +46,10 @@ openstack.ssh.v1 =
ssh_hostcert_list = tatuclient.v1.cli.hostcert:ListHostCertCommand
ssh_hostcert_show = tatuclient.v1.cli.hostcert:ShowHostCertCommand
hostcert_cert_show = tatuclient.v1.cli.hostcert:ShowHostCertCertCommand
ssh_ca_create = tatuclient.v1.cli.ca:CreateCACommand
ssh_ca_list = tatuclient.v1.cli.ca:ListCACommand
ssh_ca_show = tatuclient.v1.cli.ca:ShowCACommand
sshca_user_key_show = tatuclient.v1.cli.ca:ShowCAUserKeyCommand
sshca_host_key_show = tatuclient.v1.cli.ca:ShowCAHostKeyCommand
ssh_pat_list = tatuclient.v1.cli.pat:ListPATCommand

View File

@ -69,7 +69,7 @@ def get_item_properties(item, fields, mixed_case_fields=[], formatters={}):
if field in formatters:
row.append(formatters[field](item))
else:
row.append(get_property(item, field, mixed_case_fields))
row.append(get_item_property(item, field, mixed_case_fields))
return tuple(row)

View File

@ -63,22 +63,6 @@ class ShowCACommand(command.ShowOne):
return _names, utils.get_item_properties(data, _columns)
class ShowCAUserKeyCommand(ShowCACommand):
"""Print the CA's unformatted public key for user certificates."""
def take_action(self, parsed_args):
data = self._get_data(parsed_args)
self.app.stdout.write(utils.get_item_property(data, 'user_pub_key'))
class ShowCAHostKeyCommand(ShowCACommand):
"""Print the CA's unformatted public key for user certificates."""
def take_action(self, parsed_args):
data = self._get_data(parsed_args)
self.app.stdout.write(utils.get_item_property(data, 'host_pub_key'))
class CreateCACommand(command.ShowOne):
"""Create new CA"""

View File

@ -24,8 +24,8 @@ from tatuclient.v1.utils import get_all
LOG = logging.getLogger(__name__)
_columns = ['host_id', 'fingerprint', 'hostname', 'created_at', 'expires_at']
_names = ['Instance ID', 'Fingerprint', 'Hostname', 'Created', 'Expires']
_columns = ['hostname', 'host_id', 'fingerprint', 'created_at', 'expires_at']
_names = ['Hostname', 'Instance ID', 'Fingerprint', 'Created', 'Expires']
class ListHostCertCommand(command.Lister):
@ -60,12 +60,5 @@ class ShowHostCertCommand(command.ShowOne):
def take_action(self, parsed_args):
data = self._get_data(parsed_args)
return _names, utils.get_item_properties(data, _columns)
class ShowUserCertCertCommand(ShowUserCertCommand):
"""Print the HostCert's unformatted certificate data."""
def take_action(self, parsed_args):
data = self._get_data(parsed_args)
self.app.stdout.write(utils.get_item_property(data, 'cert'))
return (_names + ['Certificate'],
utils.get_item_properties(data, _columns + ['cert']))

View File

@ -59,15 +59,8 @@ class ShowUserCertCommand(command.ShowOne):
def take_action(self, parsed_args):
data = self._get_data(parsed_args)
return _names, utils.get_item_properties(data, _columns)
class ShowUserCertCertCommand(ShowUserCertCommand):
"""Print the UserCert's unformatted certificate data."""
def take_action(self, parsed_args):
data = self._get_data(parsed_args)
self.app.stdout.write(utils.get_item_property(data, 'cert'))
return (_names + ['Certificate'],
utils.get_item_properties(data, _columns + ['cert']))
class CreateUserCertCommand(command.ShowOne):
@ -85,7 +78,8 @@ class CreateUserCertCommand(command.ShowOne):
data = client.usercert.create(client.session.get_user_id(),
client.session.get_project_id(),
parsed_args.pub_key)
return _names, utils.get_item_properties(data, _columns)
return (_names + ['Certificate'],
utils.get_item_properties(data, _columns + ['cert']))
class RevokeUserCertCommand(command.ShowOne):