From b49cb2e540bd8460f4490e11870c52509c5eb482 Mon Sep 17 00:00:00 2001 From: lichesser Date: Thu, 26 Dec 2013 17:53:17 +0100 Subject: [PATCH] Partial fix for #4565. Works only for Debian 7 and later --- library/system/setup | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/library/system/setup b/library/system/setup index 816039469c..9a31b10da4 100755 --- a/library/system/setup +++ b/library/system/setup @@ -118,7 +118,8 @@ class Facts(object): '/etc/alpine-release': 'Alpine', '/etc/release': 'Solaris', '/etc/arch-release': 'Archlinux', - '/etc/SuSE-release': 'SuSE' } + '/etc/SuSE-release': 'SuSE', + '/etc/os-release': 'Debian' } SELINUX_MODE_DICT = { 1: 'enforcing', 0: 'permissive', -1: 'disabled' } # A list of dicts. If there is a platform with more than one @@ -328,6 +329,11 @@ class Facts(object): elif name == 'SuSE': data = get_file_content(path).splitlines() self.facts['distribution_release'] = data[2].split('=')[1].strip() + elif name == 'Debian': + data = get_file_content(path).split('\n')[0] + release = re.search("PRETTY_NAME.+ \(?([^ ]+?)\)?\"", data) + if release: + self.facts['distribution_release'] = release.groups()[0] else: self.facts['distribution'] = name