Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
snf-image-creator
Commits
ea65ce8a
Commit
ea65ce8a
authored
Jun 25, 2014
by
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
Changes
1
Hide whitespace changes
Inline
Side-by-side
image_creator/os_type/__init__.py
View file @
ea65ce8a
...
...
@@ -401,6 +401,23 @@ class OSBase(object):
if
not
silent
:
self
.
out
.
success
(
'done'
)
def
check_version
(
self
,
major
,
minor
):
"""Checks the OS version against the one specified by the major, minor
tuple.
Returns:
< 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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment