From a6fd122898d673549f7ecac748783fe6570dba09 Mon Sep 17 00:00:00 2001 From: Petr Vobornik Date: Tue, 12 Dec 2023 12:05:27 +0000 Subject: [PATCH] fix: `subscription-manager list --installed` call failure The `subscription-manager list --installed` was failing with RC 1, after printing stdout it visible that it reported that it was called incorrectly and thus printed help text. Issue was caused by the way how parameters were passed, now each is passed separately as the exec.Command expects it. https://issues.redhat.com/browse/HMS-3021 Signed-off-by: Petr Vobornik --- hostinfo/subscription.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hostinfo/subscription.go b/hostinfo/subscription.go index 240fce7..d33555d 100644 --- a/hostinfo/subscription.go +++ b/hostinfo/subscription.go @@ -60,7 +60,7 @@ func GetSocketCount(facts SubManValues) (string, error) { } func GetProduct(facts SubManValues) ([]string, error) { - output, _ := execSubManCommand("list --installed") + output, _ := execSubManCommand("list", "--installed") values := parseSubManOutputMultiVal(output) return values.get("Product ID") } @@ -104,8 +104,8 @@ func GetBillingInfo(facts SubManValues) (BillingInfo, error) { return BillingInfo{}, err } -func execSubManCommand(command string) (string, error) { - cmd := exec.Command("subscription-manager", command) +func execSubManCommand(command ...string) (string, error) { + cmd := exec.Command("subscription-manager", command...) logger.Debugf("Executing `subscription-manager %s`...\n", command) var stdout, stderr bytes.Buffer