本文整理汇总了Golang中github.com/juju/juju/worker/provisioner.NewEnvironProvisioner函数的典型用法代码示例。如果您正苦于以下问题:Golang NewEnvironProvisioner函数的具体用法?Golang NewEnvironProvisioner怎么用?Golang NewEnvironProvisioner使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewEnvironProvisioner函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: newEnvironProvisioner
func (s *CommonProvisionerSuite) newEnvironProvisioner(c *gc.C) provisioner.Provisioner {
machineTag := names.NewMachineTag("0")
agentConfig := s.AgentConfigForTag(c, machineTag)
apiState := apiprovisioner.NewState(s.st)
w, err := provisioner.NewEnvironProvisioner(apiState, agentConfig, s.Environ)
c.Assert(err, jc.ErrorIsNil)
return w
}
开发者ID:bac,项目名称:juju,代码行数:8,代码来源:provisioner_test.go
示例2: SetUpTest
func (s *ContainerSetupSuite) SetUpTest(c *gc.C) {
s.CommonProvisionerSuite.SetUpTest(c)
aptCmdChan := s.HookCommandOutput(&apt.CommandOutput, []byte{}, nil)
s.aptCmdChan = aptCmdChan
// Set up provisioner for the state machine.
s.agentConfig = s.AgentConfigForTag(c, names.NewMachineTag("0"))
s.p = provisioner.NewEnvironProvisioner(s.provisioner, s.agentConfig)
// Create a new container initialisation lock.
s.initLockDir = c.MkDir()
initLock, err := fslock.NewLock(s.initLockDir, "container-init")
c.Assert(err, gc.IsNil)
s.initLock = initLock
}
开发者ID:zhouqt,项目名称:juju,代码行数:15,代码来源:container_initialisation_test.go
示例3: SetUpTest
func (s *ContainerSetupSuite) SetUpTest(c *gc.C) {
s.CommonProvisionerSuite.SetUpTest(c)
aptCmdChan := s.HookCommandOutput(&manager.CommandOutput, []byte{}, nil)
s.aptCmdChan = aptCmdChan
// Set up provisioner for the state machine.
s.agentConfig = s.AgentConfigForTag(c, names.NewMachineTag("0"))
s.p = provisioner.NewEnvironProvisioner(s.provisioner, s.agentConfig)
// Create a new container initialisation lock.
s.initLockDir = c.MkDir()
initLock, err := fslock.NewLock(s.initLockDir, "container-init")
c.Assert(err, jc.ErrorIsNil)
s.initLock = initLock
// Patch to isolate the test from the host machine.
s.fakeLXCNet = filepath.Join(c.MkDir(), "lxc-net")
s.PatchValue(provisioner.EtcDefaultLXCNetPath, s.fakeLXCNet)
}
开发者ID:chrisjohnston,项目名称:juju,代码行数:19,代码来源:container_initialisation_test.go
示例4: newEnvironProvisioner
func (s *CommonProvisionerSuite) newEnvironProvisioner(c *gc.C) provisioner.Provisioner {
machineTag := names.NewMachineTag("0")
agentConfig := s.AgentConfigForTag(c, machineTag)
return provisioner.NewEnvironProvisioner(s.provisioner, agentConfig)
}
开发者ID:zhouqt,项目名称:juju,代码行数:5,代码来源:provisioner_test.go
示例5: APIWorker
//.........这里部分代码省略.........
// Before starting any workers, ensure we record the Juju version this machine
// agent is running.
currentTools := &coretools.Tools{Version: version.Current}
if err := st.Upgrader().SetVersion(agentConfig.Tag().String(), currentTools.Version); err != nil {
return nil, errors.Annotate(err, "cannot set machine agent version")
}
providerType := agentConfig.Value(agent.ProviderType)
// Run the upgrader and the upgrade-steps worker without waiting for
// the upgrade steps to complete.
runner.StartWorker("upgrader", func() (worker.Worker, error) {
return upgrader.NewUpgrader(
st.Upgrader(),
agentConfig,
a.previousAgentVersion,
a.upgradeWorkerContext.IsUpgradeRunning,
), nil
})
runner.StartWorker("upgrade-steps", func() (worker.Worker, error) {
return a.upgradeWorkerContext.Worker(a, st, entity.Jobs()), nil
})
// All other workers must wait for the upgrade steps to complete
// before starting.
a.startWorkerAfterUpgrade(runner, "machiner", func() (worker.Worker, error) {
return machiner.NewMachiner(st.Machiner(), agentConfig), nil
})
a.startWorkerAfterUpgrade(runner, "apiaddressupdater", func() (worker.Worker, error) {
return apiaddressupdater.NewAPIAddressUpdater(st.Machiner(), a), nil
})
a.startWorkerAfterUpgrade(runner, "logger", func() (worker.Worker, error) {
return workerlogger.NewLogger(st.Logger(), agentConfig), nil
})
a.startWorkerAfterUpgrade(runner, "machineenvironmentworker", func() (worker.Worker, error) {
return machineenvironmentworker.NewMachineEnvironmentWorker(st.Environment(), agentConfig), nil
})
a.startWorkerAfterUpgrade(runner, "rsyslog", func() (worker.Worker, error) {
return newRsyslogConfigWorker(st.Rsyslog(), agentConfig, rsyslogMode)
})
// TODO (mfoord 8/8/2014) improve the way we detect networking capabilities. Bug lp:1354365
writeNetworkConfig := providerType == "maas"
if disableNetworkManagement || !writeNetworkConfig {
a.startWorkerAfterUpgrade(runner, "networker", func() (worker.Worker, error) {
return newSafeNetworker(st.Networker(), agentConfig, networker.DefaultConfigDir)
})
} else if !disableNetworkManagement && writeNetworkConfig {
a.startWorkerAfterUpgrade(runner, "networker", func() (worker.Worker, error) {
return newNetworker(st.Networker(), agentConfig, networker.DefaultConfigDir)
})
}
// If not a local provider bootstrap machine, start the worker to
// manage SSH keys.
if providerType != provider.Local || a.MachineId != bootstrapMachineId {
a.startWorkerAfterUpgrade(runner, "authenticationworker", func() (worker.Worker, error) {
return authenticationworker.NewWorker(st.KeyUpdater(), agentConfig), nil
})
}
// Perform the operations needed to set up hosting for containers.
if err := a.setupContainerSupport(runner, st, entity, agentConfig); err != nil {
cause := errors.Cause(err)
if params.IsCodeDead(cause) || cause == worker.ErrTerminateAgent {
return nil, worker.ErrTerminateAgent
}
return nil, fmt.Errorf("setting up container support: %v", err)
}
for _, job := range entity.Jobs() {
switch job {
case params.JobHostUnits:
a.startWorkerAfterUpgrade(runner, "deployer", func() (worker.Worker, error) {
apiDeployer := st.Deployer()
context := newDeployContext(apiDeployer, agentConfig)
return deployer.NewDeployer(apiDeployer, context), nil
})
case params.JobManageEnviron:
a.startWorkerAfterUpgrade(singularRunner, "environ-provisioner", func() (worker.Worker, error) {
return provisioner.NewEnvironProvisioner(st.Provisioner(), agentConfig), nil
})
// TODO(axw) 2013-09-24 bug #1229506
// Make another job to enable the firewaller. Not all
// environments are capable of managing ports
// centrally.
a.startWorkerAfterUpgrade(singularRunner, "firewaller", func() (worker.Worker, error) {
return firewaller.NewFirewaller(st.Firewaller())
})
a.startWorkerAfterUpgrade(singularRunner, "charm-revision-updater", func() (worker.Worker, error) {
return charmrevisionworker.NewRevisionUpdateWorker(st.CharmRevisionUpdater()), nil
})
case params.JobManageStateDeprecated:
// Legacy environments may set this, but we ignore it.
default:
// TODO(dimitern): Once all workers moved over to using
// the API, report "unknown job type" here.
}
}
return newCloseWorker(runner, st), nil // Note: a worker.Runner is itself a worker.Worker.
}
开发者ID:zhouqt,项目名称:juju,代码行数:101,代码来源:machine.go
注:本文中的github.com/juju/juju/worker/provisioner.NewEnvironProvisioner函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论