From 44995dc299cd32f8e7eaf6cbb7bc9e82488942cd Mon Sep 17 00:00:00 2001 From: Krisztian Litkey Date: Wed, 25 Oct 2023 20:10:33 +0300 Subject: [PATCH] config-manager: don't crash if no runtime is found running. Signed-off-by: Krisztian Litkey --- cmd/config-manager/main.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/config-manager/main.go b/cmd/config-manager/main.go index ee3c7969b..eb2c16d19 100644 --- a/cmd/config-manager/main.go +++ b/cmd/config-manager/main.go @@ -163,6 +163,10 @@ func detectRuntime() (string, error) { return "", fmt.Errorf("failed to detect container runtime in use: %w", err) } + if len(units) == 0 { + return "", fmt.Errorf("failed to detect container runtime in use: got 0 systemd units") + } + if len(units) > 1 { return "", fmt.Errorf("detected more than one container runtime on the host, expected one") }