mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Using "OtherLinux" in module_commons, cleander detection in setup.
This commit is contained in:
parent
5646bc278b
commit
7129a9e355
2 changed files with 23 additions and 22 deletions
|
@ -99,7 +99,7 @@ def get_distribution():
|
||||||
distribution = platform.linux_distribution()[0].capitalize()
|
distribution = platform.linux_distribution()[0].capitalize()
|
||||||
if distribution == 'NA':
|
if distribution == 'NA':
|
||||||
if os.path.is_file('/etc/system-release'):
|
if os.path.is_file('/etc/system-release'):
|
||||||
distribution = 'Amazon'
|
distribution = 'OtherLinux'
|
||||||
except:
|
except:
|
||||||
# FIXME: MethodMissing, I assume?
|
# FIXME: MethodMissing, I assume?
|
||||||
distribution = platform.dist()[0].capitalize()
|
distribution = platform.dist()[0].capitalize()
|
||||||
|
|
|
@ -77,7 +77,7 @@ class Facts(object):
|
||||||
# This is the fallback to handle unknowns or exceptions
|
# This is the fallback to handle unknowns or exceptions
|
||||||
OSDIST_DICT = { '/etc/redhat-release': 'RedHat',
|
OSDIST_DICT = { '/etc/redhat-release': 'RedHat',
|
||||||
'/etc/vmware-release': 'VMwareESX',
|
'/etc/vmware-release': 'VMwareESX',
|
||||||
'/etc/system-release': 'Amazon' }
|
'/etc/system-release': 'OtherLinux' }
|
||||||
SELINUX_MODE_DICT = { 1: 'enforcing', 0: 'permissive', -1: 'disabled' }
|
SELINUX_MODE_DICT = { 1: 'enforcing', 0: 'permissive', -1: 'disabled' }
|
||||||
|
|
||||||
# A list of dicts. If there is a platform with more than one
|
# A list of dicts. If there is a platform with more than one
|
||||||
|
@ -133,9 +133,10 @@ class Facts(object):
|
||||||
if os.path.exists(path):
|
if os.path.exists(path):
|
||||||
if self.facts['distribution'] == 'Fedora':
|
if self.facts['distribution'] == 'Fedora':
|
||||||
pass
|
pass
|
||||||
elif name == 'Amazon':
|
elif name == 'OtherLinux':
|
||||||
self.facts['distribution'] = 'Amazon'
|
|
||||||
data = get_file_content(path)
|
data = get_file_content(path)
|
||||||
|
if 'Amazon' in data:
|
||||||
|
self.facts['distribution'] = 'Amazon'
|
||||||
self.facts['distribution_version'] = data.split()[-1]
|
self.facts['distribution_version'] = data.split()[-1]
|
||||||
elif name == 'RedHat':
|
elif name == 'RedHat':
|
||||||
data = get_file_content(path)
|
data = get_file_content(path)
|
||||||
|
|
Loading…
Reference in a new issue