1
0
mirror of https://github.com/rancher/os.git synced 2025-04-30 04:14:15 +00:00
os/cmd/control/util.go

31 lines
606 B
Go
Raw Normal View History

2017-03-14 02:11:24 +00:00
package control
2016-06-06 22:13:15 +00:00
import (
"bufio"
2016-06-06 22:13:15 +00:00
"fmt"
"os"
2016-06-06 22:13:15 +00:00
"strings"
"github.com/rancher/os/config"
2018-09-16 04:55:26 +00:00
"github.com/rancher/os/pkg/log"
2016-06-06 22:13:15 +00:00
)
2017-03-14 02:11:24 +00:00
func yes(question string) bool {
2016-06-06 22:13:15 +00:00
fmt.Printf("%s [y/N]: ", question)
in := bufio.NewReader(os.Stdin)
line, err := in.ReadString('\n')
2016-06-06 22:13:15 +00:00
if err != nil {
log.Fatal(err)
}
return strings.ToLower(line[0:1]) == "y"
}
func formatImage(image string, cfg *config.CloudConfig) string {
domainRegistry := cfg.Rancher.Environment["REGISTRY_DOMAIN"]
if domainRegistry != "docker.io" && domainRegistry != "" {
return fmt.Sprintf("%s/%s", domainRegistry, image)
}
return image
}