Commit ea65ce8a authored by Nikos Skalkotos's avatar Nikos Skalkotos
Browse files

Add check_version method in OSBase

This method can be used to compare the OS version against one specified
by the user.
parent b6b4f861
......@@ -401,6 +401,23 @@ class OSBase(object):
if not silent:
def check_version(self, major, minor):
"""Checks the OS version against the one specified by the major, minor
< 0 if the OS version is smaller than the specified one
= 0 if they are equal
> 0 if it is greater
guestfs = self.image.g
for a, b in ((guestfs.inspect_get_major_version(self.root), major),
(guestfs.inspect_get_minor_version(self.root), minor)):
if a != b:
return a - b
return 0
def _is_sysprep(self, obj):
"""Checks if an object is a sysprep"""
return getattr(obj, 'sysprep', False) and callable(obj)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment