Skip to content

Commit 58210a1

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "fix(keystone): correct the args submitted on user creation"
2 parents 8dbb712 + 0b05fd8 commit 58210a1

File tree

3 files changed

+9
-43
lines changed

3 files changed

+9
-43
lines changed

openstackclient/identity/v3/user.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,9 @@ def take_action(self, parsed_args):
299299
"when a user does not have a password."
300300
)
301301
)
302+
else:
303+
kwargs['password'] = password
304+
302305
options = _get_options_for_user(identity_client, parsed_args)
303306
if options:
304307
kwargs['options'] = options
@@ -307,7 +310,6 @@ def take_action(self, parsed_args):
307310
user = identity_client.create_user(
308311
is_enabled=is_enabled,
309312
name=parsed_args.name,
310-
password=password,
311313
**kwargs,
312314
)
313315
except sdk_exc.ConflictException:

openstackclient/tests/unit/identity/v3/test_user.py

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ def test_user_create_no_options(self):
9494
kwargs = {
9595
'name': self.user.name,
9696
'is_enabled': True,
97-
'password': None,
9897
}
9998
self.identity_sdk_client.create_user.assert_called_with(**kwargs)
10099

@@ -138,7 +137,6 @@ def test_user_create_password_prompt(self):
138137
self.user.name,
139138
]
140139
verifylist = [
141-
('password', None),
142140
('password_prompt', True),
143141
('enable', False),
144142
('disable', False),
@@ -171,7 +169,6 @@ def test_user_create_password_prompt_no_warning(self):
171169
self.user.name,
172170
]
173171
verifylist = [
174-
('password', None),
175172
('password_prompt', True),
176173
('enable', False),
177174
('disable', False),
@@ -236,7 +233,6 @@ def test_user_create_email(self):
236233
'name': self.user.name,
237234
'email': 'barney@example.com',
238235
'is_enabled': True,
239-
'password': None,
240236
}
241237
self.identity_sdk_client.create_user.assert_called_with(**kwargs)
242238

@@ -267,7 +263,6 @@ def test_user_create_project(self):
267263
'name': self.user.name,
268264
'default_project_id': self.project.id,
269265
'is_enabled': True,
270-
'password': None,
271266
}
272267
self.identity_sdk_client.create_user.assert_called_with(**kwargs)
273268

@@ -312,7 +307,6 @@ def test_user_create_project_domain(self):
312307
'name': self.user.name,
313308
'default_project_id': self.project.id,
314309
'is_enabled': True,
315-
'password': None,
316310
}
317311
self.identity_sdk_client.create_user.assert_called_once_with(**kwargs)
318312
self.identity_sdk_client.find_domain.assert_called_once_with(
@@ -357,7 +351,6 @@ def test_user_create_domain(self):
357351
'name': self.user.name,
358352
'domain_id': self.domain.id,
359353
'is_enabled': True,
360-
'password': None,
361354
}
362355
self.identity_sdk_client.create_user.assert_called_with(**kwargs)
363356

@@ -385,7 +378,6 @@ def test_user_create_enable(self):
385378
kwargs = {
386379
'name': self.user.name,
387380
'is_enabled': True,
388-
'password': None,
389381
}
390382
self.identity_sdk_client.create_user.assert_called_with(**kwargs)
391383

@@ -413,7 +405,6 @@ def test_user_create_disable(self):
413405
kwargs = {
414406
'name': self.user.name,
415407
'is_enabled': False,
416-
'password': None,
417408
}
418409
self.identity_sdk_client.create_user.assert_called_with(**kwargs)
419410

@@ -443,7 +434,6 @@ def test_user_create_ignore_lockout_failure_attempts(self):
443434
'name': self.user.name,
444435
'is_enabled': True,
445436
'options': {'ignore_lockout_failure_attempts': True},
446-
'password': None,
447437
}
448438
self.identity_sdk_client.create_user.assert_called_with(**kwargs)
449439

@@ -473,7 +463,6 @@ def test_user_create_no_ignore_lockout_failure_attempts(self):
473463
'name': self.user.name,
474464
'is_enabled': True,
475465
'options': {'ignore_lockout_failure_attempts': False},
476-
'password': None,
477466
}
478467
self.identity_sdk_client.create_user.assert_called_with(**kwargs)
479468

@@ -503,7 +492,6 @@ def test_user_create_ignore_password_expiry(self):
503492
'name': self.user.name,
504493
'is_enabled': True,
505494
'options': {'ignore_password_expiry': True},
506-
'password': None,
507495
}
508496
self.identity_sdk_client.create_user.assert_called_with(**kwargs)
509497

@@ -533,7 +521,6 @@ def test_user_create_no_ignore_password_expiry(self):
533521
'name': self.user.name,
534522
'is_enabled': True,
535523
'options': {'ignore_password_expiry': False},
536-
'password': None,
537524
}
538525
self.identity_sdk_client.create_user.assert_called_with(**kwargs)
539526

@@ -563,7 +550,6 @@ def test_user_create_ignore_change_password_upon_first_use(self):
563550
'name': self.user.name,
564551
'is_enabled': True,
565552
'options': {'ignore_change_password_upon_first_use': True},
566-
'password': None,
567553
}
568554
self.identity_sdk_client.create_user.assert_called_with(**kwargs)
569555

@@ -593,7 +579,6 @@ def test_user_create_no_ignore_change_password_upon_first_use(self):
593579
'name': self.user.name,
594580
'is_enabled': True,
595581
'options': {'ignore_change_password_upon_first_use': False},
596-
'password': None,
597582
}
598583
self.identity_sdk_client.create_user.assert_called_with(**kwargs)
599584

@@ -623,7 +608,6 @@ def test_user_create_enables_lock_password(self):
623608
'name': self.user.name,
624609
'is_enabled': True,
625610
'options': {'lock_password': True},
626-
'password': None,
627611
}
628612
self.identity_sdk_client.create_user.assert_called_with(**kwargs)
629613

@@ -653,7 +637,6 @@ def test_user_create_disables_lock_password(self):
653637
'name': self.user.name,
654638
'is_enabled': True,
655639
'options': {'lock_password': False},
656-
'password': None,
657640
}
658641
self.identity_sdk_client.create_user.assert_called_with(**kwargs)
659642

@@ -683,7 +666,6 @@ def test_user_create_enable_multi_factor_auth(self):
683666
'name': self.user.name,
684667
'is_enabled': True,
685668
'options': {'multi_factor_auth_enabled': True},
686-
'password': None,
687669
}
688670
self.identity_sdk_client.create_user.assert_called_with(**kwargs)
689671

@@ -713,7 +695,6 @@ def test_user_create_disable_multi_factor_auth(self):
713695
'name': self.user.name,
714696
'is_enabled': True,
715697
'options': {'multi_factor_auth_enabled': False},
716-
'password': None,
717698
}
718699
self.identity_sdk_client.create_user.assert_called_with(**kwargs)
719700

@@ -751,7 +732,6 @@ def test_user_create_option_with_multi_factor_auth_rule(self):
751732
'options': {
752733
'multi_factor_auth_rules': [["password", "totp"], ["password"]]
753734
},
754-
'password': None,
755735
}
756736
self.identity_sdk_client.create_user.assert_called_with(**kwargs)
757737

@@ -790,7 +770,6 @@ def test_user_create_with_multiple_options(self):
790770
'multi_factor_auth_enabled': False,
791771
'multi_factor_auth_rules': [["password", "totp"]],
792772
},
793-
'password': None,
794773
}
795774
self.identity_sdk_client.create_user.assert_called_with(**kwargs)
796775

@@ -1084,7 +1063,6 @@ def test_user_set_no_options(self):
10841063
]
10851064
verifylist = [
10861065
('name', None),
1087-
('password', None),
10881066
('email', None),
10891067
('project', None),
10901068
('enable', False),
@@ -1105,7 +1083,6 @@ def test_user_set_name(self):
11051083
]
11061084
verifylist = [
11071085
('name', 'qwerty'),
1108-
('password', None),
11091086
('email', None),
11101087
('project', None),
11111088
('enable', False),
@@ -1136,7 +1113,6 @@ def test_user_set_specify_domain(self):
11361113
]
11371114
verifylist = [
11381115
('name', 'qwerty'),
1139-
('password', None),
11401116
('domain', self.domain.id),
11411117
('email', None),
11421118
('project', None),
@@ -1192,7 +1168,6 @@ def test_user_set_password_prompt(self):
11921168
]
11931169
verifylist = [
11941170
('name', None),
1195-
('password', None),
11961171
('password_prompt', True),
11971172
('email', None),
11981173
('project', None),
@@ -1225,7 +1200,6 @@ def test_user_set_email(self):
12251200
]
12261201
verifylist = [
12271202
('name', None),
1228-
('password', None),
12291203
('email', 'barney@example.com'),
12301204
('project', None),
12311205
('enable', False),
@@ -1254,7 +1228,6 @@ def test_user_set_project(self):
12541228
]
12551229
verifylist = [
12561230
('name', None),
1257-
('password', None),
12581231
('email', None),
12591232
('project', self.project.id),
12601233
('enable', False),
@@ -1296,7 +1269,6 @@ def test_user_set_project_domain(self):
12961269
]
12971270
verifylist = [
12981271
('name', None),
1299-
('password', None),
13001272
('email', None),
13011273
('project', self.project.id),
13021274
('project_domain', self.project.domain_id),
@@ -1330,7 +1302,6 @@ def test_user_set_enable(self):
13301302
]
13311303
verifylist = [
13321304
('name', None),
1333-
('password', None),
13341305
('email', None),
13351306
('project', None),
13361307
('enable', True),
@@ -1357,7 +1328,6 @@ def test_user_set_disable(self):
13571328
]
13581329
verifylist = [
13591330
('name', None),
1360-
('password', None),
13611331
('email', None),
13621332
('project', None),
13631333
('enable', False),
@@ -1384,7 +1354,6 @@ def test_user_set_ignore_lockout_failure_attempts(self):
13841354
]
13851355
verifylist = [
13861356
('name', None),
1387-
('password', None),
13881357
('email', None),
13891358
('ignore_lockout_failure_attempts', True),
13901359
('project', None),
@@ -1412,7 +1381,6 @@ def test_user_set_no_ignore_lockout_failure_attempts(self):
14121381
]
14131382
verifylist = [
14141383
('name', None),
1415-
('password', None),
14161384
('email', None),
14171385
('no_ignore_lockout_failure_attempts', True),
14181386
('project', None),
@@ -1440,7 +1408,6 @@ def test_user_set_ignore_password_expiry(self):
14401408
]
14411409
verifylist = [
14421410
('name', None),
1443-
('password', None),
14441411
('email', None),
14451412
('ignore_password_expiry', True),
14461413
('project', None),
@@ -1468,7 +1435,6 @@ def test_user_set_no_ignore_password_expiry(self):
14681435
]
14691436
verifylist = [
14701437
('name', None),
1471-
('password', None),
14721438
('email', None),
14731439
('no_ignore_password_expiry', True),
14741440
('project', None),
@@ -1496,7 +1462,6 @@ def test_user_set_ignore_change_password_upon_first_use(self):
14961462
]
14971463
verifylist = [
14981464
('name', None),
1499-
('password', None),
15001465
('email', None),
15011466
('ignore_change_password_upon_first_use', True),
15021467
('project', None),
@@ -1524,7 +1489,6 @@ def test_user_set_no_ignore_change_password_upon_first_use(self):
15241489
]
15251490
verifylist = [
15261491
('name', None),
1527-
('password', None),
15281492
('email', None),
15291493
('no_ignore_change_password_upon_first_use', True),
15301494
('project', None),
@@ -1552,7 +1516,6 @@ def test_user_set_enable_lock_password(self):
15521516
]
15531517
verifylist = [
15541518
('name', None),
1555-
('password', None),
15561519
('email', None),
15571520
('enable_lock_password', True),
15581521
('project', None),
@@ -1580,7 +1543,6 @@ def test_user_set_disable_lock_password(self):
15801543
]
15811544
verifylist = [
15821545
('name', None),
1583-
('password', None),
15841546
('email', None),
15851547
('disable_lock_password', True),
15861548
('project', None),
@@ -1608,7 +1570,6 @@ def test_user_set_enable_multi_factor_auth(self):
16081570
]
16091571
verifylist = [
16101572
('name', None),
1611-
('password', None),
16121573
('email', None),
16131574
('enable_multi_factor_auth', True),
16141575
('project', None),
@@ -1636,7 +1597,6 @@ def test_user_set_disable_multi_factor_auth(self):
16361597
]
16371598
verifylist = [
16381599
('name', None),
1639-
('password', None),
16401600
('email', None),
16411601
('disable_multi_factor_auth', True),
16421602
('project', None),
@@ -1665,7 +1625,6 @@ def test_user_set_option_multi_factor_auth_rule(self):
16651625
]
16661626
verifylist = [
16671627
('name', None),
1668-
('password', None),
16691628
('email', None),
16701629
('multi_factor_auth_rules', [identity_fakes.mfa_opt1]),
16711630
('project', None),
@@ -1697,7 +1656,6 @@ def test_user_set_with_multiple_options(self):
16971656
]
16981657
verifylist = [
16991658
('name', None),
1700-
('password', None),
17011659
('email', None),
17021660
('ignore_password_expiry', True),
17031661
('enable_multi_factor_auth', True),
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
fixes:
3+
- |
4+
[Bug `2136148 <https://bugs.launchpad.net/bugs/2136148>`_] Keystone allows
5+
users to be created with no password but no value should be submitted for
6+
the password instead of a ``null`` value.

0 commit comments

Comments
 (0)