[node-patches] Change in ovirt-node[master]: utils: Convenience function for checking OS/Version
fabiand at redhat.com
fabiand at redhat.com
Tue Aug 5 15:56:37 UTC 2014
Fabian Deutsch has uploaded a new change for review.
Change subject: utils: Convenience function for checking OS/Version
......................................................................
utils: Convenience function for checking OS/Version
Change-Id: I60b32168b4d5e5ede84b31e23b4d26a782d1f283
Signed-off-by: Fabian Deutsch <fabiand at fedoraproject.org>
---
M src/ovirt/node/utils/system.py
1 file changed, 29 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/91/31091/1
diff --git a/src/ovirt/node/utils/system.py b/src/ovirt/node/utils/system.py
index 46bc338..ca11e00 100644
--- a/src/ovirt/node/utils/system.py
+++ b/src/ovirt/node/utils/system.py
@@ -108,6 +108,18 @@
return sys.version_info[:2] == (2, 6)
+def is_min_el(minver):
+ """Check if el and min version minver
+ """
+ return SystemRelease().is_min_el(minver)
+
+
+def is_max_el(maxver):
+ """Check if el and max version maxver
+ """
+ return SystemRelease().is_max_el(maxver)
+
+
def is_rescue_mode():
"""If the system is running in rescue mode
"""
@@ -417,6 +429,23 @@
"""
return self.VENDOR.lower() == "redhat"
+ def is_min_el(self, minversion):
+ """Determin if this system is an EL and at min version minversion
+ """
+ if not self.is_el():
+ raise RuntimeError("Expected el product, but got: %s" %
+ self.PRODUCT)
+ return (int(self.VERSION) >= minversion)
+
+ def is_max_el(self, maxversion):
+ """Determin if this system is an EL and at max version maxversion
+ """
+ if not self.is_el():
+ raise RuntimeError("Expected el product, but got: %s" %
+ self.PRODUCT)
+ return (int(self.VERSION) <= maxversion)
+
+
class ProductInformation(base.Base):
"""Return oVirt Node product informations
--
To view, visit http://gerrit.ovirt.org/31091
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I60b32168b4d5e5ede84b31e23b4d26a782d1f283
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Fabian Deutsch <fabiand at redhat.com>
More information about the node-patches
mailing list