distribution - handle NetBSD OS Family (#70799)
Fixes: #43739 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
parent
8a4afbf9f2
commit
a223ea5185
3 changed files with 38 additions and 3 deletions
2
changelogs/fragments/distribution_support_netbsd.yml
Normal file
2
changelogs/fragments/distribution_support_netbsd.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
minor_changes:
|
||||
- distribution - handle NetBSD OS Family (https://github.com/ansible/ansible/issues/43739).
|
|
@ -507,7 +507,8 @@ class Distribution(object):
|
|||
'Darwin': ['MacOSX'],
|
||||
'FreeBSD': ['FreeBSD', 'TrueOS'],
|
||||
'ClearLinux': ['Clear Linux OS', 'Clear Linux Mix'],
|
||||
'DragonFly': ['DragonflyBSD', 'DragonFlyBSD', 'Gentoo/DragonflyBSD', 'Gentoo/DragonFlyBSD']}
|
||||
'DragonFly': ['DragonflyBSD', 'DragonFlyBSD', 'Gentoo/DragonflyBSD', 'Gentoo/DragonFlyBSD'],
|
||||
'NetBSD': ['NetBSD'], }
|
||||
|
||||
OS_FAMILY = {}
|
||||
for family, names in OS_FAMILY_MAP.items():
|
||||
|
@ -617,9 +618,16 @@ class Distribution(object):
|
|||
|
||||
def get_distribution_NetBSD(self):
|
||||
netbsd_facts = {}
|
||||
# FIXME: poking at self.facts, should eventually make these each a collector
|
||||
platform_release = platform.release()
|
||||
netbsd_facts['distribution_major_version'] = platform_release.split('.')[0]
|
||||
netbsd_facts['distribution_release'] = platform_release
|
||||
rc, out, dummy = self.module.run_command("/sbin/sysctl -n kern.version")
|
||||
match = re.match(r'NetBSD\s(\d+)\.(\d+)\s\((GENERIC)\).*', out)
|
||||
if match:
|
||||
netbsd_facts['distribution_major_version'] = match.group(1)
|
||||
netbsd_facts['distribution_version'] = '%s.%s' % match.groups()[:2]
|
||||
else:
|
||||
netbsd_facts['distribution_major_version'] = platform_release.split('.')[0]
|
||||
netbsd_facts['distribution_version'] = platform_release
|
||||
return netbsd_facts
|
||||
|
||||
def get_distribution_SMGL(self):
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"name": "NetBSD 8.2 (GENERIC) #0",
|
||||
"input": {},
|
||||
"platform.system": "NetBSD",
|
||||
"platform.release": "8.2",
|
||||
"command_output": {
|
||||
"/sbin/sysctl -n kern.version": "NetBSD 8.2 (GENERIC) #0: Tue Mar 31 05:08:40 UTC 2020\n mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/amd64/compile/GENERIC"
|
||||
},
|
||||
"distro": {
|
||||
"codename": "",
|
||||
"id": "netbsd",
|
||||
"name": "NetBSD",
|
||||
"version": "8.2",
|
||||
"version_best": "8.2",
|
||||
"os_release_info": {},
|
||||
"lsb_release_info": {}
|
||||
},
|
||||
"result": {
|
||||
"distribution": "NetBSD",
|
||||
"distribution_major_version": "8",
|
||||
"distribution_release": "8.2",
|
||||
"os_family": "NetBSD",
|
||||
"distribution_version": "8.2"
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue