Change in vdsm[master]: virtTests: fix initramfs permission detection

mpoledni at redhat.com mpoledni at redhat.com
Wed Oct 9 13:02:58 UTC 2013


Martin Polednik has uploaded a new change for review.

Change subject: virtTests: fix initramfs permission detection
......................................................................

virtTests: fix initramfs permission detection

Initramfs permission was being detected using os.access
which caused running tests as root or user with permissions
to read initramfs when vdsm did not have these permissions
to fail the tests without creation if temporary initramfs
as os.access would see it as readable while it in fact was not.

This patch replaces os.access call with os.stat call,
which checks for permissions of >004 to make sure that
vdsm user can or can't read initramfs

Change-Id: I64316c727af529fd921553e2d8363b3946ad398d
Signed-off-by: Martin Polednik <mpoledni at redhat.com>
---
M tests/functional/virtTests.py
1 file changed, 2 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/31/20031/1

diff --git a/tests/functional/virtTests.py b/tests/functional/virtTests.py
index a4dd60f..300b59d 100644
--- a/tests/functional/virtTests.py
+++ b/tests/functional/virtTests.py
@@ -21,6 +21,7 @@
 import os
 import math
 import tempfile
+from stat import S_IROTH
 from functools import partial, wraps
 
 from nose.plugins.skip import SkipTest
@@ -74,7 +75,7 @@
 
     initramfsPaths = filter(os.path.isfile, initramfsPaths)
     if len(initramfsPaths) > 0:
-        if os.access(initramfsPaths[0], os.R_OK):
+        if (os.stat(initramfsPaths[0]).st_mode & S_IROTH):
             return initramfsPaths[0]
     return None
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I64316c727af529fd921553e2d8363b3946ad398d
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik <mpoledni at redhat.com>


More information about the vdsm-patches mailing list