Skip to content

Commit

Permalink
fix: execute sub-man cli with c.utf-8 lang locale
Browse files Browse the repository at this point in the history
Alter the execSubManCommand function to execute subscription-manager
commands with LANG set to C.UTF-8 to force English output
regardless of system and service locale settings.
This is necessary to populate the SubManValues map with expected key
names for subsequent key lookups, ensuring host information is correctly
retrieved.

Signed-off-by: ccowman <[email protected]>
  • Loading branch information
ConorC117 authored and F-X64 committed Sep 5, 2024
1 parent e219a8e commit 5a63c1e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions hostinfo/subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ func GetBillingInfo(facts SubManValues) (BillingInfo, error) {

func execSubManCommand(command ...string) (string, error) {
cmd := exec.Command("subscription-manager", command...)

// Set LANG to C.UTF-8 to force English output for predictable key lookups
cmd.Env = append(cmd.Environ(), "LANG=C.UTF-8")
logger.Debugf("Executing `subscription-manager %s`...\n", command)

var stdout, stderr bytes.Buffer
Expand Down

0 comments on commit 5a63c1e

Please sign in to comment.