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