当前位置: 首页>>代码示例>>Golang>>正文


Golang config.NewWarning函数代码示例

本文整理汇总了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;未经允许,请勿转载。