Better FreeBSD distribution facts (#15866)

* - Give more usable content to distribution_version and set distribution_major_version

* Make python 2.4 friendly
This commit is contained in:
biancalana 2016-06-14 18:58:23 -03:00 committed by Brian Coca
parent 8c8e064828
commit e143d3a75b

View file

@ -675,7 +675,7 @@ class Distribution(object):
self.facts['distribution_release'] = platform.release()
self.facts['distribution_version'] = platform.version()
systems_implemented = ('AIX', 'HP-UX', 'Darwin', 'OpenBSD')
systems_implemented = ('AIX', 'HP-UX', 'Darwin', 'FreeBSD', 'OpenBSD')
self.facts['distribution'] = self.system
@ -764,6 +764,13 @@ class Distribution(object):
data = out.split()[-1]
self.facts['distribution_version'] = data
def get_distribution_FreeBSD(self):
self.facts['distribution_release'] = platform.release()
data = re.search('(\d+)\.(\d+)-RELEASE.*', self.facts['distribution_release'])
if data:
self.facts['distribution_major_version'] = data.group(1)
self.facts['distribution_version'] = '%s.%s' % (data.group(1), data.group(2))
def get_distribution_OpenBSD(self):
rc, out, err = self.module.run_command("/sbin/sysctl -n kern.version")
match = re.match('OpenBSD\s[0-9]+.[0-9]+-(\S+)\s.*', out)