From: Jakub Libosvar Date: Tue, 1 Apr 2014 14:41:38 +0000 (+0200) Subject: Use os.uname() instead of calling uname in subprocess X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=22a0692c2e9b0276c6b4dd2f66cedc70f7f835a5;p=openstack-build%2Fneutron-build.git Use os.uname() instead of calling uname in subprocess Related-Bug: #1291535 Change-Id: I57e18c0b95904f318e3fff08cd18b32e28f48834 --- diff --git a/neutron/agent/linux/ovs_lib.py b/neutron/agent/linux/ovs_lib.py index e1172234f..b9670d535 100644 --- a/neutron/agent/linux/ovs_lib.py +++ b/neutron/agent/linux/ovs_lib.py @@ -14,6 +14,7 @@ # under the License. import distutils.version as dist_version +import os import re from oslo.config import cfg @@ -480,13 +481,9 @@ def get_installed_ovs_klm_version(): def get_installed_kernel_version(): - args = ["uname", "-r"] try: - cmd = utils.execute(args) - for line in cmd.split('\n'): - ver = re.findall("\d+\.\d+\.\d+", line) - return ver[0] - except Exception: + return os.uname()[2].split('-', 1)[0] + except IndexError: LOG.exception(_("Unable to retrieve installed Linux kernel version."))