Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(682)

Unified Diff: environs/cloudinit.go

Issue 83530043: environs/cloudinit: use StateServingInfo
Patch Set: environs/cloudinit: use StateServingInfo Created 9 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: environs/cloudinit.go
=== modified file 'environs/cloudinit.go'
--- environs/cloudinit.go 2014-03-25 11:44:19 +0000
+++ environs/cloudinit.go 2014-04-02 09:32:24 +0000
@@ -61,7 +61,7 @@
// For a bootstrap instance, FinishMachineConfig will provide the
// state.Info and the api.Info. The machine id must *always* be "0".
mcfg := NewMachineConfig("0", state.BootstrapNonce, nil, nil)
- mcfg.StateServer = true
+ mcfg.Bootstrap = true
fwereade 2014/04/02 10:52:38 yay!
mcfg.SystemPrivateSSHKey = privateSystemSSHKey
mcfg.Jobs = []params.MachineJob{params.JobManageEnviron, params.JobHostUnits}
return mcfg
@@ -120,7 +120,7 @@
// The following settings are only appropriate at bootstrap time. At the
// moment, the only state server is the bootstrap node, but this
// will probably change.
- if !mcfg.StateServer {
+ if !mcfg.Bootstrap {
return nil
}
if mcfg.APIInfo != nil || mcfg.StateInfo != nil {
@@ -137,27 +137,32 @@
passwordHash := utils.UserPasswordHash(password, utils.CompatSalt)
mcfg.APIInfo = &api.Info{Password: passwordHash, CACert: caCert}
mcfg.StateInfo = &state.Info{Password: passwordHash, CACert: caCert}
- mcfg.StatePort = cfg.StatePort()
- mcfg.APIPort = cfg.APIPort()
- mcfg.Constraints = cons
- if mcfg.Config, err = BootstrapConfig(cfg); err != nil {
- return err
- }
// These really are directly relevant to running a state server.
cert, key, err := cfg.GenerateStateServerCertAndKey()
if err != nil {
return errgo.Annotate(err, "cannot generate state server certificate")
}
- mcfg.StateServerCert = cert
- mcfg.StateServerKey = key
+
+ srvInfo := params.StateServingInfo{
+ StatePort: cfg.StatePort(),
+ APIPort: cfg.APIPort(),
+ Cert: string(cert),
+ PrivateKey: string(key),
+ }
+ mcfg.StateServingInfo = &srvInfo
+ mcfg.Constraints = cons
+ if mcfg.Config, err = BootstrapConfig(cfg); err != nil {
+ return err
+ }
+
return nil
}
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.StateServer {
+ if mcfg.Bootstrap {
return cloudinit.ConfigureBasic(mcfg, cloudcfg)
}
return cloudinit.Configure(mcfg, cloudcfg)

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b