Beispiel #1
0
func Update(sous *core.Sous, args []string) {
	key := "last-update-check"
	if err := config.Update(); err != nil {
		cli.Fatal()
	}
	config.Set(key, time.Now().Format(time.RFC3339))
	cli.Success()
}
Beispiel #2
0
func Config(sous *core.Sous, args []string) {
	if len(args) == 0 || len(args) > 2 {
		cli.Fatalf("usage: sous config <key> [<new-value>]")
	}
	if len(args) == 1 {
		if v, ok := config.Properties()[args[0]]; ok {
			cli.Outf(v)
			cli.Success()
		}
		cli.Fatalf("Key %s not found", args[0])
	}
	config.Set(args[0], args[1])
	cli.Logf("Successfully set %s to %s", args[0], args[1])
	cli.Success()
}
Beispiel #3
0
func (s *Sous) UpdateBaseImage(image string) {
	// First, keep track of which images we are interested in...
	key := "usedBaseImages"
	images := config.Properties()[key]
	var list []string
	if len(images) != 0 {
		json.Unmarshal([]byte(images), &list)
	} else {
		list = []string{}
	}
	if doesNotAppearInList(image, list) {
		list = append(list, image)
	}
	listJSON, err := json.Marshal(list)
	if err != nil {
		cli.Fatalf("Unable to marshal base image list as JSON: %+v; %s", list, err)
	}
	config.Set(key, string(listJSON))
	// Now lets grab the actual image
	docker.Pull(image)
}