本文整理汇总了Golang中github.com/juju/juju/environs/cloudinit.Configure函数的典型用法代码示例。如果您正苦于以下问题:Golang Configure函数的具体用法?Golang Configure怎么用?Golang Configure使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Configure函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: configureCloudinit
func configureCloudinit(mcfg *cloudinit.MachineConfig, cloudcfg *coreCloudinit.Config) error {
// When bootstrapping, we only want to apt-get update/upgrade
// and setup the SSH keys. The rest we leave to cloudinit/sshinit.
if mcfg.Bootstrap {
return cloudinit.ConfigureBasic(mcfg, cloudcfg)
}
return cloudinit.Configure(mcfg, cloudcfg)
}
示例2: cloudInitUserData
func cloudInitUserData(machineConfig *cloudinit.MachineConfig) ([]byte, error) {
cloudConfig := coreCloudinit.New()
err := cloudinit.Configure(machineConfig, cloudConfig)
if err != nil {
return nil, err
}
// Run ifconfig to get the addresses of the internal container at least
// logged in the host.
cloudConfig.AddRunCmd("ifconfig")
data, err := cloudConfig.Render()
if err != nil {
return nil, err
}
return data, nil
}
示例3: 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
}