[ Cmii ] [ Operator ] - bug fix of harbor executor

This commit is contained in:
zeaslity
2024-04-12 15:26:33 +08:00
parent 866220f2e4
commit c4b1c66f60
4 changed files with 11 additions and 17 deletions

View File

@@ -4,7 +4,6 @@ import (
"context"
"encoding/json"
"fmt"
"net"
"os"
"strconv"
"strings"
@@ -117,17 +116,11 @@ func (hOp *HarborOperator) CreateProjectExec(funcArgs []string) (bool, []string)
return true, []string{successLog}
}
// todo refresh HarborClient不一定有端口
func (hOp *HarborOperator) CheckAndBuildHarborClient(targetHarborHost string, targetHarborPort string, isTarget bool) (bool, *apiv2.RESTClient) {
log.InfoF("[Harbor Client Create] - start to create harbor client %s", targetHarborHost)
parseIP := net.ParseIP(targetHarborHost)
if parseIP == nil {
log.Error(
fmt.Sprintf("[Harbor Client Create] - ip format is wrong! parseIP is => %s ", parseIP),
)
return false, nil
}
if targetHarborPort == "" {
targetHarborPort = hOp.HarborPort
}