fence-agents/0005-run_command-fix-Python-3-encoding-issue.patch
Kristoffer Gronlund 49a513e01e - run_command: fix Python 3 encoding issue (bsc#1082871)
- fence_gce: use default credentials from googleapiclient
- fence_gce: fix regression - missing import oauth2client.client
- fence_gce: fix regression - missing import googleapiclient.discovery
- Add 0002-fence_gce-fix-regression-missing-import-googleapicli.patch
- Add 0003-fence_gce-fix-regression-missing-import-oauth2client.patch
- Add 0004-fence_gce-use-default-credentials-from-googleapiclie.patch
- Add 0005-run_command-fix-Python-3-encoding-issue.patch

OBS-URL: https://build.opensuse.org/package/show/network:ha-clustering:Factory/fence-agents?expand=0&rev=87
2018-05-17 16:27:45 +00:00

28 lines
1.0 KiB
Diff

From b587642048b9f75cdc08d4d9e3fa03f14811cc21 Mon Sep 17 00:00:00 2001
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
Date: Fri, 20 Apr 2018 15:16:42 +0200
Subject: [PATCH 5/5] run_command: fix Python 3 encoding issue
---
fence/agents/lib/fencing.py.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index 5b38460e..15914f0f 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -995,7 +995,9 @@ def run_command(options, command, timeout=None, env=None, log_command=None):
logging.info("Executing: %s\n", log_command or command)
try:
- process = subprocess.Popen(shlex.split(command), stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env)
+ process = subprocess.Popen(shlex.split(command), stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env,
+ # decodes newlines and in python3 also converts bytes to str
+ universal_newlines=(sys.version_info[0] > 2))
except OSError:
fail_usage("Unable to run %s\n" % command)
--
2.16.3