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