Ejemplo n.º 1
0
func (p *dockerProvisioner) SetUnitStatus(unit provision.Unit, status provision.Status) error {
	container, err := p.GetContainer(unit.Name)
	if err != nil {
		return err
	}
	if unit.AppName != "" && container.AppName != unit.AppName {
		return errors.New("wrong app name")
	}
	err = container.SetStatus(p, status.String(), true)
	if err != nil {
		return err
	}
	return p.checkContainer(container)
}
Ejemplo n.º 2
0
func (p *dockerProvisioner) RegisterUnit(unit provision.Unit, customData map[string]interface{}) error {
	container, err := p.GetContainer(unit.Name)
	if err != nil {
		return err
	}
	if container.Status == provision.StatusBuilding.String() {
		if container.BuildingImage != "" && customData != nil {
			return saveImageCustomData(container.BuildingImage, customData)
		}
		return nil
	}
	err = container.SetStatus(p, provision.StatusStarted.String(), true)
	if err != nil {
		return err
	}
	return p.checkContainer(container)
}