File tree Expand file tree Collapse file tree 1 file changed +14
-15
lines changed
pkg/multicloud/esxi/provider Expand file tree Collapse file tree 1 file changed +14
-15
lines changed Original file line number Diff line number Diff line change @@ -154,22 +154,21 @@ func (self *SESXiProviderFactory) GetClientRC(info cloudprovider.SProviderInfo)
154154 }, nil
155155}
156156
157- func (self * SESXiProviderFactory ) GetAccountIdEqualizer () func (origin , now string ) bool {
158- return func (origin , now string ) bool {
159- if len (now ) == 0 {
160- return true
161- }
162- originUserName , nowUserName := origin , now
163- index1 := strings .Index (origin , "@" )
164- index2 := strings .Index (now , "@" )
165- if index1 != - 1 {
166- originUserName = originUserName [:index1 ]
167- }
168- if index2 != - 1 {
169- nowUserName = nowUserName [:index2 ]
170- }
171- return originUserName == nowUserName
157+ // admin@vsphere.local@192.168.1.100:443 test@vsphere.local@192.168.1.100:443
158+ func isAccountEqual (origin , now string ) bool {
159+ if len (now ) == 0 {
160+ return true
172161 }
162+ host := origin
163+ hostIdx := strings .LastIndex (origin , "@" )
164+ if hostIdx > 0 {
165+ host = origin [hostIdx + 1 :]
166+ }
167+ return strings .HasSuffix (now , host )
168+ }
169+
170+ func (self * SESXiProviderFactory ) GetAccountIdEqualizer () func (origin , now string ) bool {
171+ return isAccountEqual
173172}
174173
175174func init () {
You can’t perform that action at this time.
0 commit comments