[ Server ] [ Harbor ] - list project - 1
This commit is contained in:
@@ -65,7 +65,7 @@ func (hOp *HarborOperator) CreateProjectExec(funcArgs []string) (bool, []string)
|
||||
|
||||
client := hOp.TargetHarborClient
|
||||
if hOp.TargetHarborClient == nil {
|
||||
ok, createClient := hOp.checkAndBuildHarborClient(funcArgs)
|
||||
ok, createClient := hOp.CheckAndBuildHarborClient(funcArgs)
|
||||
if !ok {
|
||||
return false, []string{
|
||||
"[Harbor Create Project] - Error !",
|
||||
@@ -77,8 +77,8 @@ func (hOp *HarborOperator) CreateProjectExec(funcArgs []string) (bool, []string)
|
||||
// create project
|
||||
// 定义你想要创建的仓库(项目)的详细信息
|
||||
|
||||
log.Debug("[Harbor Create Project] - create project !")
|
||||
needToCreateProjectNameList := []string{"cmii", "rancher"}
|
||||
|
||||
var err error
|
||||
// 使用客户端创建项目
|
||||
ctx := context.Background()
|
||||
@@ -111,9 +111,11 @@ func (hOp *HarborOperator) CreateProjectExec(funcArgs []string) (bool, []string)
|
||||
return true, []string{successLog}
|
||||
}
|
||||
|
||||
func (hOp *HarborOperator) checkAndBuildHarborClient(funcArgs []string) (bool, *apiv2.RESTClient) {
|
||||
func (hOp *HarborOperator) CheckAndBuildHarborClient(funcArgs []string) (bool, *apiv2.RESTClient) {
|
||||
|
||||
targetHarborHost := funcArgs[0]
|
||||
log.InfoF("[Harbor Client Create] - start to create harbor client %s", targetHarborHost)
|
||||
|
||||
parseIP := net.ParseIP(targetHarborHost)
|
||||
if parseIP == nil {
|
||||
log.Error(
|
||||
@@ -122,7 +124,7 @@ func (hOp *HarborOperator) checkAndBuildHarborClient(funcArgs []string) (bool, *
|
||||
return false, nil
|
||||
}
|
||||
|
||||
hOp.TargetHarborHost = "http://" + targetHarborHost + ":" + hOp.HarborPort + "/api"
|
||||
hOp.TargetHarborHost = "http://" + targetHarborHost + ":" + hOp.HarborPort + "/api/"
|
||||
log.DebugF("[Harbor Client Create] - harbor host is => %s", hOp.TargetHarborHost)
|
||||
|
||||
// check connection
|
||||
@@ -140,7 +142,7 @@ func (hOp *HarborOperator) ListProjectExec(funcArgs []string) (bool, []string) {
|
||||
|
||||
client := hOp.TargetHarborClient
|
||||
if hOp.TargetHarborClient == nil {
|
||||
ok, createClient := hOp.checkAndBuildHarborClient(funcArgs)
|
||||
ok, createClient := hOp.CheckAndBuildHarborClient(funcArgs)
|
||||
if !ok {
|
||||
return false, []string{
|
||||
"[Harbor Create Project ] - Error !",
|
||||
|
||||
@@ -33,7 +33,12 @@ public class TestBaseFuncScheduler {
|
||||
|
||||
|
||||
ServerQueryEntity serverQueryEntity = new ServerQueryEntity();
|
||||
serverQueryEntity.setServerName("Chengdu-amd64-99");
|
||||
// exsi server
|
||||
// serverQueryEntity.setServerName("Chengdu-amd64-99");
|
||||
|
||||
// lappro
|
||||
serverQueryEntity.setServerName("Chengdu-amd64-65");
|
||||
|
||||
ServerInfoPO serverInfoPO = serverService
|
||||
.serverGetByPage(serverQueryEntity)
|
||||
.getRecords()
|
||||
|
||||
Reference in New Issue
Block a user