Skip to content

Commit b6a8822

Browse files
Jenkinsopenstack-gerrit
authored andcommitted
Merge "Warning for empty password set for user create/set"
2 parents 2be2190 + 3770ad0 commit b6a8822

3 files changed

Lines changed: 26 additions & 0 deletions

File tree

openstackclient/identity/v2_0/user.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ def take_action(self, parsed_args):
9494
if parsed_args.password_prompt:
9595
parsed_args.password = utils.get_password(self.app.stdin)
9696

97+
if not parsed_args.password:
98+
LOG.warning(_("No password was supplied, authentication will fail "
99+
"when a user does not have a password."))
100+
97101
try:
98102
user = identity_client.users.create(
99103
parsed_args.name,
@@ -292,6 +296,10 @@ def take_action(self, parsed_args):
292296
if parsed_args.password_prompt:
293297
parsed_args.password = utils.get_password(self.app.stdin)
294298

299+
if '' == parsed_args.password:
300+
LOG.warning(_("No password was supplied, authentication will fail "
301+
"when a user does not have a password."))
302+
295303
user = utils.find_resource(
296304
identity_client.users,
297305
parsed_args.user,

openstackclient/identity/v3/user.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@ def take_action(self, parsed_args):
110110
if parsed_args.password_prompt:
111111
parsed_args.password = utils.get_password(self.app.stdin)
112112

113+
if not parsed_args.password:
114+
LOG.warning(_("No password was supplied, authentication will fail "
115+
"when a user does not have a password."))
116+
113117
try:
114118
user = identity_client.users.create(
115119
name=parsed_args.name,
@@ -329,6 +333,10 @@ def take_action(self, parsed_args):
329333
if parsed_args.password_prompt:
330334
parsed_args.password = utils.get_password(self.app.stdin)
331335

336+
if '' == parsed_args.password:
337+
LOG.warning(_("No password was supplied, authentication will fail "
338+
"when a user does not have a password."))
339+
332340
user = utils.find_resource(
333341
identity_client.users,
334342
parsed_args.user,
@@ -408,6 +416,10 @@ def take_action(self, parsed_args):
408416
password = utils.get_password(
409417
self.app.stdin, prompt="New Password:")
410418

419+
if '' == password:
420+
LOG.warning(_("No password was supplied, authentication will fail "
421+
"when a user does not have a password."))
422+
411423
identity_client.users.update_password(current_password, password)
412424

413425

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
fixes:
3+
- |
4+
A warning message will be shown when an empty password is used
5+
for ``user create`` and ``user set`` operations.
6+
[Bug `1607959 <https://bugs.launchpad.net/bugs/1607959>`_]

0 commit comments

Comments
 (0)