From a5ea58fec9f655e0ddc1a341f3e27086bf0eaa4b Mon Sep 17 00:00:00 2001 From: James Penick Date: Wed, 28 Jan 2015 22:30:03 +0000 Subject: [PATCH] Refer to the admin password consistently The docstrings refer to instance passwords as the admin password, root password, or simply as "password". That makes documentation difficult to understand. I've cleaned things up where appropriate. I did not change the 'root-password' command in this patch, im planning to do that in a separate patch. Cleaning that up to have everything refer to the instance password as "admin password" for clarity. Change-Id: I421edcaf18bf8536d5e43f71db6e868868154be3 --- novaclient/tests/unit/test_shell.py | 6 +++--- novaclient/v1_1/servers.py | 26 +++++++++++++++++--------- novaclient/v1_1/shell.py | 12 ++++++------ 3 files changed, 26 insertions(+), 18 deletions(-) diff --git a/novaclient/tests/unit/test_shell.py b/novaclient/tests/unit/test_shell.py index 794e88a3e..9e9079637 100644 --- a/novaclient/tests/unit/test_shell.py +++ b/novaclient/tests/unit/test_shell.py @@ -139,7 +139,7 @@ class ShellTest(utils.TestCase): def test_help(self): required = [ '.*?^usage: ', - '.*?^\s+root-password\s+Change the root password', + '.*?^\s+root-password\s+Change the admin password', '.*?^See "nova help COMMAND" for help on a specific command', ] stdout, stderr = self.shell('help') @@ -150,7 +150,7 @@ class ShellTest(utils.TestCase): def test_help_on_subcommand(self): required = [ '.*?^usage: nova root-password', - '.*?^Change the root password', + '.*?^Change the admin password', '.*?^Positional arguments:', ] stdout, stderr = self.shell('help root-password') @@ -161,7 +161,7 @@ class ShellTest(utils.TestCase): def test_help_no_options(self): required = [ '.*?^usage: ', - '.*?^\s+root-password\s+Change the root password', + '.*?^\s+root-password\s+Change the admin password', '.*?^See "nova help COMMAND" for help on a specific command', ] stdout, stderr = self.shell('') diff --git a/novaclient/v1_1/servers.py b/novaclient/v1_1/servers.py index fb998ac27..ef3974fba 100644 --- a/novaclient/v1_1/servers.py +++ b/novaclient/v1_1/servers.py @@ -252,7 +252,9 @@ class Server(base.Resource): def change_password(self, password): """ - Update the password for a server. + Update the admin password for a server. + + :param password: string to set as the admin password on the server """ self.manager.change_password(self, password) @@ -271,7 +273,8 @@ class Server(base.Resource): Rebuild -- shut down and then re-image -- this server. :param image: the :class:`Image` (or its ID) to re-image with. - :param password: string to set as password on the rebuilt server. + :param password: string to set as the admin password on the rebuilt + server. :param preserve_ephemeral: If True, request that any ephemeral device be preserved when rebuilding the instance. Defaults to False. """ @@ -384,7 +387,8 @@ class Server(base.Resource): :param host: Name of the target host :param on_shared_storage: Specifies whether instance files located on shared storage - :param password: string to set as password on the evacuated server. + :param password: string to set as admin password on the evacuated + server. """ return self.manager.evacuate(self, host, on_shared_storage, password) @@ -713,14 +717,15 @@ class ServerManager(base.BootingManagerWithFind): def get_password(self, server, private_key=None): """ - Get password for an instance + Get admin password of an instance - Returns the clear password of an instance if private_key is - provided, returns the ciphered password otherwise. + Returns the admin password of an instance in the clear if private_key + is provided, returns the ciphered password otherwise. Requires that openssl is installed and in the path - :param server: The :class:`Server` (or its ID) to add an IP to. + :param server: The :class:`Server` (or its ID) for which the admin + password is to be returned :param private_key: The private key to decrypt password (optional) """ @@ -737,9 +742,12 @@ class ServerManager(base.BootingManagerWithFind): def clear_password(self, server): """ - Clear password for an instance + Clear the admin password of an instance - :param server: The :class:`Server` (or its ID) to add an IP to. + Remove the admin password for an instance from the metadata server. + + :param server: The :class:`Server` (or its ID) for which the admin + password is to be cleared """ return self._delete("/servers/%s/os-server-password" diff --git a/novaclient/v1_1/shell.py b/novaclient/v1_1/shell.py index 26f70249b..6bfbc5115 100644 --- a/novaclient/v1_1/shell.py +++ b/novaclient/v1_1/shell.py @@ -1440,7 +1440,7 @@ def do_reboot(cs, args): dest='rebuild_password', metavar='', default=False, - help=_("Set the provided password on the rebuild server.")) + help=_("Set the provided admin password on the rebuilt server.")) @cliutils.arg( '--rebuild_password', help=argparse.SUPPRESS) @@ -1712,7 +1712,7 @@ def do_refresh_network(cs, args): @cliutils.arg('server', metavar='', help=_('Name or ID of server.')) def do_root_password(cs, args): """ - Change the root password for a server. + Change the admin password for a server. """ server = _find_server(cs, args.server) p1 = getpass.getpass('New password: ') @@ -2313,7 +2313,7 @@ def do_get_serial_console(cs, args): nargs='?', default=None) def do_get_password(cs, args): - """Get password for a server.""" + """Get the admin password for a server.""" server = _find_server(cs, args.server) data = server.get_password(args.private_key) print(data) @@ -2321,7 +2321,7 @@ def do_get_password(cs, args): @cliutils.arg('server', metavar='', help=_('Name or ID of server.')) def do_clear_password(cs, args): - """Clear password for a server.""" + """Clear the admin password for a server.""" server = _find_server(cs, args.server) server.clear_password() @@ -4158,8 +4158,8 @@ def do_quota_class_update(cs, args): '--password', dest='password', metavar='', - help=_("Set the provided password on the evacuated server. Not applicable " - "with on-shared-storage flag")) + help=_("Set the provided admin password on the evacuated server. Not" + " applicable with on-shared-storage flag")) @cliutils.arg( '--on-shared-storage', dest='on_shared_storage',