summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Minar <miminar@redhat.com>2013-11-19 15:58:45 +0100
committerMichal Minar <miminar@redhat.com>2013-11-20 13:30:45 +0100
commitb6d2338da4e396e8750f6adbbc1f8509bc438fad (patch)
tree8889ddee50e83812421cb6c142e4e4d4526d9d21
parentf6af59089a87f0c12dca3bccd5ebd1d44b57e735 (diff)
downloadopenlmi-providers-b6d2338da4e396e8750f6adbbc1f8509bc438fad.tar.gz
openlmi-providers-b6d2338da4e396e8750f6adbbc1f8509bc438fad.tar.xz
openlmi-providers-b6d2338da4e396e8750f6adbbc1f8509bc438fad.zip
software: fixed verification of device files
Rpm database stores raw device number that needs to be compared with st_rdev attribute of stat object, not the st_dev one.
-rw-r--r--src/software/lmi/software/core/IdentityFileCheck.py9
-rw-r--r--src/software/lmi/software/yumdb/packagecheck.py2
2 files changed, 8 insertions, 3 deletions
diff --git a/src/software/lmi/software/core/IdentityFileCheck.py b/src/software/lmi/software/core/IdentityFileCheck.py
index 23ed056..8032442 100644
--- a/src/software/lmi/software/core/IdentityFileCheck.py
+++ b/src/software/lmi/software/core/IdentityFileCheck.py
@@ -571,8 +571,13 @@ class FileCheck(object):
@property
def device(self):
- """:rtype: (``tuple``) Pair of (installed, original)."""
- return (self.getstat('dev'), self._pkg_file.device)
+ """
+ :returns: Pair of (installed, original). Where both are raw device
+ numbers. ``os.major()`` and ``os.minor()`` function can be used
+ on them.
+ :rtype: tuple
+ """
+ return (self.getstat('rdev'), self._pkg_file.device)
@property
def link_target(self):
diff --git a/src/software/lmi/software/yumdb/packagecheck.py b/src/software/lmi/software/yumdb/packagecheck.py
index e66078c..0a7f351 100644
--- a/src/software/lmi/software/yumdb/packagecheck.py
+++ b/src/software/lmi/software/yumdb/packagecheck.py
@@ -60,7 +60,7 @@ class PackageFile(object):
``uid`` - (``int``) User ID.
``gid`` - (``int``) Group ID.
``mode`` - (``int``) Raw file mode.
- ``device`` - (``int``) Device number.
+ ``device`` - (``int``) Raw device number (st_rdev of stat object).
``mtime`` - (``int``) Last modification time in seconds.
``size`` - (``long``) File size as a number of bytes.
``link_target`` - (``str``) Link target of symlink. None if ``file_type``