Blame SOURCES/bz1886074-1-fencing-source_env.patch

3f9bc7
--- a/lib/fencing.py.py	2022-04-22 10:25:59.347139685 +0200
3f9bc7
+++ b/lib/fencing.py.py	2022-04-22 10:26:05.127169492 +0200
3f9bc7
@@ -1115,6 +1115,14 @@
3f9bc7
 	except pexpect.ExceptionPexpect:
3f9bc7
 		pass
3f9bc7
 
3f9bc7
+def source_env(env_file):
3f9bc7
+    # POSIX: name shall not contain '=', value doesn't contain '\0'
3f9bc7
+    output = subprocess.check_output("source {} && env -0".format(env_file), shell=True,
3f9bc7
+                          executable="/bin/sh")
3f9bc7
+    # replace env
3f9bc7
+    os.environ.clear()
3f9bc7
+    os.environ.update(line.partition('=')[::2] for line in output.decode("utf-8").split('\0'))
3f9bc7
+
3f9bc7
 # Convert array of format [[key1, value1], [key2, value2], ... [keyN, valueN]] to dict, where key is
3f9bc7
 # in format a.b.c.d...z and returned dict has key only z
3f9bc7
 def array_to_dict(array):