本文整理匯總了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,
}
}