fix: p2p instance test connection (#20968)

Signed-off-by: chlins <chlins.zhang@gmail.com>
Co-authored-by: Wang Yan <wangyan@vmware.com>
This commit is contained in:
Chlins Zhang 2024-09-27 14:33:23 +08:00 committed by GitHub
parent ab400c9dd2
commit ad8c5df52e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 10 additions and 3 deletions

View File

@ -84,7 +84,7 @@ func NewHTTPClient(insecure bool) *HTTPClient {
// Get content from the url // Get content from the url
func (hc *HTTPClient) Get(url string, cred *auth.Credential, parmas map[string]string, options map[string]string) ([]byte, error) { func (hc *HTTPClient) Get(url string, cred *auth.Credential, parmas map[string]string, options map[string]string) ([]byte, error) {
bytes, err := hc.get(url, cred, parmas, options) bytes, err := hc.get(url, cred, parmas, options)
logMsg := fmt.Sprintf("Get %s with cred=%v, params=%v, options=%v", url, cred, parmas, options) logMsg := fmt.Sprintf("Get %s with params=%v, options=%v", url, parmas, options)
if err != nil { if err != nil {
log.Errorf("%s: %s", logMsg, err) log.Errorf("%s: %s", logMsg, err)
} else { } else {

View File

@ -162,7 +162,7 @@ func (dd *DragonflyDriver) Self() *Metadata {
ID: "dragonfly", ID: "dragonfly",
Name: "Dragonfly", Name: "Dragonfly",
Icon: "https://raw.githubusercontent.com/dragonflyoss/Dragonfly2/master/docs/images/logo/dragonfly-linear.png", Icon: "https://raw.githubusercontent.com/dragonflyoss/Dragonfly2/master/docs/images/logo/dragonfly-linear.png",
Version: "2.1.57", Version: "2.1.59",
Source: "https://github.com/dragonflyoss/Dragonfly2", Source: "https://github.com/dragonflyoss/Dragonfly2",
Maintainers: []string{"chlins.zhang@gmail.com", "gaius.qi@gmail.com"}, Maintainers: []string{"chlins.zhang@gmail.com", "gaius.qi@gmail.com"},
} }

View File

@ -432,6 +432,11 @@ export class DistributionSetupModalComponent implements OnInit, OnDestroy {
this.checkBtnState = ClrLoadingState.LOADING; this.checkBtnState = ClrLoadingState.LOADING;
const instance: Instance = clone(this.model); const instance: Instance = clone(this.model);
instance.id = 0; instance.id = 0;
if (instance.auth_mode !== AuthMode.NONE) {
instance.auth_info = this.authData;
} else {
delete instance.auth_info;
}
this.distributionService this.distributionService
.PingInstances({ .PingInstances({
instance: this.handleInstance(instance), instance: this.handleInstance(instance),

View File

@ -565,6 +565,7 @@ func convertParamInstanceToModelInstance(model *models.Instance) (*instanceModel
return &instanceModel.Instance{ return &instanceModel.Instance{
AuthData: string(authData), AuthData: string(authData),
AuthInfo: model.AuthInfo,
AuthMode: model.AuthMode, AuthMode: model.AuthMode,
Default: model.Default, Default: model.Default,
Description: model.Description, Description: model.Description,

View File

@ -39,7 +39,7 @@ func Test_convertProvidersToFrontend(t *testing.T) {
{"", {"",
backend, backend,
[]*models.Metadata{ []*models.Metadata{
{ID: "dragonfly", Icon: "https://raw.githubusercontent.com/dragonflyoss/Dragonfly2/master/docs/images/logo/dragonfly-linear.png", Maintainers: []string{"chlins.zhang@gmail.com", "gaius.qi@gmail.com"}, Name: "Dragonfly", Source: "https://github.com/dragonflyoss/Dragonfly2", Version: "2.1.57"}, {ID: "dragonfly", Icon: "https://raw.githubusercontent.com/dragonflyoss/Dragonfly2/master/docs/images/logo/dragonfly-linear.png", Maintainers: []string{"chlins.zhang@gmail.com", "gaius.qi@gmail.com"}, Name: "Dragonfly", Source: "https://github.com/dragonflyoss/Dragonfly2", Version: "2.1.59"},
{Icon: "https://github.com/uber/kraken/blob/master/assets/kraken-logo-color.svg", ID: "kraken", Maintainers: []string{"mmpei/peimingming@corp.netease.com"}, Name: "Kraken", Source: "https://github.com/uber/kraken", Version: "0.1.3"}, {Icon: "https://github.com/uber/kraken/blob/master/assets/kraken-logo-color.svg", ID: "kraken", Maintainers: []string{"mmpei/peimingming@corp.netease.com"}, Name: "Kraken", Source: "https://github.com/uber/kraken", Version: "0.1.3"},
}, },
}, },
@ -288,6 +288,7 @@ func Test_convertParamInstanceToModelInstance(t *testing.T) {
Endpoint: "https://example.com", Endpoint: "https://example.com",
AuthMode: "none", AuthMode: "none",
AuthData: `{"name":"harbor"}`, AuthData: `{"name":"harbor"}`,
AuthInfo: map[string]string{"name": "harbor"},
Status: "Unknown", Status: "Unknown",
Default: true, Default: true,
Insecure: true, Insecure: true,