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:
parent
8c8e064828
commit
e143d3a75b
1 changed files with 8 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue