From f29cf34fb85f32b2480b0f7a524a04e68d135bfa Mon Sep 17 00:00:00 2001 From: Pino de Candia Date: Tue, 30 Jan 2018 06:02:50 +0000 Subject: [PATCH] Show certificates only on single records, not lists. --- setup.cfg | 4 ---- tatuclient/utils.py | 2 +- tatuclient/v1/cli/ca.py | 16 ---------------- tatuclient/v1/cli/hostcert.py | 15 ++++----------- tatuclient/v1/cli/usercert.py | 14 ++++---------- 5 files changed, 9 insertions(+), 42 deletions(-) diff --git a/setup.cfg b/setup.cfg index 24b0f01..582758d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -39,18 +39,14 @@ openstack.ssh.v1 = usercert_create = tatuclient.v1.cli.usercert:CreateUserCertCommand usercert_list = tatuclient.v1.cli.usercert:ListUserCertCommand usercert_show = tatuclient.v1.cli.usercert:ShowUserCertCommand - usercert_cert_show = tatuclient.v1.cli.usercert:ShowUserCertCertCommand usercert_revoke = tatuclient.v1.cli.usercert:RevokeUserCertCommand hostcert_list = tatuclient.v1.cli.hostcert:ListHostCertCommand hostcert_show = tatuclient.v1.cli.hostcert:ShowHostCertCommand - hostcert_cert_show = tatuclient.v1.cli.hostcert:ShowHostCertCertCommand sshca_create = tatuclient.v1.cli.ca:CreateCACommand sshca_list = tatuclient.v1.cli.ca:ListCACommand sshca_show = tatuclient.v1.cli.ca:ShowCACommand - sshca_user_key_show = tatuclient.v1.cli.ca:ShowCAUserKeyCommand - sshca_host_key_show = tatuclient.v1.cli.ca:ShowCAHostKeyCommand [build_sphinx] builders = html,man diff --git a/tatuclient/utils.py b/tatuclient/utils.py index 0aba1d5..a7df41b 100644 --- a/tatuclient/utils.py +++ b/tatuclient/utils.py @@ -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) diff --git a/tatuclient/v1/cli/ca.py b/tatuclient/v1/cli/ca.py index 9ef14d2..f2c712f 100644 --- a/tatuclient/v1/cli/ca.py +++ b/tatuclient/v1/cli/ca.py @@ -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""" diff --git a/tatuclient/v1/cli/hostcert.py b/tatuclient/v1/cli/hostcert.py index b62028c..4967962 100644 --- a/tatuclient/v1/cli/hostcert.py +++ b/tatuclient/v1/cli/hostcert.py @@ -24,8 +24,8 @@ from tatuclient.v1.utils import get_all LOG = logging.getLogger(__name__) -_columns = ['host_id', 'srv_url', 'pat_bastions', 'fingerprint'] -_names = ['Instance ID', 'SRV URL', 'PAT Bastions', 'Fingerprint'] +_columns = ['host_id', 'hostname', 'srv_url', 'pat_bastions', 'fingerprint'] +_names = ['Instance ID', 'Hostname', 'SRV URL', 'PAT Bastions', 'Fingerprint'] 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'])) diff --git a/tatuclient/v1/cli/usercert.py b/tatuclient/v1/cli/usercert.py index 3e2f931..d012841 100644 --- a/tatuclient/v1/cli/usercert.py +++ b/tatuclient/v1/cli/usercert.py @@ -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):