34 lines
1.2 KiB
Diff
34 lines
1.2 KiB
Diff
From 335aca4e54e4ec46b9b5d86ef30a7d9348e6a216 Mon Sep 17 00:00:00 2001
|
|
From: Valentin Vidic <Valentin.Vidic@CARNet.hr>
|
|
Date: Wed, 23 May 2018 14:51:23 +0200
|
|
Subject: [PATCH] fence_scsi: fix python3 encoding error #206
|
|
|
|
File "/usr/sbin/fence_scsi", line 184, in get_cluster_id
|
|
return hashlib.md5(match.group(1)).hexdigest()
|
|
TypeError: Unicode-objects must be encoded before hashing
|
|
---
|
|
agents/scsi/fence_scsi.py | 4 ++--
|
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/agents/scsi/fence_scsi.py b/agents/scsi/fence_scsi.py
|
|
index 119dbb85..2180d0c9 100644
|
|
--- a/agents/scsi/fence_scsi.py
|
|
+++ b/agents/scsi/fence_scsi.py
|
|
@@ -181,11 +181,11 @@ def get_cluster_id(options):
|
|
fail_usage("Failed: cannot get cluster name")
|
|
|
|
try:
|
|
- return hashlib.md5(match.group(1)).hexdigest()
|
|
+ return hashlib.md5(match.group(1).encode('ascii')).hexdigest()
|
|
except ValueError:
|
|
# FIPS requires usedforsecurity=False and might not be
|
|
# available on all distros: https://bugs.python.org/issue9216
|
|
- return hashlib.md5(match.group(1), usedforsecurity=False).hexdigest()
|
|
+ return hashlib.md5(match.group(1).encode('ascii'), usedforsecurity=False).hexdigest()
|
|
|
|
|
|
def get_node_id(options):
|
|
--
|
|
2.17.0
|
|
|