1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Add Source Mage GNU/Linux facts (#19671)

* Add Source Mage GNU/Linux facts

* Add unit test for OS-detection
This commit is contained in:
Vlad Glagolev 2017-01-31 13:25:36 -05:00 committed by Brian Coca
parent 524e5d2c39
commit 039d207d24
2 changed files with 25 additions and 1 deletions

View file

@ -157,6 +157,7 @@ class Facts(object):
{ 'path' : '/usr/bin/xbps-install','name' : 'xbps' }, { 'path' : '/usr/bin/xbps-install','name' : 'xbps' },
{ 'path' : '/usr/local/sbin/pkg', 'name' : 'pkgng' }, { 'path' : '/usr/local/sbin/pkg', 'name' : 'pkgng' },
{ 'path' : '/usr/bin/swupd', 'name' : 'swupd' }, { 'path' : '/usr/bin/swupd', 'name' : 'swupd' },
{ 'path' : '/usr/sbin/sorcery', 'name' : 'sorcery' },
] ]
def __init__(self, module, load_on_init=True, cached_facts=None): def __init__(self, module, load_on_init=True, cached_facts=None):
@ -653,6 +654,7 @@ class Distribution(object):
{'path': '/etc/os-release', 'name': 'Debian'}, {'path': '/etc/os-release', 'name': 'Debian'},
{'path': '/etc/lsb-release', 'name': 'Mandriva'}, {'path': '/etc/lsb-release', 'name': 'Mandriva'},
{'path': '/etc/altlinux-release', 'name': 'Altlinux'}, {'path': '/etc/altlinux-release', 'name': 'Altlinux'},
{'path': '/etc/sourcemage-release', 'name': 'SMGL'},
{'path': '/etc/os-release', 'name': 'NA'}, {'path': '/etc/os-release', 'name': 'NA'},
{'path': '/etc/coreos/update.conf', 'name': 'Coreos'}, {'path': '/etc/coreos/update.conf', 'name': 'Coreos'},
{'path': '/usr/lib/os-release', 'name': 'ClearLinux'}, {'path': '/usr/lib/os-release', 'name': 'ClearLinux'},
@ -663,6 +665,7 @@ class Distribution(object):
'RedHat': 'Red Hat', 'RedHat': 'Red Hat',
'Altlinux': 'ALT Linux', 'Altlinux': 'ALT Linux',
'ClearLinux': 'Clear Linux Software for Intel Architecture', 'ClearLinux': 'Clear Linux Software for Intel Architecture',
'SMGL': 'Source Mage GNU/Linux',
} }
# A list with OS Family members # A list with OS Family members
@ -672,7 +675,7 @@ class Distribution(object):
OracleLinux = 'RedHat', OVS = 'RedHat', OEL = 'RedHat', Amazon = 'RedHat', OracleLinux = 'RedHat', OVS = 'RedHat', OEL = 'RedHat', Amazon = 'RedHat',
XenServer = 'RedHat', Ubuntu = 'Debian', Debian = 'Debian', Raspbian = 'Debian', Slackware = 'Slackware', SLES = 'Suse', XenServer = 'RedHat', Ubuntu = 'Debian', Debian = 'Debian', Raspbian = 'Debian', Slackware = 'Slackware', SLES = 'Suse',
SLED = 'Suse', openSUSE = 'Suse', openSUSE_Tumbleweed = 'Suse', SuSE = 'Suse', SLES_SAP = 'Suse', SUSE_LINUX = 'Suse', Gentoo = 'Gentoo', Funtoo = 'Gentoo', SLED = 'Suse', openSUSE = 'Suse', openSUSE_Tumbleweed = 'Suse', SuSE = 'Suse', SLES_SAP = 'Suse', SUSE_LINUX = 'Suse', Gentoo = 'Gentoo', Funtoo = 'Gentoo',
Archlinux = 'Archlinux', Manjaro = 'Archlinux', Mandriva = 'Mandrake', Mandrake = 'Mandrake', Altlinux = 'Altlinux', Archlinux = 'Archlinux', Manjaro = 'Archlinux', Mandriva = 'Mandrake', Mandrake = 'Mandrake', Altlinux = 'Altlinux', SMGL = 'SMGL',
Solaris = 'Solaris', Nexenta = 'Solaris', OmniOS = 'Solaris', OpenIndiana = 'Solaris', Solaris = 'Solaris', Nexenta = 'Solaris', OmniOS = 'Solaris', OpenIndiana = 'Solaris',
SmartOS = 'Solaris', AIX = 'AIX', Alpine = 'Alpine', MacOSX = 'Darwin', SmartOS = 'Solaris', AIX = 'AIX', Alpine = 'Alpine', MacOSX = 'Darwin',
FreeBSD = 'FreeBSD', HPUX = 'HP-UX', openSUSE_Leap = 'Suse', Neon = 'Debian' FreeBSD = 'FreeBSD', HPUX = 'HP-UX', openSUSE_Leap = 'Suse', Neon = 'Debian'
@ -834,6 +837,9 @@ class Distribution(object):
self.facts['distribution'] = 'Alpine' self.facts['distribution'] = 'Alpine'
self.facts['distribution_version'] = data self.facts['distribution_version'] = data
def get_distribution_SMGL(self):
self.facts['distribution'] = 'Source Mage GNU/Linux'
def get_distribution_SunOS(self): def get_distribution_SunOS(self):
data = get_file_content('/etc/release').splitlines()[0] data = get_file_content('/etc/release').splitlines()[0]
if 'Solaris' in data: if 'Solaris' in data:

View file

@ -683,6 +683,24 @@ DISTRIB_DESCRIPTION="CoreOS 976.0.0 (Coeur Rouge)"
} }
}, },
{
"platform.dist": [
"",
"",
""
],
"input": {
"/etc/sourcemage-release": "Source Mage GNU/Linux x86_64-pc-linux-gnu\nInstalled from tarball using chroot image (Grimoire 0.61-rc) on Thu May 17 17:31:37 UTC 2012\n"
},
"name": "SMGL NA",
"result": {
"distribution_release": "NA",
"distribution": "SMGL",
"distribution_major_version": "NA",
"os_family": "SMGL",
"distribution_version": "NA"
}
},
] ]