Print domain name in mapping_populate error message
domain_id was not defined at the moment when it was referenced and it caused UnboundLocalError. Use domain name instead and test it. Change-Id: Ib351df0942025451994873e272861afec1b60dea Closes-Bug: 1645571
This commit is contained in:
parent
58a7321d71
commit
6b16e2cf88
|
@ -1211,8 +1211,8 @@ class MappingPopulate(BaseApp):
|
|||
try:
|
||||
domain_id = cls.resource_api.get_domain_by_name(domain_name)['id']
|
||||
except exception.DomainNotFound:
|
||||
print(_('Invalid domain name or ID: %(domain)s') % {
|
||||
'domain': domain_id})
|
||||
print(_('Invalid domain name: %(domain)s') % {
|
||||
'domain': domain_name})
|
||||
return False
|
||||
# We don't actually need to tackle id_mapping_api in order to get
|
||||
# entries there, because list_users does this anyway. That's why it
|
||||
|
|
|
@ -678,6 +678,13 @@ class TestMappingPopulate(unit.SQLDriverOverrides, unit.TestCase):
|
|||
self.assertIsNotNone(
|
||||
self.id_mapping_api.get_public_id(local_entity))
|
||||
|
||||
def test_bad_domain_name(self):
|
||||
CONF(args=['mapping_populate', '--domain-name', uuid.uuid4().hex],
|
||||
project='keystone')
|
||||
dependency.reset() # backends are loaded again in the command handler
|
||||
# NOTE: assertEqual is used on purpose. assertFalse passes with None.
|
||||
self.assertEqual(False, cli.MappingPopulate.main())
|
||||
|
||||
|
||||
class CliDomainConfigUploadNothing(unit.BaseTestCase):
|
||||
|
||||
|
|
Loading…
Reference in New Issue