Skip to content

Commit 61ed30b

Browse files
committed
Fail when multiple users with the same name found
... to avoid using the wrong user.
1 parent 72fd85c commit 61ed30b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

modules/openstack/user.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ func (o *OpenStack) GetUser(
9595

9696
if len(allUsers) == 0 {
9797
return nil, fmt.Errorf(fmt.Sprintf("%s %s", userName, UserNotFound))
98+
} else if len(allUsers) > 1 {
99+
return nil, fmt.Errorf(fmt.Sprintf("multiple users named \"%s\" found", userName))
98100
}
99101

100102
return &allUsers[0], nil

0 commit comments

Comments
 (0)