Merge pull request #10 from coreos/enable-non-network-only

fix(unit): Only enable non-network-like units
This commit is contained in:
Brian Waldon 2014-03-12 18:04:07 -07:00
commit 8830bc8fef

View File

@ -67,16 +67,22 @@ func ApplyCloudConfig(cfg CloudConfig, sshKeyName string) error {
if len(cfg.Coreos.Units) > 0 { if len(cfg.Coreos.Units) > 0 {
for _, unit := range cfg.Coreos.Units { for _, unit := range cfg.Coreos.Units {
log.Printf("Placing unit %s on filesystem", unit.Name)
dst, err := PlaceUnit("/", &unit) dst, err := PlaceUnit("/", &unit)
if err != nil { if err != nil {
return err return err
} }
log.Printf("Placed unit %s at %s", unit.Name, dst) log.Printf("Placed unit %s at %s", unit.Name, dst)
if err := EnableUnitFile(dst, unit.Runtime); err != nil { if unit.Group() != "network" {
return err log.Printf("Enabling unit file %s", dst)
if err := EnableUnitFile(dst, unit.Runtime); err != nil {
return err
}
log.Printf("Enabled unit %s", unit.Name)
} else {
log.Printf("Skipping enable for network-like unit %s", unit.Name)
} }
log.Printf("Enabled unit %s", unit.Name)
} }
DaemonReload() DaemonReload()
StartUnits(cfg.Coreos.Units) StartUnits(cfg.Coreos.Units)