Revert "Parameter format change for ca-show and ca-sign"

This reverts commit 3291208222.
The commit changed CLI options without following the OpenStack
deprecation policy. We'd better to revert it for now.

Change-Id: Ie22f075d29f98e222eda033b452896bedd213662
This commit is contained in:
Hongbin Lu 2016-04-16 14:03:53 +00:00
parent 3291208222
commit c87008017a
2 changed files with 12 additions and 10 deletions

View File

@ -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 '
'xxx')
'--bay 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 '
'xxx '
'path/csr.pem')
'--csr path/csr.pem '
'--bay xxx')
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 '
'xxx '
'path/csr.pem')
'--csr path/csr.pem '
'--bay xxx')
mock_isfile.assert_called_once_with('path/csr.pem')
self.assertFalse(file_mock.called)
self.assertFalse(mock_cert_create.called)

View File

@ -21,7 +21,8 @@ def _show_cert(certificate):
print(certificate.pem)
@utils.arg('bay',
@utils.arg('--bay',
required=True,
metavar='<bay>',
help='ID or name of the bay.')
def do_ca_show(cs, args):
@ -35,12 +36,13 @@ def do_ca_show(cs, args):
_show_cert(cert)
@utils.arg('bay',
metavar='<bay>',
help='ID or name of the bay.')
@utils.arg('csr',
@utils.arg('--csr',
metavar='<csr>',
help='File path of the csr file to send to Magnum to get signed.')
@utils.arg('--bay',
required=True,
metavar='<bay>',
help='ID or name of the bay.')
def do_ca_sign(cs, args):
"""Generate the CA certificate for a bay."""
bay = cs.bays.get(args.bay)