diff options
Diffstat (limited to 'openstackclient')
| -rw-r--r-- | openstackclient/compute/v2/keypair.py | 23 | ||||
| -rw-r--r-- | openstackclient/identity/v2_0/user.py | 8 | ||||
| -rw-r--r-- | openstackclient/identity/v3/user.py | 12 | ||||
| -rw-r--r-- | openstackclient/tests/unit/compute/v2/test_keypair.py | 3 |
4 files changed, 33 insertions, 13 deletions
diff --git a/openstackclient/compute/v2/keypair.py b/openstackclient/compute/v2/keypair.py index d30fd429..d5c682f4 100644 --- a/openstackclient/compute/v2/keypair.py +++ b/openstackclient/compute/v2/keypair.py @@ -32,19 +32,20 @@ LOG = logging.getLogger(__name__) class CreateKeypair(command.ShowOne): - """Create new public key""" + """Create new public or private key for server ssh access""" def get_parser(self, prog_name): parser = super(CreateKeypair, self).get_parser(prog_name) parser.add_argument( 'name', metavar='<name>', - help=_("New public key name") + help=_("New public or private key name") ) parser.add_argument( '--public-key', metavar='<file>', - help=_("Filename for public key to add") + help=_("Filename for public key to add. If not used, " + "creates a private key.") ) return parser @@ -82,7 +83,7 @@ class CreateKeypair(command.ShowOne): class DeleteKeypair(command.Command): - """Delete public key(s)""" + """Delete public or private key(s)""" def get_parser(self, prog_name): parser = super(DeleteKeypair, self).get_parser(prog_name) @@ -90,7 +91,7 @@ class DeleteKeypair(command.Command): 'name', metavar='<key>', nargs='+', - help=_("Public key(s) to delete (name only)") + help=_("Name of key(s) to delete (name only)") ) return parser @@ -104,19 +105,19 @@ class DeleteKeypair(command.Command): compute_client.keypairs.delete(data.name) except Exception as e: result += 1 - LOG.error(_("Failed to delete public key with name " + LOG.error(_("Failed to delete key with name " "'%(name)s': %(e)s") % {'name': n, 'e': e}) if result > 0: total = len(parsed_args.name) - msg = (_("%(result)s of %(total)s public keys failed " + msg = (_("%(result)s of %(total)s keys failed " "to delete.") % {'result': result, 'total': total}) raise exceptions.CommandError(msg) class ListKeypair(command.Lister): - """List public key fingerprints""" + """List key fingerprints""" def take_action(self, parsed_args): compute_client = self.app.client_manager.compute @@ -133,20 +134,20 @@ class ListKeypair(command.Lister): class ShowKeypair(command.ShowOne): - """Display public key details""" + """Display key details""" def get_parser(self, prog_name): parser = super(ShowKeypair, self).get_parser(prog_name) parser.add_argument( 'name', metavar='<key>', - help=_("Public key to display (name only)") + help=_("Public or private key to display (name only)") ) parser.add_argument( '--public-key', action='store_true', default=False, - help=_("Show only bare public key (name only)") + help=_("Show only bare public key paired with the generated key") ) return parser diff --git a/openstackclient/identity/v2_0/user.py b/openstackclient/identity/v2_0/user.py index d2075150..bc091ce7 100644 --- a/openstackclient/identity/v2_0/user.py +++ b/openstackclient/identity/v2_0/user.py @@ -94,6 +94,10 @@ class CreateUser(command.ShowOne): if parsed_args.password_prompt: parsed_args.password = utils.get_password(self.app.stdin) + if not parsed_args.password: + LOG.warning(_("No password was supplied, authentication will fail " + "when a user does not have a password.")) + try: user = identity_client.users.create( parsed_args.name, @@ -292,6 +296,10 @@ class SetUser(command.Command): if parsed_args.password_prompt: parsed_args.password = utils.get_password(self.app.stdin) + if '' == parsed_args.password: + LOG.warning(_("No password was supplied, authentication will fail " + "when a user does not have a password.")) + user = utils.find_resource( identity_client.users, parsed_args.user, diff --git a/openstackclient/identity/v3/user.py b/openstackclient/identity/v3/user.py index dc47ef8d..1e086fb6 100644 --- a/openstackclient/identity/v3/user.py +++ b/openstackclient/identity/v3/user.py @@ -110,6 +110,10 @@ class CreateUser(command.ShowOne): if parsed_args.password_prompt: parsed_args.password = utils.get_password(self.app.stdin) + if not parsed_args.password: + LOG.warning(_("No password was supplied, authentication will fail " + "when a user does not have a password.")) + try: user = identity_client.users.create( name=parsed_args.name, @@ -329,6 +333,10 @@ class SetUser(command.Command): if parsed_args.password_prompt: parsed_args.password = utils.get_password(self.app.stdin) + if '' == parsed_args.password: + LOG.warning(_("No password was supplied, authentication will fail " + "when a user does not have a password.")) + user = utils.find_resource( identity_client.users, parsed_args.user, @@ -408,6 +416,10 @@ class SetPasswordUser(command.Command): password = utils.get_password( self.app.stdin, prompt="New Password:") + if '' == password: + LOG.warning(_("No password was supplied, authentication will fail " + "when a user does not have a password.")) + identity_client.users.update_password(current_password, password) diff --git a/openstackclient/tests/unit/compute/v2/test_keypair.py b/openstackclient/tests/unit/compute/v2/test_keypair.py index cb008545..efc5463c 100644 --- a/openstackclient/tests/unit/compute/v2/test_keypair.py +++ b/openstackclient/tests/unit/compute/v2/test_keypair.py @@ -179,8 +179,7 @@ class TestKeypairDelete(TestKeypair): self.cmd.take_action(parsed_args) self.fail('CommandError should be raised.') except exceptions.CommandError as e: - self.assertEqual('1 of 2 public keys failed to delete.', - str(e)) + self.assertEqual('1 of 2 keys failed to delete.', str(e)) find_mock.assert_any_call( self.keypairs_mock, self.keypairs[0].name) |
