本文整理汇总了Golang中github.com/juju/juju/jujuclient.ClientStore.RemoveModel方法的典型用法代码示例。如果您正苦于以下问题:Golang ClientStore.RemoveModel方法的具体用法?Golang ClientStore.RemoveModel怎么用?Golang ClientStore.RemoveModel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/juju/juju/jujuclient.ClientStore
的用法示例。
在下文中一共展示了ClientStore.RemoveModel方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: missingModelError
func (c *JujuCommandBase) missingModelError(store jujuclient.ClientStore, controllerName, modelName string) error {
// First, we'll try and clean up the missing model from the local cache.
err := store.RemoveModel(controllerName, modelName)
if err != nil {
logger.Warningf("cannot remove unknown model from cache: %v", err)
}
currentModel, err := store.CurrentModel(controllerName)
if err != nil {
logger.Warningf("cannot read current model: %v", err)
} else if currentModel == modelName {
if err := store.SetCurrentModel(controllerName, ""); err != nil {
logger.Warningf("cannot reset current model: %v", err)
}
}
errorMessage := "model %q has been removed from the controller, run 'juju models' and switch to one of them."
modelInfoMessage := "\nThere are %d accessible models on controller %q."
models, err := store.AllModels(controllerName)
if err == nil {
modelInfoMessage = fmt.Sprintf(modelInfoMessage, len(models), controllerName)
} else {
modelInfoMessage = ""
}
return errors.Errorf(errorMessage+modelInfoMessage, modelName)
}