add detect Altlinux distributive

This commit is contained in:
Alexey Shabalin 2016-01-13 19:20:59 +03:00
parent 589971fe7e
commit 0b32e1586d

View file

@ -119,6 +119,7 @@ class Facts(object):
('/etc/gentoo-release', 'Gentoo'), ('/etc/gentoo-release', 'Gentoo'),
('/etc/os-release', 'Debian'), ('/etc/os-release', 'Debian'),
('/etc/lsb-release', 'Mandriva'), ('/etc/lsb-release', 'Mandriva'),
('/etc/altlinux-release', 'Altlinux'),
('/etc/os-release', 'NA'), ('/etc/os-release', 'NA'),
) )
SELINUX_MODE_DICT = { 1: 'enforcing', 0: 'permissive', -1: 'disabled' } SELINUX_MODE_DICT = { 1: 'enforcing', 0: 'permissive', -1: 'disabled' }
@ -270,7 +271,7 @@ class Facts(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', SuSE = 'Suse', SLES_SAP = 'Suse', Gentoo = 'Gentoo', Funtoo = 'Gentoo', SLED = 'Suse', openSUSE = 'Suse', SuSE = 'Suse', SLES_SAP = 'Suse', Gentoo = 'Gentoo', Funtoo = 'Gentoo',
Archlinux = 'Archlinux', Manjaro = 'Archlinux', Mandriva = 'Mandrake', Mandrake = 'Mandrake', Archlinux = 'Archlinux', Manjaro = 'Archlinux', Mandriva = 'Mandrake', Mandrake = 'Mandrake', Altlinux = 'Altlinux',
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' FreeBSD = 'FreeBSD', HPUX = 'HP-UX'
@ -323,7 +324,7 @@ class Facts(object):
for (path, name) in Facts.OSDIST_LIST: for (path, name) in Facts.OSDIST_LIST:
if os.path.exists(path): if os.path.exists(path):
if os.path.getsize(path) > 0: if os.path.getsize(path) > 0:
if self.facts['distribution'] in ('Fedora', ): if self.facts['distribution'] in ('Fedora', 'Altlinux', ):
# Once we determine the value is one of these distros # Once we determine the value is one of these distros
# we trust the values are always correct # we trust the values are always correct
break break
@ -356,6 +357,13 @@ class Facts(object):
else: else:
self.facts['distribution'] = data.split()[0] self.facts['distribution'] = data.split()[0]
break break
elif name == 'Altlinux':
data = get_file_content(path)
if 'ALT Linux' in data:
self.facts['distribution'] = name
else:
self.facts['distribution'] = data.split()[0]
break
elif name == 'OtherLinux': elif name == 'OtherLinux':
data = get_file_content(path) data = get_file_content(path)
if 'Amazon' in data: if 'Amazon' in data: