1 Star 0 Fork 0

litian / machine

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
rm.go 943 Bytes
一键复制 编辑 原始数据 按行查看 历史
package commands
import (
"github.com/codegangsta/cli"
"github.com/docker/machine/log"
)
func cmdRm(c *cli.Context) {
if len(c.Args()) == 0 {
cli.ShowCommandHelp(c, "rm")
log.Fatal("You must specify a machine name")
}
force := c.Bool("force")
isError := false
certInfo := getCertPathInfo(c)
defaultStore, err := getDefaultStore(
c.GlobalString("storage-path"),
certInfo.CaCertPath,
certInfo.CaKeyPath,
)
if err != nil {
log.Fatal(err)
}
provider, err := newProvider(defaultStore)
if err != nil {
log.Fatal(err)
}
for _, host := range c.Args() {
if err := provider.Remove(host, force); err != nil {
log.Errorf("Error removing machine %s: %s", host, err)
isError = true
} else {
log.Infof("Successfully removed %s", host)
}
}
if isError {
log.Fatal("There was an error removing a machine. To force remove it, pass the -f option. Warning: this might leave it running on the provider.")
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/litian33/machine.git
git@gitee.com:litian33/machine.git
litian33
machine
machine
v0.3.1

搜索帮助

344bd9b3 5694891 D2dac590 5694891