[agent-operator] - image bastion mode
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
"wdd.io/agent-common/utils"
|
||||
"wdd.io/agent-operator/real_project/bgtg"
|
||||
)
|
||||
@@ -71,7 +75,64 @@ func CmiiRunner() {
|
||||
|
||||
}
|
||||
|
||||
var DLTUHelp = `
|
||||
DLTUHelp
|
||||
dltu [ossUrl] [localGzipFolder] [harborHostFullName]
|
||||
`
|
||||
|
||||
func main() {
|
||||
|
||||
RealProjectRunner()
|
||||
//RealProjectRunner()
|
||||
|
||||
// 解析命令行参数
|
||||
var mode string
|
||||
flag.StringVar(&mode, "mode", "mode", "agent run mode")
|
||||
flag.Parse()
|
||||
|
||||
if mode == "image" {
|
||||
// 堡垒机模式 的 镜像美容
|
||||
// 初始化堡垒机模式
|
||||
for {
|
||||
|
||||
reader := bufio.NewReader(os.Stdin)
|
||||
for {
|
||||
fmt.Printf(DLTUHelp)
|
||||
fmt.Print("enter ==> ")
|
||||
|
||||
text, _ := reader.ReadString('\n')
|
||||
split := strings.Split(text, " ")
|
||||
var result []string
|
||||
for _, s := range split {
|
||||
text = strings.TrimSpace(s)
|
||||
if text == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
result = append(result, text)
|
||||
}
|
||||
|
||||
if len(result) != 4 {
|
||||
fmt.Println("input error!")
|
||||
fmt.Printf(DLTUHelp)
|
||||
return
|
||||
}
|
||||
|
||||
ossUrl := result[1]
|
||||
localGzipFolder := result[2]
|
||||
harborHostFullName := result[3]
|
||||
|
||||
fmt.Println("ossUrl: ", ossUrl)
|
||||
fmt.Println("localGzipFolder: ", localGzipFolder)
|
||||
fmt.Println("harborHostFullName: ", harborHostFullName)
|
||||
fmt.Println()
|
||||
|
||||
DownloadLoadTagPush(false, ossUrl, localGzipFolder, harborHostFullName)
|
||||
|
||||
// 下载
|
||||
|
||||
fmt.Println()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user