Fix get_cnf if working on local machine
authorChristian Herdtweck <christian.herdtweck@intra2net.com>
Mon, 8 Nov 2021 08:26:52 +0000 (09:26 +0100)
committerChristian Herdtweck <christian.herdtweck@intra2net.com>
Mon, 8 Nov 2021 08:26:52 +0000 (09:26 +0100)
get_cnf always returns latin1-encoded output, but wrapper decoded shell-output
with system-default-encoding (usually utf8). Fix that

src/arnied_wrapper.py

index 774e835..4d13c4c 100644 (file)
@@ -430,7 +430,8 @@ def get_cnf(cnf_key, cnf_index=1, regex=".*", compact=False, timeout=30, vm=None
              cnf_index, cnf_key, platform_str, regex)
     cmd = "get_cnf%s %s%s" % (" -c " if compact else "", cnf_key,
                               " %s" % cnf_index if cnf_index != -1 else "")
-    output = run_cmd(cmd=cmd, vm=vm).stdout.decode()
+    # get_cnf creates latin1-encoded output, transfer from VM removes non-ascii
+    output = run_cmd(cmd=cmd, vm=vm).stdout.decode('latin1')
     return re.search(regex, output, flags=re.DOTALL)