mirror of https://github.com/ansible/ansible.git
pull/72336/headb6b238afixed the SLES4SAP detection, which was at this time ok. Sadly Suse changed with SLES 15 the /etc/os-release file, so the above change will no longer work. This commit updates the SLES4SAP detection regarding https://www.suse.com/support/kb/doc/?id=000019341. The symlink realpath is matched with endswith, because in SLES 12+ the link target is SLES_SAP.prod, but in SLES 11 the link target is SUSE_SLES_SAP.prod. (cherry picked from commitea119d3089)
parent
30e735c4d8
commit
4a1555fb0a
@ -0,0 +1,2 @@
|
||||
bugfixes:
|
||||
- facts - fix distribution fact for SLES4SAP (https://github.com/ansible/ansible/pull/71559).
|
||||
@ -0,0 +1,33 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright: (c) 2020 Ansible Project
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
import pytest
|
||||
|
||||
from ansible.module_utils.facts.system.distribution import DistributionFiles
|
||||
|
||||
|
||||
@pytest.mark.parametrize('realpath', ('SUSE_SLES_SAP.prod', 'SLES_SAP.prod'))
|
||||
def test_distribution_sles4sap_suse_sles_sap(mock_module, mocker, realpath):
|
||||
mocker.patch('os.path.islink', return_value=True)
|
||||
mocker.patch('os.path.realpath', return_value='/etc/products.d/' + realpath)
|
||||
|
||||
test_input = {
|
||||
'name': 'SUSE',
|
||||
'path': '',
|
||||
'data': 'suse',
|
||||
'collected_facts': None,
|
||||
}
|
||||
|
||||
test_result = (
|
||||
True,
|
||||
{
|
||||
'distribution': 'SLES_SAP',
|
||||
}
|
||||
)
|
||||
|
||||
distribution = DistributionFiles(module=mock_module())
|
||||
assert test_result == distribution.parse_distribution_file_SUSE(**test_input)
|
||||
Loading…
Reference in New Issue