feat(unit): Allow units to be enabled even if contents not provided

This commit is contained in:
Brian Waldon 2014-04-15 09:00:19 -07:00
parent 476761cf62
commit 61bb63b6e6

View File

@ -130,15 +130,15 @@ func Apply(cfg CloudConfig, env *Environment) error {
if len(cfg.Coreos.Units) > 0 {
commands := make(map[string]string, 0)
for _, unit := range cfg.Coreos.Units {
if unit.Content != "" {
dst := system.UnitDestination(&unit, env.Root())
if unit.Content != "" {
log.Printf("Writing unit %s to filesystem at path %s", unit.Name, dst)
if err := system.PlaceUnit(&unit, dst); err != nil {
return err
}
log.Printf("Placed unit %s at %s", unit.Name, dst)
}
if unit.Enable {
if unit.Group() != "network" {
@ -151,7 +151,6 @@ func Apply(cfg CloudConfig, env *Environment) error {
log.Printf("Skipping enable for network-like unit %s", unit.Name)
}
}
}
if unit.Group() == "network" {
commands["systemd-networkd.service"] = "restart"