[NEW PATCH] BZ#735932 vds_bootstrap: do not require and do not use redhat-lsb (via gerrit-bot)

Dan Kenigsberg danken at redhat.com
Tue Sep 6 11:32:26 UTC 2011


New patch submitted by Dan Kenigsberg (danken at redhat.com)

You can review this change at: http://gerrit.usersys.redhat.com/898

commit b67b5b04c545ae8b8d52c024d0db9611354913c9
Author: Dan Kenigsberg <danken at redhat.com>
Date:   Tue Sep 6 11:24:40 2011 +0300

    BZ#735932 vds_bootstrap: do not require and do not use redhat-lsb
    
    redhat-lsb is no longer installed on RHEL by default, and comes with a
    heavy dependency list. Using it lengthen installation time needlessly.
    
    v2:
    - drop remnants of lsb from configure.ac
    - do not require redhat-lsb
    - search all files for release info
    - fix logging typo
    
    Change-Id: Ia6f0bb85b126a4471dfd63e46bebad229c28a4f9

diff --git a/configure.ac b/configure.ac
index 6e86c47..a279c29 100644
--- a/configure.ac
+++ b/configure.ac
@@ -73,7 +73,6 @@ AC_PATH_PROG([IONICE_PATH], [ionice], [/usr/bin/ionice])
 AC_PATH_PROG([IPCALC_PATH], [ipcalc], [/bin/ipcalc])
 AC_PATH_PROG([ISCSIADM_PATH], [iscsiadm], [/sbin/iscsiadm])
 AC_PATH_PROG([KILL_PATH], [kill], [/bin/kill])
-AC_PATH_PROG([LSB_RELEASE_PATH], [lsb_release], [/usr/bin/lsb_release])
 AC_PATH_PROG([LVM_PATH], [lvm], [/sbin/lvm])
 AC_PATH_PROG([MKFS_PATH], [mkfs], [/sbin/mkfs])
 AC_PATH_PROG([MOUNT_PATH], [mount], [/bin/mount])
diff --git a/vds_bootstrap/vds_bootstrap.py b/vds_bootstrap/vds_bootstrap.py
index c7a29f4..733fc33 100755
--- a/vds_bootstrap/vds_bootstrap.py
+++ b/vds_bootstrap/vds_bootstrap.py
@@ -63,13 +63,6 @@ logging.basicConfig(level=logging.DEBUG,
 
 try:
     import deployUtil
-    res, msg = deployUtil.installAndVerify('REQ', 'redhat-lsb.x86_64', 'install')
-    if not res:
-        message = "Failed to verify installation of redhat-lsb"
-        print ("<BSTRAP component='INIT' status='FAIL' message='%s'/>" % message)
-        logging.debug("<BSTRAP component='INIT' status='FAIL' message='%s'/>", message)
-        logging.error(traceback.format_exc())
-        exit(-1)
 except:
     message = "Error trying to deploy library."
     print ("<BSTRAP component='INIT' status='FAIL' message='%s'/>" % message)
diff --git a/vdsm_reg/deployUtil.py.in b/vdsm_reg/deployUtil.py.in
index f6bec9b..81020bb 100644
--- a/vdsm_reg/deployUtil.py.in
+++ b/vdsm_reg/deployUtil.py.in
@@ -37,6 +37,7 @@ import httplib
 import glob
 import imp
 from optparse import OptionParser
+from itertools import dropwhile, islice
 
 try:
     from ovirtnode import ovirtfunctions
@@ -61,7 +62,6 @@ EX_ECHO = '@ECHO_PATH@'
 EX_GRUBBY = '@GRUBBY_PATH@'
 EX_HWCLOCK = '@HWCLOCK_PATH@'
 EX_IFCONFIG = '@IFCONFIG_PATH@'
-EX_LSB_RELEASE = '@LSB_RELEASE_PATH@'
 EX_OPENSSL = '@OPENSSL_PATH@'
 EX_REBOOT = '@REBOOT_PATH@'
 EX_RPM = '@RPM_PATH@'
@@ -350,18 +350,25 @@ def isOvirt():
 
 def getOSVersion():
     """
-        Return the OS' release from accordong to LSB specification.
+    Return the OS release, similarly to `lsb_release -rs`
+
+    Return "Unknown OS" on any failure.
     """
-    strReturn = "Unknown OS"
 
-    if os.path.exists(EX_LSB_RELEASE):
-        out, err, rc = _logExec([EX_LSB_RELEASE, "-rs"])
+    s = ''
+    for f in ('/etc/rhev-hypervisor-release', '/etc/redhat-release',
+              '/etc/fedora-release'):
         try:
-            strReturn = out.replace("\n","")
-        except:
-            strReturn = "Unknown OS"
+            s = file(f).read()
+        except OSError:
+            pass
 
-    return strReturn
+    try:
+        return islice(dropwhile(lambda x: x != 'release', s.split()),
+                      1, 2).next()
+    except:
+        logging.error('failed to parse os release from `%s`.', s, exc_info=True)
+        return "Unknown OS"
 
 def getKernelVersion():
     """




More information about the vdsm-patches mailing list