Skip to content

Commit

Permalink
fix: subscription-manager list --installed call failure
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
pvoborni committed Dec 12, 2023
1 parent 9885785 commit a6fd122
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions hostinfo/subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit a6fd122

Please sign in to comment.