From 329120822298080588464f8a72c049e119404931 Mon Sep 17 00:00:00 2001 From: Hua Wang Date: Fri, 8 Apr 2016 15:47:30 +0800 Subject: [PATCH] Parameter format change for ca-show and ca-sign The parameter format for ca-show and ca-sign is not consistent with other cmds. Closes-Bug: #1567812 Change-Id: If75d3d00983e0db185b7edb993d8b6761716ff1d --- magnumclient/tests/v1/test_certificates_shell.py | 10 +++++----- magnumclient/v1/certificates_shell.py | 12 +++++------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/magnumclient/tests/v1/test_certificates_shell.py b/magnumclient/tests/v1/test_certificates_shell.py index 3d79eee6..c34b9b42 100644 --- a/magnumclient/tests/v1/test_certificates_shell.py +++ b/magnumclient/tests/v1/test_certificates_shell.py @@ -27,7 +27,7 @@ class ShellTest(shell_test_base.TestCommandLineArgument): mockbay.status = "CREATE_COMPLETE" mock_bay_get.return_value = mockbay self._test_arg_success('ca-show ' - '--bay xxx') + 'xxx') self.assertTrue(mock_cert_get.called) @mock.patch('os.path.isfile') @@ -44,8 +44,8 @@ class ShellTest(shell_test_base.TestCommandLineArgument): file_mock = mock.mock_open(read_data=fake_csr) with mock.patch.object(certificates_shell, 'open', file_mock): self._test_arg_success('ca-sign ' - '--csr path/csr.pem ' - '--bay xxx') + 'xxx ' + 'path/csr.pem') self.assertTrue(mock_cert_create.called) @mock.patch('os.path.isfile') @@ -62,8 +62,8 @@ class ShellTest(shell_test_base.TestCommandLineArgument): file_mock = mock.mock_open(read_data=fake_csr) with mock.patch.object(certificates_shell, 'open', file_mock): self._test_arg_success('ca-sign ' - '--csr path/csr.pem ' - '--bay xxx') + 'xxx ' + 'path/csr.pem') mock_isfile.assert_called_once_with('path/csr.pem') self.assertFalse(file_mock.called) self.assertFalse(mock_cert_create.called) diff --git a/magnumclient/v1/certificates_shell.py b/magnumclient/v1/certificates_shell.py index 092e62cd..510232f0 100644 --- a/magnumclient/v1/certificates_shell.py +++ b/magnumclient/v1/certificates_shell.py @@ -21,8 +21,7 @@ def _show_cert(certificate): print(certificate.pem) -@utils.arg('--bay', - required=True, +@utils.arg('bay', metavar='', help='ID or name of the bay.') def do_ca_show(cs, args): @@ -36,13 +35,12 @@ def do_ca_show(cs, args): _show_cert(cert) -@utils.arg('--csr', - metavar='', - help='File path of the csr file to send to Magnum to get signed.') -@utils.arg('--bay', - required=True, +@utils.arg('bay', metavar='', help='ID or name of the bay.') +@utils.arg('csr', + metavar='', + help='File path of the csr file to send to Magnum to get signed.') def do_ca_sign(cs, args): """Generate the CA certificate for a bay.""" bay = cs.bays.get(args.bay)