本文整理汇总了Golang中github.com/tsuru/tsuru/provision.ExtensibleProvisioner.PlatformRemove方法的典型用法代码示例。如果您正苦于以下问题:Golang ExtensibleProvisioner.PlatformRemove方法的具体用法?Golang ExtensibleProvisioner.PlatformRemove怎么用?Golang ExtensibleProvisioner.PlatformRemove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/tsuru/tsuru/provision.ExtensibleProvisioner
的用法示例。
在下文中一共展示了ExtensibleProvisioner.PlatformRemove方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: PlatformRemove
func PlatformRemove(name string) error {
var (
provisioner provision.ExtensibleProvisioner
ok bool
)
if provisioner, ok = Provisioner.(provision.ExtensibleProvisioner); !ok {
return ErrProvisionerIsNotExtensible
}
if name == "" {
return ErrPlatformNameMissing
}
conn, err := db.Conn()
if err != nil {
return err
}
defer conn.Close()
apps, _ := conn.Apps().Find(bson.M{"framework": name}).Count()
if apps > 0 {
return ErrDeletePlatformWithApps
}
err = provisioner.PlatformRemove(name)
if err != nil {
log.Errorf("Failed to remove platform from provisioner: %s", err)
}
return conn.Platforms().Remove(bson.M{"_id": name})
}
示例2: PlatformRemove
func PlatformRemove(name string) error {
var (
provisioner provision.ExtensibleProvisioner
ok bool
)
if provisioner, ok = Provisioner.(provision.ExtensibleProvisioner); !ok {
return errors.New("Provisioner is not extensible")
}
if name == "" {
return errors.New("Platform name is required!")
}
conn, err := db.Conn()
if err != nil {
return err
}
defer conn.Close()
apps, _ := conn.Apps().Find(bson.M{"framework": name}).Count()
if apps > 0 {
return errors.New("Platform has apps. You should remove them before remove the platform.")
}
err = provisioner.PlatformRemove(name)
if err != nil {
log.Errorf("Failed to remove platform from provisioner: %s", err)
}
return conn.Platforms().Remove(bson.M{"_id": name})
}
示例3: PlatformRemove
func PlatformRemove(name string) error {
var (
provisioner provision.ExtensibleProvisioner
ok bool
)
if provisioner, ok = Provisioner.(provision.ExtensibleProvisioner); !ok {
return errors.New("Provisioner is not extensible")
}
if name == "" {
return errors.New("Platform name is required!")
}
conn, err := db.Conn()
if err != nil {
return err
}
apps, _ := conn.Apps().Find(bson.M{"framework": name}).Count()
if apps > 0 {
return errors.New("Platform has apps. You should remove them before remove the platform.")
}
return provisioner.PlatformRemove(name)
}