From 9a70ab0218f6772eabd3c9158d328bc082d138f9 Mon Sep 17 00:00:00 2001 From: Nikos Kouremenos Date: Wed, 18 May 2005 16:42:28 +0000 Subject: [PATCH] Some distros put to optional LSB vars n/a, so detect that and remove it. SUSE uses lsb_release for quite a lot of versions I've been told so depend only on lsb for SuSE [the files things was untested in SUSE anyways] --- src/common/connection.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/common/connection.py b/src/common/connection.py index ff0654148..19f52f1c6 100644 --- a/src/common/connection.py +++ b/src/common/connection.py @@ -20,6 +20,7 @@ import sys import os import time +import sre from calendar import timegm import common.xmpp @@ -49,9 +50,7 @@ distro_info = { 'Slackware Linux': '/etc/slackware-version', 'Solaris/Sparc': '/etc/release', 'Sun JDS': '/etc/sun-release', - 'Novell SUSE Linux': '/etc/SuSE-release', 'PLD Linux': '/etc/pld-release', - 'SUSE Linux': '/etc/SuSE-release', 'Yellow Dog Linux': '/etc/yellowdog-release', # many distros use the /etc/redhat-release for compatibility # so Redhat is the last @@ -82,6 +81,9 @@ def get_os_info(): output = child_stdout.readline().strip() child_stdout.close() child_stdin.close() + # some distros put n/a in places so remove them + pattern = sre.compile(r' n/a', sre.IGNORE_CASE) + output = sre.sub(pattern, '', output) return output # lsb_release executable not available, so parse files for distro_name in distro_info: