From 1f23b7204952b9ce83d44157debe51a31e5beec3 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 (cherry picked from commit d3122d144350fecda7039c107b0311024a6d51a9) --- 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") }