rename root-password to set-password

all references to `root password` have been changed to `admin password`
but the `root-password` command remained. This changes it to
`set-password` which is less ambiguous and consistent with existing
commands `clear-password` and `get-password`

Change-Id: I8683e4ecd4d9294989eb3d8d27d1fb75c16b261b
This commit is contained in:
James Penick 2015-07-22 16:23:31 +00:00
parent a80ac8523a
commit 3bf6f8fe99
3 changed files with 18 additions and 4 deletions

View File

@ -146,7 +146,7 @@ class ShellTest(utils.TestCase):
def test_help(self):
required = [
'.*?^usage: ',
'.*?^\s+root-password\s+Change the admin password',
'.*?^\s+set-password\s+Change the admin password',
'.*?^See "nova help COMMAND" for help on a specific command',
]
stdout, stderr = self.shell('help')
@ -156,11 +156,11 @@ class ShellTest(utils.TestCase):
def test_help_on_subcommand(self):
required = [
'.*?^usage: nova root-password',
'.*?^usage: nova set-password',
'.*?^Change the admin password',
'.*?^Positional arguments:',
]
stdout, stderr = self.shell('help root-password')
stdout, stderr = self.shell('help set-password')
for r in required:
self.assertThat((stdout + stderr),
matchers.MatchesRegex(r, re.DOTALL | re.MULTILINE))
@ -168,7 +168,7 @@ class ShellTest(utils.TestCase):
def test_help_no_options(self):
required = [
'.*?^usage: ',
'.*?^\s+root-password\s+Change the admin password',
'.*?^\s+set-password\s+Change the admin password',
'.*?^See "nova help COMMAND" for help on a specific command',
]
stdout, stderr = self.shell('')

View File

@ -1061,6 +1061,14 @@ class ShellTest(utils.TestCase):
self.assert_called('POST', '/servers/1234/action',
{'revertResize': None})
@mock.patch('getpass.getpass', mock.Mock(return_value='p'))
def test_set_password(self):
self.run_command('set-password sample-server')
self.assert_called('POST', '/servers/1234/action',
{'changePassword': {'adminPass': 'p'}})
# root-password is deprecated, keeping this arond until it's removed
# entirely - penick
@mock.patch('getpass.getpass', mock.Mock(return_value='p'))
def test_root_password(self):
self.run_command('root-password sample-server')

View File

@ -1730,6 +1730,12 @@ def do_refresh_network(cs, args):
@cliutils.arg('server', metavar='<server>', help=_('Name or ID of server.'))
def do_root_password(cs, args):
"""DEPRECATED, use set-password instead."""
do_set_password(cs, args)
@cliutils.arg('server', metavar='<server>', help=_('Name or ID of server.'))
def do_set_password(cs, args):
"""
Change the admin password for a server.
"""