Fix support for Kali Linux detection (#69194)
* Fix support for Kali Linux detection * Add test for Kali Linux detection * Improve path matching with "in list" Co-Authored-By: Abhijeet Kasurde <akasurde@redhat.com> Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
parent
70219df905
commit
9d48884e36
2 changed files with 36 additions and 1 deletions
lib/ansible/module_utils/facts/system
test/units/module_utils
|
@ -320,7 +320,8 @@ class DistributionFiles:
|
|||
elif 'SteamOS' in data:
|
||||
debian_facts['distribution'] = 'SteamOS'
|
||||
# nothing else to do, SteamOS gets correct info from python functions
|
||||
elif path == '/etc/lsb-release' and 'Kali' in data:
|
||||
elif path in ('/etc/lsb-release', '/etc/os-release') and 'Kali' in data:
|
||||
# Kali does not provide /etc/lsb-release anymore
|
||||
debian_facts['distribution'] = 'Kali'
|
||||
release = re.search('DISTRIB_RELEASE=(.*)', data)
|
||||
if release:
|
||||
|
|
|
@ -990,6 +990,40 @@ TESTSETS = [
|
|||
'os_family': 'Debian'
|
||||
}
|
||||
},
|
||||
{
|
||||
'name': 'Kali 2020.2',
|
||||
'input': {
|
||||
'/etc/os-release': ("PRETTY_NAME=\"Kali GNU/Linux Rolling\"\nNAME=\"Kali GNU/Linux\"\nID=kali\nVERSION=\"2020.2\"\n"
|
||||
"VERSION_ID=\"2020.2\"\nVERSION_CODENAME=\"kali-rolling\"\nID_LIKE=debian\nANSI_COLOR=\"1;31\"\n"
|
||||
"HOME_URL=\"https://www.kali.org/\"\nSUPPORT_URL=\"https://forums.kali.org/\"\n"
|
||||
"BUG_REPORT_URL=\"https://bugs.kali.org/\""),
|
||||
'/usr/lib/os-release': ("PRETTY_NAME=\"Kali GNU/Linux Rolling\"\nNAME=\"Kali GNU/Linux\"\nID=kali\nVERSION=\"2020.2\"\n"
|
||||
"VERSION_ID=\"2020.2\"\nVERSION_CODENAME=\"kali-rolling\"\nID_LIKE=debian\nANSI_COLOR=\"1;31\"\n"
|
||||
"HOME_URL=\"https://www.kali.org/\"\nSUPPORT_URL=\"https://forums.kali.org/\"\n"
|
||||
"BUG_REPORT_URL=\"https://bugs.kali.org/\"")
|
||||
},
|
||||
'platform.dist': [
|
||||
'kali',
|
||||
'2020.2',
|
||||
''
|
||||
],
|
||||
'distro': {
|
||||
'codename': 'kali-rolling',
|
||||
'id': 'kali',
|
||||
'name': 'Kali GNU/Linux Rolling',
|
||||
'version': '2020.2',
|
||||
'version_best': '2020.2',
|
||||
'os_release_info': {},
|
||||
'lsb_release_info': {},
|
||||
},
|
||||
'result': {
|
||||
'distribution': 'Kali',
|
||||
'distribution_version': '2020.2',
|
||||
'distribution_release': 'kali-rolling',
|
||||
'distribution_major_version': '2020',
|
||||
'os_family': 'Debian'
|
||||
}
|
||||
},
|
||||
{
|
||||
"platform.dist": [
|
||||
"neon",
|
||||
|
|
Loading…
Add table
Reference in a new issue