func recordAutomated(inst *instance.Instance, service flux.ServiceID, automated bool) error { return inst.UpdateConfig(func(conf instance.Config) (instance.Config, error) { if serviceConf, found := conf.Services[service]; found { serviceConf.Automated = automated conf.Services[service] = serviceConf } else if automated { conf.Services[service] = instance.ServiceConfig{ Automated: true, } } return conf, nil }) }
func recordLock(inst *instance.Instance, service flux.ServiceID, locked bool) error { if err := inst.UpdateConfig(func(conf instance.Config) (instance.Config, error) { if serviceConf, found := conf.Services[service]; found { serviceConf.Locked = locked conf.Services[service] = serviceConf } else if locked { conf.Services[service] = instance.ServiceConfig{ Locked: true, } } return conf, nil }); err != nil { return err } return nil }