當前位置: 首頁>>代碼示例>>Golang>>正文


Golang ExtensibleProvisioner.PlatformRemove方法代碼示例

本文整理匯總了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})
}
開發者ID:zhenruyan,項目名稱:tsuru,代碼行數:26,代碼來源:platform.go

示例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})
}
開發者ID:RichardKnop,項目名稱:tsuru,代碼行數:26,代碼來源:platform.go

示例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)
}
開發者ID:rualatngua,項目名稱:tsuru,代碼行數:21,代碼來源:platform.go


注:本文中的github.com/tsuru/tsuru/provision.ExtensibleProvisioner.PlatformRemove方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。