예제 #1
0
파일: up.go 프로젝트: romanoff/vanguard
func (self *ContainerManager) Manage(host string, container *config.Container) error {
	if config.NotIn(self.UsedContainerNames[host], container.Name()) {
		self.UsedContainerNames[host] = append(self.UsedContainerNames[host], container.Name())
	}
	err := self.Launch(host, container)
	if err != nil {
		return err
	}
	return self.StopExtra(host, container)
}
예제 #2
0
파일: up.go 프로젝트: romanoff/vanguard
func (self *ContainerManager) StopUnused() error {
	for host, containers := range self.RunningContainers {
		for _, container := range containers {
			if config.NotIn(self.UsedContainerNames[host], container.LabelName()) {
				vClient := self.Clients[host]
				err := vClient.Stop(container.ContainerId)
				if err != nil {
					return err
				}
				fmt.Println("stopped " + container.String())
			}
		}
	}
	return nil
}