portainer

This commit is contained in:
qiaofeng1227 2023-10-17 14:42:09 +08:00
parent bc977b4ef6
commit c16dd1e600
2 changed files with 11 additions and 17 deletions

View File

@ -23,28 +23,22 @@ func main() {
fmt.Println("write file error:", err) fmt.Println("write file error:", err)
return return
} }
// call portainer
cmd := exec.Command("./portainer", "--admin-password-file", filePath)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err = cmd.Run()
if err != nil {
fmt.Println("error running compiled_program:", err)
return
}
}else{ }else{
fmt.Println("credential is exist, skip it.") fmt.Println("credential is exist, skip it.")
cmd := exec.Command("./portainer") cmd := exec.Command("./portainer")
cmd.Run() cmd.Run()
} }
content, err := ioutil.ReadFile(filePath)
if err != nil {
fmt.Println("read file error:", err)
return
}
// call portainer
cmd := exec.Command("./portainer", "--admin-password-file", filePath)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err = cmd.Run()
if err != nil {
fmt.Println("error running compiled_program:", err)
return
}
} }
func generatePassword(length int) string { func generatePassword(length int) string {