Skip to content

Commit 72fd85c

Browse files
committed
Make default project id optional for keystone user
Some users such as heat_stack_domain_admin does not belong to any projects, so we should omit default project.
1 parent 4f4f94d commit 72fd85c

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

modules/openstack/user.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,14 @@ func (o *OpenStack) CreateUser(
5858
userID = user.ID
5959
} else {
6060
createOpts := users.CreateOpts{
61-
Name: u.Name,
62-
DefaultProjectID: u.ProjectID,
63-
Password: u.Password,
64-
DomainID: u.DomainID,
61+
Name: u.Name,
62+
Password: u.Password,
63+
DomainID: u.DomainID,
6564
}
65+
if u.ProjectID != "" {
66+
createOpts.DefaultProjectID = u.ProjectID
67+
}
68+
6669
user, err := users.Create(o.GetOSClient(), createOpts).Extract()
6770
if err != nil {
6871
return userID, err

0 commit comments

Comments
 (0)