[node-patches] Change in ovirt-node[master]: Replace md5 with generic cksum name and variables
Ryan Harper
ryanh at us.ibm.com
Tue Apr 9 16:05:08 UTC 2013
Ryan Harper has uploaded a new change for review.
Change subject: Replace md5 with generic cksum name and variables
......................................................................
Replace md5 with generic cksum name and variables
Prepare for replacing md5 with other hash functions but
not embedding the hash digest in function and variable names.
Change-Id: I8e0d01518f7ee87a54de1387a5a96392121647c2
Signed-off-by: Ryan Harper <ryanh at us.ibm.com>
---
M scripts/ovirtnode/ovirtfunctions.py
1 file changed, 8 insertions(+), 8 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/58/13758/1
diff --git a/scripts/ovirtnode/ovirtfunctions.py b/scripts/ovirtnode/ovirtfunctions.py
index e7be5d9..88876cd 100644
--- a/scripts/ovirtnode/ovirtfunctions.py
+++ b/scripts/ovirtnode/ovirtfunctions.py
@@ -719,7 +719,7 @@
logger.error("The data2 volume can not be mounted")
return False
-def md5sum(filename):
+def cksum(filename):
m = hashlib.md5()
with open(filename) as f:
data = f.read(4096)
@@ -761,9 +761,9 @@
elif os.path.isfile(filename):
# if it's a file then make sure it's not already persisted
if os.path.isfile("/config/" + filename):
- md5root=md5sum(filename)
- md5stored=md5sum("/config" + filename)
- if md5root == md5stored:
+ cksumroot=cksum(filename)
+ cksumstored=cksum("/config" + filename)
+ if cksumroot == cksumstored:
logger.warn("File already persisted: " + filename)
persist_it=False
else:
@@ -815,11 +815,11 @@
# if it's a file then make sure it's not already persisted
if os.path.isfile(OVIRT_CONFIG + filename):
if not source is None:
- md5root = md5sum(source)
+ cksumroot = cksum(source)
else:
- md5root = md5sum(filename)
- md5stored = md5sum(OVIRT_CONFIG + filename)
- if md5root == md5stored:
+ cksumroot = cksum(filename)
+ cksumstored = cksum(OVIRT_CONFIG + filename)
+ if cksumroot == cksumstored:
logger.warn("File already persisted: " + filename)
persist_it = False
else:
--
To view, visit http://gerrit.ovirt.org/13758
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8e0d01518f7ee87a54de1387a5a96392121647c2
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Ryan Harper <ryanh at us.ibm.com>
More information about the node-patches
mailing list