Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherry-pick PR #398 to release-v1.3 #431

Merged
merged 1 commit into from
May 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 7 additions & 15 deletions pkg/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,12 @@
return nil, err
}
creds := prismgoclient.Credentials{
URL: me.Address.Host,
Endpoint: me.Address.Host,
Insecure: me.Insecure,
Username: me.ApiCredentials.Username,
Password: me.ApiCredentials.Password,
URL: me.Address.Host,
Endpoint: me.Address.Host,
Insecure: me.Insecure,
Username: me.ApiCredentials.Username,
Password: me.ApiCredentials.Password,
SessionAuth: true,
}
return Build(creds, me.AdditionalTrustBundle)
}
Expand Down Expand Up @@ -191,16 +192,7 @@
}

func Build(creds prismgoclient.Credentials, additionalTrustBundle string) (*nutanixClientV3.Client, error) {
cli, err := buildClientFromCredentials(creds, additionalTrustBundle)
if err != nil {
return nil, err
}
// Check if the client is working
_, err = cli.V3.GetCurrentLoggedInUser(context.Background())
if err != nil {
return nil, fmt.Errorf("failed to get current logged in user with client: %w", err)
}
return cli, nil
return buildClientFromCredentials(creds, additionalTrustBundle)

Check warning on line 195 in pkg/client/client.go

View check run for this annotation

Codecov / codecov/patch

pkg/client/client.go#L195

Added line #L195 was not covered by tests
}

func buildClientFromCredentials(creds prismgoclient.Credentials, additionalTrustBundle string) (*nutanixClientV3.Client, error) {
Expand Down
Loading