feat(initialize): add locksmith configuration

configure locksmith strategy based on the cloud config.
This commit is contained in:
Alex Polvi
2014-05-06 17:44:18 -07:00
committed by Brandon Philips
parent c3f17bd07b
commit 7e4fa423e4
5 changed files with 207 additions and 3 deletions

View File

@@ -13,9 +13,10 @@ import (
type CloudConfig struct {
SSHAuthorizedKeys []string `yaml:"ssh_authorized_keys"`
Coreos struct {
Etcd EtcdEnvironment
Units []system.Unit
OEM OEMRelease
Etcd EtcdEnvironment
Update map[string]string
Units []system.Unit
OEM OEMRelease
}
WriteFiles []system.File `yaml:"write_files"`
Hostname string
@@ -128,6 +129,13 @@ func Apply(cfg CloudConfig, env *Environment) error {
log.Printf("Wrote etcd config file to filesystem")
}
if s, ok := cfg.Coreos.Update["reboot-strategy"]; ok {
if err := WriteLocksmithEnvironment(s, env.Root()); err != nil {
log.Fatalf("Failed to write locksmith config to filesystem: %v", err)
}
log.Printf("Wrote locksmith config file to filesystem")
}
if len(cfg.Coreos.Units) > 0 {
commands := make(map[string]string, 0)
for _, unit := range cfg.Coreos.Units {