diff --git a/heat/engine/clients/os/keystone/heat_keystoneclient.py b/heat/engine/clients/os/keystone/heat_keystoneclient.py index 110b2fa0d5..21131d30b7 100644 --- a/heat/engine/clients/os/keystone/heat_keystoneclient.py +++ b/heat/engine/clients/os/keystone/heat_keystoneclient.py @@ -238,11 +238,11 @@ class KsClientWrapper(object): pass def _get_username(self, username): - if(len(username) > 64): - LOG.warning("Truncating the username %s to the last 64 " + if(len(username) > 255): + LOG.warning("Truncating the username %s to the last 255 " "characters.", username) - # get the last 64 characters of the username - return username[-64:] + # get the last 255 characters of the username + return username[-255:] def create_stack_user(self, username, password=''): """Create a user defined as part of a stack. diff --git a/heat/tests/clients/test_heat_client.py b/heat/tests/clients/test_heat_client.py index ae3ffbce9e..e17427ceb3 100644 --- a/heat/tests/clients/test_heat_client.py +++ b/heat/tests/clients/test_heat_client.py @@ -153,22 +153,22 @@ class KeystoneClientTest(common.HeatTestCase): return mock_ks_auth, mock_auth_ref def test_username_length(self): - """Test that user names >64 characters are properly truncated.""" + """Test that user names >255 characters are properly truncated.""" self._stubs_auth() ctx = utils.dummy_context() ctx.trust_id = None - # a >64 character user name and the expected version - long_user_name = 'U' * 64 + 'S' - good_user_name = long_user_name[-64:] + # a >255 character user name and the expected version + long_user_name = 'U' * 255 + 'S' + good_user_name = 'U' * 254 + 'S' # mock keystone client user functions self.mock_ks_v3_client.users = self.m.CreateMockAnything() mock_user = self.m.CreateMockAnything() mock_user.id = 'auser123' # when keystone is called, the name should have been truncated - # to the last 64 characters of the long name + # to the last 255 characters of the long name self.mock_ks_v3_client.users.create(name=good_user_name, password='password', default_project=ctx.tenant_id diff --git a/heat_integrationtests/common/test.py b/heat_integrationtests/common/test.py index f2e7dd75c2..842f4e774b 100644 --- a/heat_integrationtests/common/test.py +++ b/heat_integrationtests/common/test.py @@ -61,7 +61,7 @@ def call_until_true(duration, sleep_for, func, *args, **kwargs): def rand_name(name=''): - randbits = str(random.randint(1, 0x7fffffff)) + randbits = six.text_type(random.randint(1, 0x7fffffff)) if name: return name + '-' + randbits else: diff --git a/releasenotes/notes/change-heat-keystone-user-name-limit-to-255-bd076132b98744be.yaml b/releasenotes/notes/change-heat-keystone-user-name-limit-to-255-bd076132b98744be.yaml new file mode 100644 index 0000000000..eeaf4fc767 --- /dev/null +++ b/releasenotes/notes/change-heat-keystone-user-name-limit-to-255-bd076132b98744be.yaml @@ -0,0 +1,5 @@ +--- +other: + - Now heat keystone user name charaters limit increased from 64 to 255. + Any extra charaters will lost when truncate the name to the last 255 + charaters.