Merge pull request #276 from crawford/networkd
initialize: restart networkd before other units
This commit is contained in:
commit
0e63aa0f6b
@ -265,8 +265,13 @@ func processUnits(units []system.Unit, root string, um system.UnitManager) error
|
|||||||
}
|
}
|
||||||
|
|
||||||
if restartNetworkd {
|
if restartNetworkd {
|
||||||
|
log.Printf("Restarting systemd-networkd")
|
||||||
networkd := system.Unit{Unit: config.Unit{Name: "systemd-networkd.service"}}
|
networkd := system.Unit{Unit: config.Unit{Name: "systemd-networkd.service"}}
|
||||||
actions = append(actions, action{networkd, "restart"})
|
res, err := um.RunUnitCommand(networkd, "restart")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
log.Printf("Restarted systemd-networkd (%s)", res)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, action := range actions {
|
for _, action := range actions {
|
||||||
@ -275,7 +280,7 @@ func processUnits(units []system.Unit, root string, um system.UnitManager) error
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
log.Printf("Result of %q on %q': %s", action.command, action.unit.Name, res)
|
log.Printf("Result of %q on %q: %s", action.command, action.unit.Name, res)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -87,16 +87,26 @@ func TestProcessUnits(t *testing.T) {
|
|||||||
{
|
{
|
||||||
units: []system.Unit{
|
units: []system.Unit{
|
||||||
system.Unit{Unit: config.Unit{
|
system.Unit{Unit: config.Unit{
|
||||||
Name: "foo.network",
|
Name: "baz.service",
|
||||||
|
Content: "[Service]\nExecStart=/bin/baz",
|
||||||
|
Command: "start",
|
||||||
}},
|
}},
|
||||||
system.Unit{Unit: config.Unit{
|
system.Unit{Unit: config.Unit{
|
||||||
Name: "bar.network",
|
Name: "foo.network",
|
||||||
|
Content: "[Network]\nFoo=true",
|
||||||
|
}},
|
||||||
|
system.Unit{Unit: config.Unit{
|
||||||
|
Name: "bar.network",
|
||||||
|
Content: "[Network]\nBar=true",
|
||||||
}},
|
}},
|
||||||
},
|
},
|
||||||
result: TestUnitManager{
|
result: TestUnitManager{
|
||||||
|
placed: []string{"baz.service", "foo.network", "bar.network"},
|
||||||
commands: []UnitAction{
|
commands: []UnitAction{
|
||||||
UnitAction{"systemd-networkd.service", "restart"},
|
UnitAction{"systemd-networkd.service", "restart"},
|
||||||
|
UnitAction{"baz.service", "start"},
|
||||||
},
|
},
|
||||||
|
reload: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user