• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang config.NewWarning函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/tsuru/config.NewWarning函数的典型用法代码示例。如果您正苦于以下问题:Golang NewWarning函数的具体用法?Golang NewWarning怎么用?Golang NewWarning使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了NewWarning函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: checkPubSub

func checkPubSub() error {
	oldConfig, _ := config.GetString("redis-queue:host")
	if oldConfig != "" {
		return config.NewWarning(`Using "redis-queue:*" is deprecated. Please change your tsuru.conf to use "pubsub:*" options. See http://docs.tsuru.io/en/latest/reference/config.html#pubsub for more details.`)
	}
	redisHost, _ := config.GetString("pubsub:redis-host")
	if redisHost == "" {
		return config.NewWarning(`Config entry "pubsub:redis-host" is not set, default "localhost" will be used. Running "tsuru app-log -f" might not work.`)
	}
	return nil
}
开发者ID:zhenruyan,项目名称:tsuru,代码行数:11,代码来源:checker.go


示例2: TestCheckPubSubOld

func (w *CheckerSuite) TestCheckPubSubOld(c *check.C) {
	config.Unset("pubsub:redis-host")
	config.Set("redis-queue:host", "localhost")
	err := checkPubSub()
	c.Assert(err, check.FitsTypeOf, config.NewWarning(""))
	c.Assert(err, check.ErrorMatches, ".*Using \"redis-queue:\\*\" is deprecated.*")
}
开发者ID:RichardKnop,项目名称:tsuru,代码行数:7,代码来源:checker_test.go


示例3: TestCheckRouterHipacheCanHaveHipacheInRoutersConf

func (s *CheckerSuite) TestCheckRouterHipacheCanHaveHipacheInRoutersConf(c *check.C) {
	config.Unset("routers:hipache")
	config.Set("hipache:domain", "something")
	err := checkRouter()
	c.Assert(err, check.FitsTypeOf, config.NewWarning(""))
	c.Assert(err, check.ErrorMatches, ".*Setting \"hipache:\\*\" config entries is deprecated.*")
}
开发者ID:RichardKnop,项目名称:tsuru,代码行数:7,代码来源:checker_test.go


示例4: checkQueue

func checkQueue() error {
	queueConfig, _ := config.GetString("queue:mongo-url")
	if queueConfig == "" {
		return config.NewWarning(`Config entry "queue:mongo-url" is not set, default "localhost" will be used. Running "tsuru-admin docker-node-{add,remove}" commands might not work.`)
	}
	return nil
}
开发者ID:zhenruyan,项目名称:tsuru,代码行数:7,代码来源:checker.go


示例5: TestCheckSchedulerConfigSegregate

func (s *CheckerSuite) TestCheckSchedulerConfigSegregate(c *check.C) {
	config.Set("docker:segregate", true)
	err := checkScheduler()
	baseWarn := config.NewWarning("")
	c.Assert(err, check.FitsTypeOf, baseWarn)
	c.Assert(err, check.ErrorMatches, `Setting "docker:segregate" is not necessary anymore, this is the default behavior from now on.`)
	config.Set("docker:segregate", false)
	err = checkScheduler()
	c.Assert(err, check.Not(check.FitsTypeOf), baseWarn)
	c.Assert(err, check.ErrorMatches, `You must remove "docker:segregate" from your config.`)
}
开发者ID:RichardKnop,项目名称:tsuru,代码行数:11,代码来源:checker_test.go


示例6: checkScheduler

// Check Schedulers
// It verifies your scheduler configuration and validates related confs.
func checkScheduler() error {
	if servers, err := config.Get("docker:servers"); err == nil && servers != nil {
		return fmt.Errorf(`Using docker:servers is deprecated, please remove it your config and use "tsuru-admin docker-node-add" do add docker nodes.`)
	}
	isSegregate, err := config.GetBool("docker:segregate")
	if err == nil {
		if isSegregate {
			return config.NewWarning(`Setting "docker:segregate" is not necessary anymore, this is the default behavior from now on.`)
		} else {
			return fmt.Errorf(`You must remove "docker:segregate" from your config.`)
		}
	}
	return nil
}
开发者ID:zhenruyan,项目名称:tsuru,代码行数:16,代码来源:checker.go


示例7: checkRouter

// Check Router
// It verifies your router configuration and validates related confs.
func checkRouter() error {
	defaultRouter, _ := config.GetString("docker:router")
	if defaultRouter == "" {
		return fmt.Errorf(`You must configure a default router in "docker:router".`)
	}
	isHipacheOld := false
	if defaultRouter == "hipache" {
		hipacheOld, _ := config.Get("hipache")
		isHipacheOld = hipacheOld != nil
	}
	routerConf, _ := config.Get("routers:" + defaultRouter)
	if isHipacheOld {
		return config.NewWarning(`Setting "hipache:*" config entries is deprecated. You should configure your router with "routers:*". See http://docs.tsuru.io/en/latest/reference/config.html#routers for more details.`)
	}
	if routerConf == nil {
		return fmt.Errorf(`You must configure your default router %q in "routers:%s".`, defaultRouter, defaultRouter)
	}
	routerType, _ := config.Get("routers:" + defaultRouter + ":type")
	if routerType == nil {
		return fmt.Errorf(`You must configure your default router type in "routers:%s:type".`, defaultRouter)
	}
	return nil
}
开发者ID:zhenruyan,项目名称:tsuru,代码行数:25,代码来源:checker.go


示例8: TestCheckQueueNotSet

func (w *CheckerSuite) TestCheckQueueNotSet(c *check.C) {
	config.Unset("queue:mongo-url")
	err := checkQueue()
	c.Assert(err, check.FitsTypeOf, config.NewWarning(""))
	c.Assert(err, check.ErrorMatches, ".*Config entry \"queue:mongo-url\" is not set.*")
}
开发者ID:RichardKnop,项目名称:tsuru,代码行数:6,代码来源:checker_test.go


示例9: TestCheckPubSubMissing

func (w *CheckerSuite) TestCheckPubSubMissing(c *check.C) {
	config.Unset("pubsub:redis-host")
	err := checkPubSub()
	c.Assert(err, check.FitsTypeOf, config.NewWarning(""))
	c.Assert(err, check.ErrorMatches, ".*Config entry \"pubsub:redis-host\" is not set.*")
}
开发者ID:RichardKnop,项目名称:tsuru,代码行数:6,代码来源:checker_test.go



注:本文中的github.com/tsuru/config.NewWarning函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang config.ReadConfigFile函数代码示例发布时间:2022-05-28
下一篇:
Golang config.GetString函数代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap