本文整理汇总了Golang中github.com/openshift/geard/containers/jobs.Response.Success方法的典型用法代码示例。如果您正苦于以下问题:Golang Response.Success方法的具体用法?Golang Response.Success怎么用?Golang Response.Success使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/openshift/geard/containers/jobs.Response
的用法示例。
在下文中一共展示了Response.Success方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Execute
func (j *patchEnvironment) Execute(resp jobs.Response) {
if err := j.Write(true); err != nil {
resp.Failure(ErrEnvironmentUpdateFailed)
return
}
resp.Success(jobs.ResponseOk)
}
示例2: Execute
func (j *linkContainers) Execute(resp jobs.Response) {
for i := range j.Links {
if errw := j.Links[i].NetworkLinks.Write(j.Links[i].Id.NetworkLinksPathFor(), false); errw != nil {
resp.Failure(ErrLinkContainersFailed)
return
}
}
resp.Success(jobs.ResponseOk)
}
示例3: Execute
func (j *deleteContainer) Execute(resp jobs.Response) {
unitName := j.Id.UnitNameFor()
unitPath := j.Id.UnitPathFor()
unitDefinitionsPath := j.Id.VersionedUnitsPathFor()
idleFlagPath := j.Id.IdleUnitPathFor()
socketUnitPath := j.Id.SocketUnitPathFor()
homeDirPath := j.Id.BaseHomePath()
runDirPath := j.Id.RunPathFor()
networkLinksPath := j.Id.NetworkLinksPathFor()
_, err := systemd.Connection().GetUnitProperties(unitName)
switch {
case systemd.IsNoSuchUnit(err):
resp.Success(jobs.ResponseOk)
return
case err != nil:
resp.Failure(ErrDeleteContainerFailed)
return
}
if err := systemd.Connection().StopUnitJob(unitName, "fail"); err != nil {
log.Printf("delete_container: Unable to queue stop unit job: %v", err)
}
ports, err := containers.GetExistingPorts(j.Id)
if err != nil {
if !os.IsNotExist(err) {
log.Printf("delete_container: Unable to read existing port definitions: %v", err)
}
ports = port.PortPairs{}
}
if err := portReserver.ReleaseExternalPorts(ports); err != nil {
log.Printf("delete_container: Unable to release ports: %v", err)
}
if err := os.Remove(unitPath); err != nil && !os.IsNotExist(err) {
resp.Failure(ErrDeleteContainerFailed)
return
}
if err := os.Remove(idleFlagPath); err != nil && !os.IsNotExist(err) {
resp.Failure(ErrDeleteContainerFailed)
return
}
if err := csystemd.SetUnitStartOnBoot(j.Id, false); err != nil {
log.Printf("delete_container: Unable to clear unit boot state: %v", err)
}
if err := os.Remove(socketUnitPath); err != nil && !os.IsNotExist(err) {
log.Printf("delete_container: Unable to remove socket unit path: %v", err)
}
if err := os.Remove(networkLinksPath); err != nil && !os.IsNotExist(err) {
log.Printf("delete_container: Unable to remove network links file: %v", err)
}
if err := os.RemoveAll(unitDefinitionsPath); err != nil {
log.Printf("delete_container: Unable to remove definitions for container: %v", err)
}
if err := os.RemoveAll(filepath.Dir(runDirPath)); err != nil {
log.Printf("delete_container: Unable to remove run directory: %v", err)
}
if err := os.RemoveAll(filepath.Dir(homeDirPath)); err != nil {
log.Printf("delete_container: Unable to remove home directory: %v", err)
}
if _, err := systemd.Connection().DisableUnitFiles([]string{unitPath, socketUnitPath}, false); err != nil {
log.Printf("delete_container: Some units have not been disabled: %v", err)
}
if err := systemd.Connection().Reload(); err != nil {
log.Printf("delete_container: Some units have not been disabled: %v", err)
}
resp.Success(jobs.ResponseOk)
}