[node-patches] Change in ovirt-node[ovirt-3.6]: fs/__init__.py: check if it's a file before chksum

dougsland at redhat.com dougsland at redhat.com
Mon Jun 13 20:51:40 UTC 2016


Douglas Schilling Landgraf has uploaded a new change for review.

Change subject: fs/__init__.py: check if it's a file before chksum
......................................................................

fs/__init__.py: check if it's a file before chksum

Make sure before doing the cksum validation, it's a file, not a dir.

Change-Id: I8a50dca7521336a9feafbc6c03fa38e1a57a6ba9
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1311370
Signed-off-by: Douglas Schilling Landgraf <dougsland at redhat.com>
---
M src/ovirt/node/utils/fs/__init__.py
1 file changed, 6 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/91/59091/1

diff --git a/src/ovirt/node/utils/fs/__init__.py b/src/ovirt/node/utils/fs/__init__.py
index dcf312c..d7e5960 100644
--- a/src/ovirt/node/utils/fs/__init__.py
+++ b/src/ovirt/node/utils/fs/__init__.py
@@ -689,12 +689,13 @@
                 not os.path.exists(filename):
             return False
 
-        current_checksum = self.cksum(filename)
-        stored_checksum = self.cksum(persisted_path)
-        if stored_checksum == current_checksum:
-            return True
+        if os.path.isfile(filename):
+            current_checksum = self.cksum(filename)
+            stored_checksum = self.cksum(persisted_path)
+            if stored_checksum != current_checksum:
+                return False
 
-        return False
+        return True
 
     def is_enabled(self):
         return File("/proc").exists() and is_bind_mount(self.basedir)


-- 
To view, visit https://gerrit.ovirt.org/59091
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8a50dca7521336a9feafbc6c03fa38e1a57a6ba9
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: ovirt-3.6
Gerrit-Owner: Douglas Schilling Landgraf <dougsland at redhat.com>



More information about the node-patches mailing list