Exemple #1
0
func reload(c *cli.Context) {
	_, err := config.LoadConfig()
	if err != nil {
		log.Fatal(err)
	}

	containers := map[string]*docker.Container{} //parseContainers(cfg)
	toStart := make([]*docker.Container, 0, len(c.Args()))

	for _, id := range c.Args() {
		if container, ok := containers[id]; ok {
			toStart = append(toStart, container.Stage())
		}
	}

	var firstErr error
	for _, c := range toStart {
		err := c.Start().Err
		if err != nil {
			log.Errorf("Failed to start %s : %v", c.ContainerCfg.Id, err)
			if firstErr != nil {
				firstErr = err
			}
		}
	}

	if firstErr != nil {
		log.Fatal(firstErr)
	}
}