Repository: cloudstack Updated Branches: refs/heads/master c38a15f6e -> 0a7af329f
CLOUDSTACK-7255: Fixed marvin issue related to creating random account usernames Signed-off-by: Santhosh Edukulla <santhosh.eduku...@gmail.com> Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/0a7af329 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/0a7af329 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/0a7af329 Branch: refs/heads/master Commit: 0a7af329f5386fa5fb2a2f9ebc02a2ca38bb9b17 Parents: c38a15f Author: Gaurav Aradhye <gaurav.arad...@clogeny.com> Authored: Wed Aug 6 15:13:38 2014 +0530 Committer: Santhosh Edukulla <santhosh.eduku...@gmail.com> Committed: Wed Aug 6 15:54:07 2014 +0530 ---------------------------------------------------------------------- tools/marvin/marvin/lib/base.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0a7af329/tools/marvin/marvin/lib/base.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/lib/base.py b/tools/marvin/marvin/lib/base.py index 3a1f7e6..80596fc 100755 --- a/tools/marvin/marvin/lib/base.py +++ b/tools/marvin/marvin/lib/base.py @@ -104,11 +104,13 @@ class Account: cmd.lastname = services["lastname"] cmd.password = services["password"] - - username = "-".join([services["username"], - random_gen(id=apiclient.id)]) - # Trim username to 99 characters to prevent failure - cmd.username = username[:99] if len(username) > 99 else username + username = services["username"] + # Limit account username to 99 chars to avoid failure + # 6 chars start string + 85 chars apiclientid + 6 chars random string + 2 chars joining hyphen string = 99 + username = username[:6] + apiclientid = apiclient.id[-85:] if len(apiclient.id) > 85 else apiclient.id + cmd.username = "-".join([username, + random_gen(id=apiclientid, size=6)]) if "accountUUID" in services: cmd.accountid = "-".join([services["accountUUID"], random_gen()])