当前位置: 首页>>代码示例>>Golang>>正文


Golang Do.Force方法代码示例

本文整理汇总了Golang中github.com/eris-ltd/eris-cli/definitions.Do.Force方法的典型用法代码示例。如果您正苦于以下问题:Golang Do.Force方法的具体用法?Golang Do.Force怎么用?Golang Do.Force使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/eris-ltd/eris-cli/definitions.Do的用法示例。


在下文中一共展示了Do.Force方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: CleanUp

func CleanUp(do *definitions.Do) error {
	log.Info("Cleaning up")
	do.Force = true

	if do.Chain.ChainType == "throwaway" {
		log.WithField("=>", do.Chain.Name).Debug("Destroying throwaway chain")
		doRm := definitions.NowDo()
		doRm.Operations = do.Operations
		doRm.Name = do.Chain.Name
		doRm.Rm = true
		doRm.RmD = true
		doRm.Volumes = true
		KillChain(doRm)

		latentDir := filepath.Join(DataContainersPath, do.Chain.Name)
		latentFile := filepath.Join(ChainsPath, do.Chain.Name+".toml")

		if doRm.Name == "default" {
			log.WithField("dir", latentDir).Debug("Removing latent dir")
			os.RemoveAll(latentDir)
		} else {
			log.WithFields(log.Fields{
				"dir":  latentDir,
				"file": latentFile,
			}).Debug("Removing latent dir and file")
			os.RemoveAll(latentDir)
			os.Remove(latentFile)
		}

	} else {
		log.Debug("No throwaway chain to destroy")
	}

	if do.RmD {
		log.WithField("dir", filepath.Join(DataContainersPath, do.Service.Name)).Debug("Removing data dir on host")
		os.RemoveAll(filepath.Join(DataContainersPath, do.Service.Name))
	}

	if do.Rm {
		log.WithField("=>", do.Operations.SrvContainerName).Debug("Removing tmp service container")
		perform.DockerRemove(do.Service, do.Operations, true, true, false)
	}

	return nil
}
开发者ID:antonylewis,项目名称:eris-cli,代码行数:45,代码来源:operate.go

示例2: CleanUp

func CleanUp(do *definitions.Do) error {
	logger.Infof("Commensing CleanUp.\n")
	do.Force = true

	if do.Chain.ChainType == "throwaway" {
		logger.Debugf("Destroying Throwaway Chain =>\t%s\n", do.Chain.Name)
		doRm := definitions.NowDo()
		doRm.Operations = do.Operations
		doRm.Name = do.Chain.Name
		doRm.Rm = true
		doRm.RmD = true
		doRm.Volumes = true
		KillChain(doRm)

		if doRm.Name == "default" {
			logger.Debugf("Removing latent files/dirs =>\t%s\n", path.Join(DataContainersPath, do.Chain.Name))
			os.RemoveAll(path.Join(DataContainersPath, do.Chain.Name))
		} else {
			logger.Debugf("Removing latent files/dirs =>\t%s:%s\n", path.Join(DataContainersPath, do.Chain.Name), path.Join(ChainsPath, do.Chain.Name+".toml"))
			os.RemoveAll(path.Join(DataContainersPath, do.Chain.Name))
			os.Remove(path.Join(ChainsPath, do.Chain.Name+".toml"))
		}

	} else {
		logger.Debugf("No Throwaway Chain to destroy.\n")
	}

	if do.RmD {
		logger.Debugf("Removing data dir on host =>\t%s\n", path.Join(DataContainersPath, do.Service.Name))
		os.RemoveAll(path.Join(DataContainersPath, do.Service.Name))
	}

	if do.Rm {
		logger.Debugf("Removing tmp srv contnr =>\t%s\n", do.Operations.SrvContainerName)
		perform.DockerRemove(do.Service, do.Operations, true, true)
	}

	return nil
}
开发者ID:alexandrev,项目名称:eris-cli,代码行数:39,代码来源:operate.go


注:本文中的github.com/eris-ltd/eris-cli/definitions.Do.Force方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。