Only default to systemd if built with the systemd buildtag

For packages that don't ship with systemd, this changes the default for those distros.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
Daniel J Walsh 2020-03-31 11:24:22 -04:00
parent 50451a3d39
commit caf7fd95ca
3 changed files with 23 additions and 2 deletions

View File

@ -211,7 +211,7 @@ func defaultConfigFromMemory() (*EngineConfig, error) {
if onCgroupsv2, _ := isCgroup2UnifiedMode(); onCgroupsv2 {
c.OCIRuntime = "crun"
}
c.CgroupManager = SystemdCgroupsManager
c.CgroupManager = defaultCgroupManager()
c.StopTimeout = uint(10)
c.OCIRuntimes = map[string][]string{
@ -269,7 +269,7 @@ func defaultConfigFromMemory() (*EngineConfig, error) {
c.InfraImage = DefaultInfraImage
c.EnablePortReservation = true
c.NumLocks = 2048
c.EventsLogger = "journald"
c.EventsLogger = defaultEventsLogger()
c.DetachKeys = DefaultDetachKeys
c.SDNotify = false
// TODO - ideally we should expose a `type LockType string` along with

View File

@ -0,0 +1,11 @@
// +build !systemd
package config
func defaultCgroupManager() string {
return "cgroupfs"
}
func defaultEventsLogger() string {
return "file"
}

View File

@ -0,0 +1,10 @@
// +build systemd
package config
func defaultCgroupManager() string {
return SystemdCgroupsManager
}
func defaultEventsLogger() string {
return "journald"
}