本文整理汇总了Golang中github.com/juju/juju/environs/cloudinit.MachineConfig.Jobs方法的典型用法代码示例。如果您正苦于以下问题:Golang MachineConfig.Jobs方法的具体用法?Golang MachineConfig.Jobs怎么用?Golang MachineConfig.Jobs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/juju/juju/environs/cloudinit.MachineConfig
的用法示例。
在下文中一共展示了MachineConfig.Jobs方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: getCloudConfig
func (s *configureSuite) getCloudConfig(c *gc.C, stateServer bool, vers version.Binary) *cloudinit.Config {
var mcfg *envcloudinit.MachineConfig
var err error
if stateServer {
mcfg, err = environs.NewBootstrapMachineConfig(constraints.Value{}, vers.Series)
c.Assert(err, gc.IsNil)
mcfg.InstanceId = "instance-id"
mcfg.Jobs = []params.MachineJob{params.JobManageEnviron, params.JobHostUnits}
} else {
mcfg, err = environs.NewMachineConfig("0", "ya", imagemetadata.ReleasedStream, vers.Series, nil, nil, nil)
c.Assert(err, gc.IsNil)
mcfg.Jobs = []params.MachineJob{params.JobHostUnits}
}
mcfg.Tools = &tools.Tools{
Version: vers,
URL: "http://testing.invalid/tools.tar.gz",
}
environConfig := testConfig(c, stateServer, vers)
err = environs.FinishMachineConfig(mcfg, environConfig)
c.Assert(err, gc.IsNil)
cloudcfg := cloudinit.New()
udata, err := envcloudinit.NewUserdataConfig(mcfg, cloudcfg)
c.Assert(err, gc.IsNil)
err = udata.Configure()
c.Assert(err, gc.IsNil)
return cloudcfg
}
示例2: getCloudConfig
func (s *configureSuite) getCloudConfig(c *gc.C, stateServer bool, vers version.Binary) *cloudinit.Config {
var mcfg *envcloudinit.MachineConfig
if stateServer {
mcfg = environs.NewBootstrapMachineConfig("private-key")
mcfg.InstanceId = "instance-id"
mcfg.Jobs = []params.MachineJob{params.JobManageEnviron, params.JobHostUnits}
} else {
mcfg = environs.NewMachineConfig("0", "ya", nil, nil, nil)
mcfg.Jobs = []params.MachineJob{params.JobHostUnits}
}
mcfg.Tools = &tools.Tools{
Version: vers,
URL: "file:///var/lib/juju/storage/" + envtools.StorageName(vers),
}
environConfig := testConfig(c, stateServer, vers)
err := environs.FinishMachineConfig(mcfg, environConfig, constraints.Value{})
c.Assert(err, gc.IsNil)
cloudcfg := cloudinit.New()
err = envcloudinit.Configure(mcfg, cloudcfg)
c.Assert(err, gc.IsNil)
return cloudcfg
}
示例3: assocProvInfoAndMachCfg
func assocProvInfoAndMachCfg(
provInfo *params.ProvisioningInfo,
machineConfig *cloudinit.MachineConfig,
) *provisioningInfo {
machineConfig.Networks = provInfo.Networks
if len(provInfo.Jobs) > 0 {
machineConfig.Jobs = provInfo.Jobs
}
return &provisioningInfo{
Constraints: provInfo.Constraints,
Series: provInfo.Series,
Placement: provInfo.Placement,
MachineConfig: machineConfig,
}
}