Martin Polednik has uploaded a new change for review. Change subject: osinfo: un-nest kernel version gathering function ......................................................................
osinfo: un-nest kernel version gathering function Previous function, kernelDict, had unclear naming and was needlessly nested within package_versions function. This patch un-nests the function and renames it to _runtime_kernel_version. The new name hints why we don't look up the version via rpmdb. Change-Id: I77f78882973855cc971bbdae66cc96c8068e8230 Signed-off-by: Martin Polednik <[email protected]> --- M lib/vdsm/osinfo.py 1 file changed, 12 insertions(+), 11 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/79/65379/1 diff --git a/lib/vdsm/osinfo.py b/lib/vdsm/osinfo.py index d443028..23bb2c2 100644 --- a/lib/vdsm/osinfo.py +++ b/lib/vdsm/osinfo.py @@ -178,17 +178,7 @@ def package_versions(): - def kernelDict(): - ret = os.uname() - try: - ver, rel = ret[2].split('-', 1) - except ValueError: - logging.error('kernel release not found', exc_info=True) - ver, rel = '0', '0' - - return dict(version=ver, release=rel) - - pkgs = {'kernel': kernelDict()} + pkgs = {'kernel': _runtime_kernel_version()} if _release_name() in (OSName.RHEVH, OSName.OVIRT, OSName.FEDORA, OSName.RHEL, OSName.POWERKVM): @@ -251,3 +241,14 @@ logging.error('', exc_info=True) return pkgs + + +def _runtime_kernel_version(): + ret = os.uname() + try: + ver, rel = ret[2].split('-', 1) + except ValueError: + logging.error('kernel release not found', exc_info=True) + ver, rel = '0', '0' + + return dict(version=ver, release=rel) -- To view, visit https://gerrit.ovirt.org/65379 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I77f78882973855cc971bbdae66cc96c8068e8230 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Martin Polednik <[email protected]> _______________________________________________ vdsm-patches mailing list -- [email protected] To unsubscribe send an email to [email protected]
