當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。