本文整理汇总了Golang中github.com/juju/juju/agent.NewPathsWithDefaults函数的典型用法代码示例。如果您正苦于以下问题:Golang NewPathsWithDefaults函数的具体用法?Golang NewPathsWithDefaults怎么用?Golang NewPathsWithDefaults使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewPathsWithDefaults函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: SetUpTest
func (s *lxcBrokerSuite) SetUpTest(c *gc.C) {
if runtime.GOOS == "windows" {
c.Skip("Skipping lxc tests on windows")
}
s.lxcSuite.SetUpTest(c)
var err error
s.agentConfig, err = agent.NewAgentConfig(
agent.AgentConfigParams{
Paths: agent.NewPathsWithDefaults(agent.Paths{DataDir: "/not/used/here"}),
Tag: names.NewMachineTag("1"),
UpgradedToVersion: jujuversion.Current,
Password: "dummy-secret",
Nonce: "nonce",
APIAddresses: []string{"10.0.0.1:1234"},
CACert: coretesting.CACert,
Model: coretesting.ModelTag,
})
c.Assert(err, jc.ErrorIsNil)
managerConfig := container.ManagerConfig{
container.ConfigName: "juju",
"log-dir": c.MkDir(),
"use-clone": "false",
}
s.api = NewFakeAPI()
s.broker, err = provisioner.NewLxcBroker(s.api, s.agentConfig, managerConfig, nil, false, 0)
c.Assert(err, jc.ErrorIsNil)
}
示例2: WriteStateAgentConfig
// WriteStateAgentConfig creates and writes a state agent config.
func (s *AgentSuite) WriteStateAgentConfig(
c *gc.C,
tag names.Tag,
password string,
vers version.Binary,
modelTag names.ModelTag,
) agent.ConfigSetterWriter {
stateInfo := s.State.MongoConnectionInfo()
apiPort := gitjujutesting.FindTCPPort()
apiAddr := []string{fmt.Sprintf("localhost:%d", apiPort)}
conf, err := agent.NewStateMachineConfig(
agent.AgentConfigParams{
Paths: agent.NewPathsWithDefaults(agent.Paths{DataDir: s.DataDir()}),
Tag: tag,
UpgradedToVersion: vers.Number,
Password: password,
Nonce: agent.BootstrapNonce,
StateAddresses: stateInfo.Addrs,
APIAddresses: apiAddr,
CACert: stateInfo.CACert,
Model: modelTag,
},
params.StateServingInfo{
Cert: coretesting.ServerCert,
PrivateKey: coretesting.ServerKey,
CAPrivateKey: coretesting.CAKey,
StatePort: gitjujutesting.MgoServer.Port(),
APIPort: apiPort,
})
c.Assert(err, jc.ErrorIsNil)
conf.SetPassword(password)
c.Assert(conf.Write(), gc.IsNil)
return conf
}
示例3: writeStateAgentConfig
// writeStateAgentConfig creates and writes a state agent config.
func writeStateAgentConfig(
c *gc.C, stateInfo *mongo.MongoInfo, dataDir string, tag names.Tag,
password string, vers version.Binary, envTag names.EnvironTag) agent.ConfigSetterWriter {
port := gitjujutesting.FindTCPPort()
apiAddr := []string{fmt.Sprintf("localhost:%d", port)}
conf, err := agent.NewStateMachineConfig(
agent.AgentConfigParams{
Paths: agent.NewPathsWithDefaults(agent.Paths{DataDir: dataDir}),
Tag: tag,
UpgradedToVersion: vers.Number,
Password: password,
Nonce: agent.BootstrapNonce,
StateAddresses: stateInfo.Addrs,
APIAddresses: apiAddr,
CACert: stateInfo.CACert,
Environment: envTag,
},
params.StateServingInfo{
Cert: coretesting.ServerCert,
PrivateKey: coretesting.ServerKey,
CAPrivateKey: coretesting.CAKey,
StatePort: gitjujutesting.MgoServer.Port(),
APIPort: port,
})
c.Assert(err, jc.ErrorIsNil)
conf.SetPassword(password)
c.Assert(conf.Write(), gc.IsNil)
return conf
}
示例4: SetUpTest
func (s *lxdBrokerSuite) SetUpTest(c *gc.C) {
s.BaseSuite.SetUpTest(c)
if runtime.GOOS == "windows" {
c.Skip("Skipping lxd tests on windows")
}
// To isolate the tests from the host's architecture, we override it here.
s.PatchValue(&arch.HostArch, func() string { return arch.AMD64 })
var err error
s.agentConfig, err = agent.NewAgentConfig(
agent.AgentConfigParams{
Paths: agent.NewPathsWithDefaults(agent.Paths{DataDir: "/not/used/here"}),
Tag: names.NewMachineTag("1"),
UpgradedToVersion: jujuversion.Current,
Password: "dummy-secret",
Nonce: "nonce",
APIAddresses: []string{"10.0.0.1:1234"},
CACert: coretesting.CACert,
Controller: coretesting.ControllerTag,
Model: coretesting.ModelTag,
})
c.Assert(err, jc.ErrorIsNil)
s.api = NewFakeAPI()
s.manager = &fakeContainerManager{}
s.broker, err = provisioner.NewLxdBroker(s.api, s.manager, s.agentConfig)
c.Assert(err, jc.ErrorIsNil)
}
示例5: SetUpTest
func (s *kvmBrokerSuite) SetUpTest(c *gc.C) {
if runtime.GOOS == "windows" {
c.Skip("Skipping kvm tests on windows")
}
s.kvmSuite.SetUpTest(c)
var err error
s.agentConfig, err = agent.NewAgentConfig(
agent.AgentConfigParams{
Paths: agent.NewPathsWithDefaults(agent.Paths{DataDir: "/not/used/here"}),
Tag: names.NewUnitTag("ubuntu/1"),
UpgradedToVersion: version.Current,
Password: "dummy-secret",
Nonce: "nonce",
APIAddresses: []string{"10.0.0.1:1234"},
CACert: coretesting.CACert,
Environment: coretesting.EnvironmentTag,
})
c.Assert(err, jc.ErrorIsNil)
s.api = NewFakeAPI()
managerConfig := container.ManagerConfig{container.ConfigName: "juju"}
s.broker, err = provisioner.NewKvmBroker(s.api, s.agentConfig, managerConfig, false)
c.Assert(err, jc.ErrorIsNil)
}
示例6: SetUpTest
func (s *lxdBrokerSuite) SetUpTest(c *gc.C) {
s.BaseSuite.SetUpTest(c)
if runtime.GOOS == "windows" {
c.Skip("Skipping lxd tests on windows")
}
// To isolate the tests from the host's architecture, we override it here.
s.PatchValue(&arch.HostArch, func() string { return arch.AMD64 })
s.possibleTools = coretools.List{&coretools.Tools{
Version: version.MustParseBinary("2.3.4-quantal-amd64"),
URL: "http://tools.testing.invalid/2.3.4-quantal-amd64.tgz",
}, {
// non-host-arch tools should be filtered out by StartInstance
Version: version.MustParseBinary("2.3.4-quantal-arm64"),
URL: "http://tools.testing.invalid/2.3.4-quantal-arm64.tgz",
}}
var err error
s.agentConfig, err = agent.NewAgentConfig(
agent.AgentConfigParams{
Paths: agent.NewPathsWithDefaults(agent.Paths{DataDir: "/not/used/here"}),
Tag: names.NewMachineTag("1"),
UpgradedToVersion: jujuversion.Current,
Password: "dummy-secret",
Nonce: "nonce",
APIAddresses: []string{"10.0.0.1:1234"},
CACert: coretesting.CACert,
Model: coretesting.ModelTag,
})
c.Assert(err, jc.ErrorIsNil)
s.api = NewFakeAPI()
s.manager = &fakeContainerManager{}
s.broker, err = provisioner.NewLxdBroker(s.api, s.manager, s.agentConfig, "namespace", true)
c.Assert(err, jc.ErrorIsNil)
}