Yedidyah Bar David has uploaded a new change for review.

Change subject: packagine: setup: Keep md5 sums of entire conf files
......................................................................

packagine: setup: Keep md5 sums of entire conf files

engine-setup keeps the md5 hash of configured files so that
on cleanup we can know if it's safe to delete them or some
manual change was made and we should keep them.

This change makes the code keep the md5 hash for the first 100MB
of each file, instead of 1000 bytes before. It was not changed
to be unlimited, to accommodate extreme cases of e.g. very large
iso images that would feel up all memory if read in whole.

Change-Id: Ie8dfc2f23d1a395dfb35d12fce97896df057816f
Signed-off-by: Yedidyah Bar David <[email protected]>
---
M packaging/setup/plugins/ovirt-engine-remove/files/simple.py
M packaging/setup/plugins/ovirt-engine-setup/core/uninstall.py
2 files changed, 6 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/81/16681/1

diff --git a/packaging/setup/plugins/ovirt-engine-remove/files/simple.py 
b/packaging/setup/plugins/ovirt-engine-remove/files/simple.py
index c871ccd..347eeac 100644
--- a/packaging/setup/plugins/ovirt-engine-remove/files/simple.py
+++ b/packaging/setup/plugins/ovirt-engine-remove/files/simple.py
@@ -43,8 +43,10 @@
 
     def _digestFile(self, filename):
         md5 = hashlib.new('md5')
+        # Read first 100MB of file, as to not fill up memory in
+        # extreme cases.
         with open(filename, 'rb') as f:
-            md5.update(f.read(1000))
+            md5.update(f.read(100000000))
         return md5.hexdigest()
 
     def _safeDelete(self, filename):
diff --git a/packaging/setup/plugins/ovirt-engine-setup/core/uninstall.py 
b/packaging/setup/plugins/ovirt-engine-setup/core/uninstall.py
index 05d4d50..9d0bbaf 100644
--- a/packaging/setup/plugins/ovirt-engine-setup/core/uninstall.py
+++ b/packaging/setup/plugins/ovirt-engine-setup/core/uninstall.py
@@ -76,8 +76,10 @@
 
     def _digestFile(self, filename):
         md5 = hashlib.new('md5')
+        # Read first 100MB of file, as to not fill up memory in
+        # extreme cases.
         with open(filename, 'rb') as f:
-            md5.update(f.read(1000))
+            md5.update(f.read(100000000))
         return md5.hexdigest()
 
     def __init__(self, context):


-- 
To view, visit http://gerrit.ovirt.org/16681
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie8dfc2f23d1a395dfb35d12fce97896df057816f
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Yedidyah Bar David <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to