summaryrefslogtreecommitdiff
path: root/openstackclient
diff options
context:
space:
mode:
authorqtang <qtang@vmware.com>2016-09-29 15:00:17 +0800
committerSteve Martinelli <s.martinelli@gmail.com>2016-10-19 03:07:54 +0000
commit3770ad08b21b5ad7dd5430e810f1618435b269d5 (patch)
tree6b05f52ac157e0e6c7f1166f564aa703eacc8f7f /openstackclient
parentbae09c3c3fac210f4839a8a51dfb51e2dad69aa7 (diff)
downloadpython-openstackclient-3770ad08b21b5ad7dd5430e810f1618435b269d5.tar.gz
Warning for empty password set for user create/set
Raise warning when empty password set for user Change-Id: If03516f3f1290e4c329fe3d1277dee0512de0410 Closes-Bug: #1607959
Diffstat (limited to 'openstackclient')
-rw-r--r--openstackclient/identity/v2_0/user.py8
-rw-r--r--openstackclient/identity/v3/user.py12
2 files changed, 20 insertions, 0 deletions
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)