From 424ee36e0540ca9357a6f7c678009d8fd39920a1 Mon Sep 17 00:00:00 2001 From: Logos01 Date: Mon, 28 Apr 2014 14:37:23 -0700 Subject: [PATCH] Enable facts module on older SuSE systems Modified logic of distribution_release for SuSE to retain the last discovered key/value pair's value in /etc/SuSE-release that contains a '=' character. --- lib/ansible/module_utils/facts.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/ansible/module_utils/facts.py b/lib/ansible/module_utils/facts.py index 21e0cdc5dc..bcdfd2a7e0 100644 --- a/lib/ansible/module_utils/facts.py +++ b/lib/ansible/module_utils/facts.py @@ -303,7 +303,9 @@ class Facts(object): self.facts['distribution_release'] = ora_prefix + data elif name == 'SuSE': data = get_file_content(path).splitlines() - self.facts['distribution_release'] = data[2].split('=')[1].strip() + for line in data: + if '=' in line: + self.facts['distribution_release'] = line.split('=')[1].strip() elif name == 'Debian': data = get_file_content(path).split('\n')[0] release = re.search("PRETTY_NAME.+ \(?([^ ]+?)\)?\"", data)