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
This commit is contained in:
Hua Wang 2016-04-08 15:47:30 +08:00
parent 71967890b6
commit 3291208222
2 changed files with 10 additions and 12 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 '
'--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)

View File

@ -21,8 +21,7 @@ def _show_cert(certificate):
print(certificate.pem)
@utils.arg('--bay',
required=True,
@utils.arg('bay',
metavar='<bay>',
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='<csr>',
help='File path of the csr file to send to Magnum to get signed.')
@utils.arg('--bay',
required=True,
@utils.arg('bay',
metavar='<bay>',
help='ID or name of the bay.')
@utils.arg('csr',
metavar='<csr>',
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)