Blame SOURCES/bz1455383-fence_scsi-FIPS-support.patch

035a21
From 81b8370844f5aecaee5e7178d82670c70399d824 Mon Sep 17 00:00:00 2001
035a21
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
035a21
Date: Mon, 24 Jul 2017 16:12:15 +0200
035a21
Subject: [PATCH] fence_scsi: add FIPS support
035a21
035a21
---
035a21
 fence/agents/scsi/fence_scsi.py | 11 ++++++++++-
035a21
 1 file changed, 10 insertions(+), 1 deletion(-)
035a21
035a21
diff --git a/fence/agents/scsi/fence_scsi.py b/fence/agents/scsi/fence_scsi.py
035a21
index 37ff1d38..3ebe6513 100644
035a21
--- a/fence/agents/scsi/fence_scsi.py
035a21
+++ b/fence/agents/scsi/fence_scsi.py
035a21
@@ -182,7 +182,16 @@ def get_cluster_id(options):
035a21
 	cmd = options["--corosync-cmap-path"] + " totem.cluster_name"
035a21
 
035a21
 	match = re.search(r"\(str\) = (\S+)\n", run_cmd(options, cmd)["out"])
035a21
-	return hashlib.md5(match.group(1)).hexdigest() if match else fail_usage("Failed: cannot get cluster name")
035a21
+
035a21
+	if not match:
035a21
+		fail_usage("Failed: cannot get cluster name")
035a21
+
035a21
+	try:
035a21
+		return hashlib.md5(match.group(1)).hexdigest()
035a21
+	except ValueError:
035a21
+		# FIPS requires usedforsecurity=False and might not be
035a21
+		# available on all distros: https://bugs.python.org/issue9216
035a21
+		return hashlib.md5(match.group(1), usedforsecurity=False).hexdigest()
035a21
 
035a21
 
035a21
 def get_node_id(options):