feat(unit): Allow units to be enabled even if contents not provided
This commit is contained in:
parent
476761cf62
commit
61bb63b6e6
@ -130,15 +130,15 @@ func Apply(cfg CloudConfig, env *Environment) error {
|
|||||||
|
|
||||||
if len(cfg.Coreos.Units) > 0 {
|
if len(cfg.Coreos.Units) > 0 {
|
||||||
commands := make(map[string]string, 0)
|
commands := make(map[string]string, 0)
|
||||||
|
|
||||||
for _, unit := range cfg.Coreos.Units {
|
for _, unit := range cfg.Coreos.Units {
|
||||||
if unit.Content != "" {
|
|
||||||
dst := system.UnitDestination(&unit, env.Root())
|
dst := system.UnitDestination(&unit, env.Root())
|
||||||
|
if unit.Content != "" {
|
||||||
log.Printf("Writing unit %s to filesystem at path %s", unit.Name, dst)
|
log.Printf("Writing unit %s to filesystem at path %s", unit.Name, dst)
|
||||||
if err := system.PlaceUnit(&unit, dst); err != nil {
|
if err := system.PlaceUnit(&unit, dst); 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 unit.Enable {
|
if unit.Enable {
|
||||||
if unit.Group() != "network" {
|
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)
|
log.Printf("Skipping enable for network-like unit %s", unit.Name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if unit.Group() == "network" {
|
if unit.Group() == "network" {
|
||||||
commands["systemd-networkd.service"] = "restart"
|
commands["systemd-networkd.service"] = "restart"
|
||||||
|
Loading…
Reference in New Issue
Block a user