diff options
Diffstat (limited to '')
81 files changed, 2588 insertions, 0 deletions
diff --git a/test/units/module_utils/facts/system/distribution/__init__.py b/test/units/module_utils/facts/system/distribution/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/__init__.py diff --git a/test/units/module_utils/facts/system/distribution/conftest.py b/test/units/module_utils/facts/system/distribution/conftest.py new file mode 100644 index 0000000..d27b97f --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/conftest.py @@ -0,0 +1,21 @@ +# -*- 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 units.compat.mock import Mock + + +@pytest.fixture +def mock_module(): + mock_module = Mock() + mock_module.params = {'gather_subset': ['all'], + 'gather_timeout': 5, + 'filter': '*'} + mock_module.get_bin_path = Mock(return_value=None) + return mock_module diff --git a/test/units/module_utils/facts/system/distribution/fixtures/almalinux_8_3_beta.json b/test/units/module_utils/facts/system/distribution/fixtures/almalinux_8_3_beta.json new file mode 100644 index 0000000..2d8df50 --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/almalinux_8_3_beta.json @@ -0,0 +1,53 @@ +{ + "name": "AlmaLinux 8.3", + "distro": { + "codename": "Purple Manul", + "id": "almalinux", + "name": "AlmaLinux", + "version": "8.3", + "version_best": "8.3", + "lsb_release_info": { + "lsb_version": ":core-4.1-amd64:core-4.1-noarch", + "distributor_id": "AlmaLinux", + "description": "AlmaLinux release 8.3 Beta (Purple Manul)", + "release": "8.3", + "codename": "PurpleManul" + }, + "os_release_info": { + "name": "AlmaLinux", + "version": "8.3 (Purple Manul)", + "id": "almalinux", + "id_like": "rhel centos fedora", + "version_id": "8.3", + "platform_id": "platform:el8", + "pretty_name": "AlmaLinux 8.3 Beta (Purple Manul)", + "ansi_color": "0;34", + "cpe_name": "cpe:/o:almalinux:almalinux:8.3:beta", + "home_url": "https://almalinux.org/", + "bug_report_url": "https://bugs.almalinux.org/", + "almalinux_mantisbt_project": "AlmaLinux-8", + "almalinux_mantisbt_project_version": "8", + "codename": "Purple Manul" + } + }, + "input": { + "/etc/centos-release": "AlmaLinux release 8.3 Beta (Purple Manul)\n", + "/etc/redhat-release": "AlmaLinux release 8.3 Beta (Purple Manul)\n", + "/etc/system-release": "AlmaLinux release 8.3 Beta (Purple Manul)\n", + "/etc/os-release": "NAME=\"AlmaLinux\"\nVERSION=\"8.3 (Purple Manul)\"\nID=\"almalinux\"\nID_LIKE=\"rhel centos fedora\"\nVERSION_ID=\"8.3\"\nPLATFORM_ID=\"platform:el8\"\nPRETTY_NAME=\"AlmaLinux 8.3 Beta (Purple Manul)\"\nANSI_COLOR=\"0;34\"\nCPE_NAME=\"cpe:/o:almalinux:almalinux:8.3:beta\"\nHOME_URL=\"https://almalinux.org/\"\nBUG_REPORT_URL=\"https://bugs.almalinux.org/\"\n\nALMALINUX_MANTISBT_PROJECT=\"AlmaLinux-8\" \nALMALINUX_MANTISBT_PROJECT_VERSION=\"8\" \n\n", + "/usr/lib/os-release": "NAME=\"AlmaLinux\"\nVERSION=\"8.3 (Purple Manul)\"\nID=\"almalinux\"\nID_LIKE=\"rhel centos fedora\"\nVERSION_ID=\"8.3\"\nPLATFORM_ID=\"platform:el8\"\nPRETTY_NAME=\"AlmaLinux 8.3 Beta (Purple Manul)\"\nANSI_COLOR=\"0;34\"\nCPE_NAME=\"cpe:/o:almalinux:almalinux:8.3:beta\"\nHOME_URL=\"https://almalinux.org/\"\nBUG_REPORT_URL=\"https://bugs.almalinux.org/\"\n\nALMALINUX_MANTISBT_PROJECT=\"AlmaLinux-8\" \nALMALINUX_MANTISBT_PROJECT_VERSION=\"8\" \n\n" + }, + "platform.dist": [ + "almalinux", + "8.3", + "Purple Manul" + ], + "result": { + "distribution": "AlmaLinux", + "distribution_version": "8.3", + "distribution_release": "Purple Manul", + "distribution_major_version": "8", + "os_family": "RedHat" + }, + "platform.release": "4.18.0-240.el8.x86_64" +} diff --git a/test/units/module_utils/facts/system/distribution/fixtures/amazon_linux_2.json b/test/units/module_utils/facts/system/distribution/fixtures/amazon_linux_2.json new file mode 100644 index 0000000..d98070e --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/amazon_linux_2.json @@ -0,0 +1,39 @@ +{ + "platform.dist": [ + "amzn", + "2", + "" + ], + "input": { + "/etc/os-release": "NAME=\"Amazon Linux\"\nVERSION=\"2\"\nID=\"amzn\"\nID_LIKE=\"centos rhel fedora\"\nVERSION_ID=\"2\"\nPRETTY_NAME=\"Amazon Linux 2\"\nANSI_COLOR=\"0;33\"\nCPE_NAME=\"cpe:2.3:o:amazon:amazon_linux:2\"\nHOME_URL=\"https://amazonlinux.com/\"\n", + "/etc/system-release": "Amazon Linux release 2 (Karoo)\n" + }, + "name": "Amazon 2", + "result": { + "distribution_release": "NA", + "distribution": "Amazon", + "distribution_major_version": "2", + "os_family": "RedHat", + "distribution_version": "2" + }, + "distro": { + "id": "amzn", + "name": "Amazon Linux", + "version": "2", + "codename": "", + "version_best": "2", + "lsb_release_info": {}, + "os_release_info": { + "ansi_color": "0;33", + "id_like": "centos rhel fedora", + "version_id": "2", + "pretty_name": "Amazon Linux 2", + "name": "Amazon Linux", + "version": "2", + "home_url": "https://amazonlinux.com/", + "id": "amzn", + "cpe_name": "cpe:2.3:o:amazon:amazon_linux:2" + } + }, + "platform.release": "4.14.181-142.260.amzn2.x86_64" +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/amazon_linux_2016.03.json b/test/units/module_utils/facts/system/distribution/fixtures/amazon_linux_2016.03.json new file mode 100644 index 0000000..38449e4 --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/amazon_linux_2016.03.json @@ -0,0 +1,40 @@ +{ + "name": "Amazon 2016.03", + "platform.release": "4.14.94-73.73.amzn1.x86_64", + "result": { + "distribution_release": "NA", + "distribution": "Amazon", + "distribution_major_version": "2016", + "distribution_minor_version": "03", + "os_family": "RedHat", + "distribution_version": "2016.03" + }, + "platform.dist": [ + "amzn", + "2016.03", + "" + ], + "input": { + "/etc/os-release": "NAME=\"Amazon Linux AMI\"\nVERSION=\"2016.03\"\nID=\"amzn\"\nID_LIKE=\"rhel fedora\"\nVERSION_ID=\"2016.03\"\nPRETTY_NAME=\"Amazon Linux AMI 2016.03\"\nANSI_COLOR=\"0;33\"\nCPE_NAME=\"cpe:/o:amazon:linux:2016.03:ga\"\nHOME_URL=\"http://aws.amazon.com/amazon-linux-ami/\"\n", + "/etc/system-release": "Amazon Linux AMI release 2016.03\n" + }, + "distro": { + "version_best": "2016.03", + "os_release_info": { + "name": "Amazon Linux AMI", + "ansi_color": "0;33", + "id_like": "rhel fedora", + "version_id": "2016.03", + "pretty_name": "Amazon Linux AMI 2016.03", + "version": "2016.03", + "home_url": "http://aws.amazon.com/amazon-linux-ami/", + "cpe_name": "cpe:/o:amazon:linux:2016.03:ga", + "id": "amzn" + }, + "version": "2016.03", + "codename": "", + "lsb_release_info": {}, + "id": "amzn", + "name": "Amazon Linux AMI" + } +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/amazon_linux_2018.03.json b/test/units/module_utils/facts/system/distribution/fixtures/amazon_linux_2018.03.json new file mode 100644 index 0000000..2461e72 --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/amazon_linux_2018.03.json @@ -0,0 +1,40 @@ +{ + "name": "Amazon 2018.03", + "platform.release": "4.14.94-73.73.amzn1.x86_64", + "result": { + "distribution_release": "NA", + "distribution": "Amazon", + "distribution_major_version": "2018", + "distribution_minor_version": "03", + "os_family": "RedHat", + "distribution_version": "2018.03" + }, + "platform.dist": [ + "amzn", + "2018.03", + "" + ], + "input": { + "/etc/os-release": "NAME=\"Amazon Linux AMI\"\nVERSION=\"2018.03\"\nID=\"amzn\"\nID_LIKE=\"rhel fedora\"\nVERSION_ID=\"2018.03\"\nPRETTY_NAME=\"Amazon Linux AMI 2018.03\"\nANSI_COLOR=\"0;33\"\nCPE_NAME=\"cpe:/o:amazon:linux:2018.03:ga\"\nHOME_URL=\"http://aws.amazon.com/amazon-linux-ami/\"\n", + "/etc/system-release": "Amazon Linux AMI release 2018.03\n" + }, + "distro": { + "version_best": "2018.03", + "os_release_info": { + "name": "Amazon Linux AMI", + "ansi_color": "0;33", + "id_like": "rhel fedora", + "version_id": "2018.03", + "pretty_name": "Amazon Linux AMI 2018.03", + "version": "2018.03", + "home_url": "http://aws.amazon.com/amazon-linux-ami/", + "cpe_name": "cpe:/o:amazon:linux:2018.03:ga", + "id": "amzn" + }, + "version": "2018.03", + "codename": "", + "lsb_release_info": {}, + "id": "amzn", + "name": "Amazon Linux AMI" + } +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/amazon_linux_2_karoo.json b/test/units/module_utils/facts/system/distribution/fixtures/amazon_linux_2_karoo.json new file mode 100644 index 0000000..e430ff6 --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/amazon_linux_2_karoo.json @@ -0,0 +1,34 @@ +{ + "platform.dist": [ + "", + "", + "" + ], + "input": { + "/etc/system-release": "Amazon Linux release 2 (Karoo)", + "/etc/os-release": "" + }, + "name": "Amazon Linux 2 - Karoo", + "result": { + "distribution_release": "NA", + "distribution": "Amazon", + "distribution_major_version": "2", + "os_family": "RedHat", + "distribution_version": "2" + }, + "distro": { + "id": "amzn", + "version": "2", + "codename": "", + "os_release_info": { + "name": "Amazon Linux AMI", + "ansi_color": "0;33", + "id_like": "rhel fedora", + "version_id": "2", + "pretty_name": "Amazon Linux release 2 (Karoo)", + "version": "2", + "home_url": "https://amazonlinux.com/", + "id": "amzn" + } + } +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/amazon_linux_release_2.json b/test/units/module_utils/facts/system/distribution/fixtures/amazon_linux_release_2.json new file mode 100644 index 0000000..9fa6090 --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/amazon_linux_release_2.json @@ -0,0 +1,34 @@ +{ + "platform.dist": [ + "", + "", + "" + ], + "input": { + "/etc/system-release": "Amazon Linux release 2", + "/etc/os-release": "" + }, + "name": "Amazon Linux 2", + "result": { + "distribution_release": "NA", + "distribution": "Amazon", + "distribution_major_version": "2", + "os_family": "RedHat", + "distribution_version": "2" + }, + "distro": { + "id": "amzn", + "version": "2", + "codename": "", + "os_release_info": { + "name": "Amazon Linux AMI", + "ansi_color": "0;33", + "id_like": "rhel fedora", + "version_id": "2", + "pretty_name": "Amazon Linux release 2", + "version": "2", + "home_url": "", + "id": "amzn" + } + } +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/arch_linux_na.json b/test/units/module_utils/facts/system/distribution/fixtures/arch_linux_na.json new file mode 100644 index 0000000..88d9ad8 --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/arch_linux_na.json @@ -0,0 +1,24 @@ +{ + "platform.dist": ["", "", ""], + "distro": { + "codename": "", + "id": "arch", + "name": "Arch Linux", + "version": "", + "version_best": "", + "os_release_info": {}, + "lsb_release_info": {} + }, + "input": { + "/etc/os-release": "NAME=\"Arch Linux\"\nPRETTY_NAME=\"Arch Linux\"\nID=arch\nID_LIKE=archlinux\nANSI_COLOR=\"0;36\"\nHOME_URL=\"https://www.archlinux.org/\"\nSUPPORT_URL=\"https://bbs.archlinux.org/\"\nBUG_REPORT_URL=\"https://bugs.archlinux.org/\"\n\n", + "/etc/arch-release": "" + }, + "name": "Arch Linux NA", + "result": { + "distribution_release": "NA", + "distribution": "Archlinux", + "distribution_major_version": "NA", + "os_family": "Archlinux", + "distribution_version": "NA" + } +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/arch_linux_no_arch-release_na.json b/test/units/module_utils/facts/system/distribution/fixtures/arch_linux_no_arch-release_na.json new file mode 100644 index 0000000..a24bb3a --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/arch_linux_no_arch-release_na.json @@ -0,0 +1,23 @@ +{ + "platform.dist": ["", "", ""], + "distro": { + "codename": "", + "id": "arch", + "name": "Arch Linux", + "version": "", + "version_best": "", + "os_release_info": {}, + "lsb_release_info": {} + }, + "input": { + "/etc/os-release": "NAME=\"Arch Linux\"\nPRETTY_NAME=\"Arch Linux\"\nID=arch\nID_LIKE=archlinux\nANSI_COLOR=\"0;36\"\nHOME_URL=\"https://www.archlinux.org/\"\nSUPPORT_URL=\"https://bbs.archlinux.org/\"\nBUG_REPORT_URL=\"https://bugs.archlinux.org/\"\n\n" + }, + "name": "Arch Linux no arch-release NA", + "result": { + "distribution_release": "NA", + "distribution": "Archlinux", + "distribution_major_version": "NA", + "os_family": "Archlinux", + "distribution_version": "NA" + } +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/archlinux_rolling.json b/test/units/module_utils/facts/system/distribution/fixtures/archlinux_rolling.json new file mode 100644 index 0000000..8f35636 --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/archlinux_rolling.json @@ -0,0 +1,31 @@ +{ + "name": "Archlinux rolling", + "distro": { + "codename": "n/a", + "id": "arch", + "name": "Arch", + "version": "rolling", + "version_best": "rolling", + "lsb_release_info": { + "lsb_version": "1.4", + "distributor_id": "Arch", + "description": "Arch Linux", + "release": "rolling", + "codename": "n/a" + }, + "os_release_info": {} + }, + "input": { + "/etc/arch-release": "Arch Linux release\n", + "/etc/lsb-release": "LSB_VERSION=1.4\nDISTRIB_ID=Arch\nDISTRIB_RELEASE=rolling\nDISTRIB_DESCRIPTION=\"Arch Linux\"\n", + "/usr/lib/os-release": "NAME=\"Arch Linux\"\nPRETTY_NAME=\"Arch Linux\"\nID=arch\nBUILD_ID=rolling\nANSI_COLOR=\"0;36\"\nHOME_URL=\"https://www.archlinux.org/\"\nDOCUMENTATION_URL=\"https://wiki.archlinux.org/\"\nSUPPORT_URL=\"https://bbs.archlinux.org/\"\nBUG_REPORT_URL=\"https://bugs.archlinux.org/\"\nLOGO=archlinux\n" + }, + "platform.dist": ["arch", "rolling", "n/a"], + "result": { + "distribution": "Archlinux", + "distribution_version": "rolling", + "distribution_release": "n/a", + "distribution_major_version": "rolling", + "os_family": "Archlinux" + } +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/centos_6.7.json b/test/units/module_utils/facts/system/distribution/fixtures/centos_6.7.json new file mode 100644 index 0000000..c99a073 --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/centos_6.7.json @@ -0,0 +1,31 @@ +{ + "name": "CentOS 6.7", + "platform.dist": ["centos", "6.7", "Final"], + "distro": { + "codename": "Final", + "id": "centos", + "name": "CentOS Linux", + "version": "6.7", + "version_best": "6.7", + "os_release_info": {}, + "lsb_release_info": { + "release": "6.7", + "codename": "Final", + "distributor_id": "CentOS", + "lsb_version": ":base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch", + "description": "CentOS release 6.7 (Final)" + } + }, + "input": { + "/etc/redhat-release": "CentOS release 6.7 (Final)\n", + "/etc/lsb-release": "LSB_VERSION=base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch\n", + "/etc/system-release": "CentOS release 6.7 (Final)\n" + }, + "result": { + "distribution_release": "Final", + "distribution": "CentOS", + "distribution_major_version": "6", + "os_family": "RedHat", + "distribution_version": "6.7" + } +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/centos_8_1.json b/test/units/module_utils/facts/system/distribution/fixtures/centos_8_1.json new file mode 100644 index 0000000..338959b --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/centos_8_1.json @@ -0,0 +1,54 @@ +{ + "name": "CentOS 8.1", + "distro": { + "codename": "Core", + "id": "centos", + "name": "CentOS Linux", + "version": "8", + "version_best": "8.1.1911", + "lsb_release_info": { + "lsb_version": ":core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch", + "distributor_id": "CentOS", + "description": "CentOS Linux release 8.1.1911 (Core)", + "release": "8.1.1911", + "codename": "Core" + }, + "os_release_info": { + "name": "CentOS Linux", + "version": "8 (Core)", + "id": "centos", + "id_like": "rhel fedora", + "version_id": "8", + "platform_id": "platform:el8", + "pretty_name": "CentOS Linux 8 (Core)", + "ansi_color": "0;31", + "cpe_name": "cpe:/o:centos:centos:8", + "home_url": "https://www.centos.org/", + "bug_report_url": "https://bugs.centos.org/", + "centos_mantisbt_project": "CentOS-8", + "centos_mantisbt_project_version": "8", + "redhat_support_product": "centos", + "redhat_support_product_version": "8", + "codename": "Core" + } + }, + "input": { + "/etc/centos-release": "CentOS Linux release 8.1.1911 (Core) \n", + "/etc/redhat-release": "CentOS Linux release 8.1.1911 (Core) \n", + "/etc/system-release": "CentOS Linux release 8.1.1911 (Core) \n", + "/etc/os-release": "NAME=\"CentOS Linux\"\nVERSION=\"8 (Core)\"\nID=\"centos\"\nID_LIKE=\"rhel fedora\"\nVERSION_ID=\"8\"\nPLATFORM_ID=\"platform:el8\"\nPRETTY_NAME=\"CentOS Linux 8 (Core)\"\nANSI_COLOR=\"0;31\"\nCPE_NAME=\"cpe:/o:centos:centos:8\"\nHOME_URL=\"https://www.centos.org/\"\nBUG_REPORT_URL=\"https://bugs.centos.org/\"\n\nCENTOS_MANTISBT_PROJECT=\"CentOS-8\"\nCENTOS_MANTISBT_PROJECT_VERSION=\"8\"\nREDHAT_SUPPORT_PRODUCT=\"centos\"\nREDHAT_SUPPORT_PRODUCT_VERSION=\"8\"\n\n" + }, + "platform.dist": [ + "centos", + "8", + "Core" + ], + "result": { + "distribution": "CentOS", + "distribution_version": "8.1", + "distribution_release": "Core", + "distribution_major_version": "8", + "os_family": "RedHat" + }, + "platform.release": "4.18.0-147.el8.x86_64" +} diff --git a/test/units/module_utils/facts/system/distribution/fixtures/centos_stream_8.json b/test/units/module_utils/facts/system/distribution/fixtures/centos_stream_8.json new file mode 100644 index 0000000..1e4166b --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/centos_stream_8.json @@ -0,0 +1,46 @@ +{ + "name": "CentOS 8", + "distro": { + "codename": "", + "id": "centos", + "name": "CentOS Stream", + "version": "8", + "version_best": "8", + "lsb_release_info": {}, + "os_release_info": { + "name": "CentOS Stream", + "version": "8", + "id": "centos", + "id_like": "rhel fedora", + "version_id": "8", + "platform_id": "platform:el8", + "pretty_name": "CentOS Stream 8", + "ansi_color": "0;31", + "cpe_name": "cpe:/o:centos:centos:8", + "home_url": "https://centos.org/", + "bug_report_url": "https://bugzilla.redhat.com/", + "redhat_support_product": "Red Hat Enterprise Linux 8", + "redhat_support_product_version": "CentOS Stream" + } + }, + "input": { + "/etc/centos-release": "CentOS Stream release 8\n", + "/etc/redhat-release": "CentOS Stream release 8\n", + "/etc/system-release": "CentOS Stream release 8\n", + "/etc/os-release": "NAME=\"CentOS Stream\"\nVERSION=\"8\"\nID=\"centos\"\nID_LIKE=\"rhel fedora\"\nVERSION_ID=\"8\"\nPLATFORM_ID=\"platform:el8\"\nPRETTY_NAME=\"CentOS Stream 8\"\nANSI_COLOR=\"0;31\"\nCPE_NAME=\"cpe:/o:centos:centos:8\"\nHOME_URL=\"https://centos.org/\"\nBUG_REPORT_URL=\"https://bugzilla.redhat.com/\"\nREDHAT_SUPPORT_PRODUCT=\"Red Hat Enterprise Linux 8\"\nREDHAT_SUPPORT_PRODUCT_VERSION=\"CentOS Stream\"\n", + "/usr/lib/os-release": "NAME=\"CentOS Stream\"\nVERSION=\"8\"\nID=\"centos\"\nID_LIKE=\"rhel fedora\"\nVERSION_ID=\"8\"\nPLATFORM_ID=\"platform:el8\"\nPRETTY_NAME=\"CentOS Stream 8\"\nANSI_COLOR=\"0;31\"\nCPE_NAME=\"cpe:/o:centos:centos:8\"\nHOME_URL=\"https://centos.org/\"\nBUG_REPORT_URL=\"https://bugzilla.redhat.com/\"\nREDHAT_SUPPORT_PRODUCT=\"Red Hat Enterprise Linux 8\"\nREDHAT_SUPPORT_PRODUCT_VERSION=\"CentOS Stream\"\n" + }, + "platform.dist": [ + "centos", + "8", + "" + ], + "result": { + "distribution": "CentOS", + "distribution_version": "8", + "distribution_release": "Stream", + "distribution_major_version": "8", + "os_family": "RedHat" + }, + "platform.release": "4.18.0-257.el8.x86_64" +} diff --git a/test/units/module_utils/facts/system/distribution/fixtures/clearlinux_26580.json b/test/units/module_utils/facts/system/distribution/fixtures/clearlinux_26580.json new file mode 100644 index 0000000..1a99a86 --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/clearlinux_26580.json @@ -0,0 +1,24 @@ +{ + "platform.dist": ["Clear Linux OS", "26580", "clear-linux-os"], + "distro": { + "codename": "", + "id": "clear-linux-os", + "name": "Clear Linux OS", + "version": "26580", + "version_best": "26580", + "os_release_info": {}, + "lsb_release_info": {} + }, + "input": { + "/etc/os-release": "NAME=\"Clear Linux OS\"\nVERSION=1\nID=clear-linux-os\nID_LIKE=clear-linux-os\nVERSION_ID=26580\nPRETTY_NAME=\"Clear Linux OS\"\nANSI_COLOR=\"1;35\"\nHOME_URL=\"https://clearlinux.org\"\nSUPPORT_URL=\"https://clearlinux.org\"\nBUG_REPORT_URL=\"mailto:dev@lists.clearlinux.org\"\nPRIVACY_POLICY_URL=\"http://www.intel.com/privacy\"", + "/usr/lib/os-release": "NAME=\"Clear Linux OS\"\nVERSION=1\nID=clear-linux-os\nID_LIKE=clear-linux-os\nVERSION_ID=26580\nPRETTY_NAME=\"Clear Linux OS\"\nANSI_COLOR=\"1;35\"\nHOME_URL=\"https://clearlinux.org\"\nSUPPORT_URL=\"https://clearlinux.org\"\nBUG_REPORT_URL=\"mailto:dev@lists.clearlinux.org\"\nPRIVACY_POLICY_URL=\"http://www.intel.com/privacy\"" + }, + "name": "ClearLinux 26580", + "result": { + "distribution_release": "clear-linux-os", + "distribution": "Clear Linux OS", + "distribution_major_version": "26580", + "os_family": "ClearLinux", + "distribution_version": "26580" + } +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/clearlinux_28120.json b/test/units/module_utils/facts/system/distribution/fixtures/clearlinux_28120.json new file mode 100644 index 0000000..30b7668 --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/clearlinux_28120.json @@ -0,0 +1,24 @@ +{ + "platform.dist": ["Clear Linux OS", "28120", "clear-linux-os"], + "distro": { + "codename": "", + "id": "clear-linux-os", + "name": "Clear Linux OS", + "version": "28120", + "version_best": "28120", + "os_release_info": {}, + "lsb_release_info": {} + }, + "input": { + "/etc/os-release": "NAME=\"Clear Linux OS\"\nVERSION=1\nID=clear-linux-os\nID_LIKE=clear-linux-os\nVERSION_ID=28120\nPRETTY_NAME=\"Clear Linux OS\"\nANSI_COLOR=\"1;35\"\nHOME_URL=\"https://clearlinux.org\"\nSUPPORT_URL=\"https://clearlinux.org\"\nBUG_REPORT_URL=\"mailto:dev@lists.clearlinux.org\"\nPRIVACY_POLICY_URL=\"http://www.intel.com/privacy\"", + "/usr/lib/os-release": "NAME=\"Clear Linux OS\"\nVERSION=1\nID=clear-linux-os\nID_LIKE=clear-linux-os\nVERSION_ID=28120\nPRETTY_NAME=\"Clear Linux OS\"\nANSI_COLOR=\"1;35\"\nHOME_URL=\"https://clearlinux.org\"\nSUPPORT_URL=\"https://clearlinux.org\"\nBUG_REPORT_URL=\"mailto:dev@lists.clearlinux.org\"\nPRIVACY_POLICY_URL=\"http://www.intel.com/privacy\"" + }, + "name": "ClearLinux 28120", + "result": { + "distribution_release": "clear-linux-os", + "distribution": "Clear Linux OS", + "distribution_major_version": "28120", + "os_family": "ClearLinux", + "distribution_version": "28120" + } +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/core_os_1911.5.0.json b/test/units/module_utils/facts/system/distribution/fixtures/core_os_1911.5.0.json new file mode 100644 index 0000000..af43704 --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/core_os_1911.5.0.json @@ -0,0 +1,23 @@ +{ + "name": "Core OS", + "input": { + "/usr/lib/os-release": "NAME=\"Container Linux by CoreOS\"\nID=coreos\nVERSION=1911.5.0\nVERSION_ID=1911.5.0\nBUILD_ID=2018-12-15-2317\nPRETTY_NAME=\"Container Linux by CoreOS 1911.5.0 (Rhyolite)\"\nANSI_COLOR=\"38;5;75\"\nHOME_URL=\"https://coreos.com/\"\nBUG_REPORT_URL=\"https://issues.coreos.com\"\nCOREOS_BOARD=\"amd64-usr\"", + "/etc/lsb-release": "DISTRIB_ID=CoreOS\nDISTRIB_RELEASE=1911.5.0\nDISTRIB_CODENAME=\"Rhyolite\"\nDISTRIB_DESCRIPTION=\"CoreOS 1911.5.0 (Rhyolite)\"" + }, + "platform.dist": ["", "", ""], + "distro": { + "codename": "Rhyolite", + "id": "coreos", + "name": "CoreOS", + "version": "1911.5.0", + "version_best": "1911.5.0", + "os_release_info": {}, + "lsb_release_info": {} + }, + "platform.release": "", + "result": { + "distribution": "Coreos", + "distribution_major_version": "1911", + "distribution_version": "1911.5.0" + } +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/core_os_976.0.0.json b/test/units/module_utils/facts/system/distribution/fixtures/core_os_976.0.0.json new file mode 100644 index 0000000..ccd06d9 --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/core_os_976.0.0.json @@ -0,0 +1,23 @@ +{ + "name": "Core OS", + "input": { + "/etc/os-release": "NAME=CoreOS\nID=coreos\nVERSION=976.0.0\nVERSION_ID=976.0.0\nBUILD_ID=2016-03-03-2324\nPRETTY_NAME=\"CoreOS 976.0.0 (Coeur Rouge)\"\nANSI_COLOR=\"1;32\"\nHOME_URL=\"https://coreos.com/\"\nBUG_REPORT_URL=\"https://github.com/coreos/bugs/issues\"", + "/etc/lsb-release": "DISTRIB_ID=CoreOS\nDISTRIB_RELEASE=976.0.0\nDISTRIB_CODENAME=\"Coeur Rouge\"\nDISTRIB_DESCRIPTION=\"CoreOS 976.0.0 (Coeur Rouge)\"" + }, + "platform.dist": ["", "", ""], + "distro": { + "codename": "Coeur Rouge", + "id": "coreos", + "name": "CoreOS", + "version": "976.0.0", + "version_best": "976.0.0", + "os_release_info": {}, + "lsb_release_info": {} + }, + "platform.release": "", + "result": { + "distribution": "CoreOS", + "distribution_major_version": "976", + "distribution_version": "976.0.0" + } +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/cumulus_linux_2.5.4.json b/test/units/module_utils/facts/system/distribution/fixtures/cumulus_linux_2.5.4.json new file mode 100644 index 0000000..ad9c3f7 --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/cumulus_linux_2.5.4.json @@ -0,0 +1,23 @@ +{ + "name": "Cumulus Linux 2.5.4", + "input": { + "/etc/os-release": "NAME=\"Cumulus Linux\"\nVERSION_ID=2.5.4\nVERSION=\"2.5.4-6dc6e80-201510091936-build\"\nPRETTY_NAME=\"Cumulus Linux\"\nID=cumulus-linux\nID_LIKE=debian\nCPE_NAME=cpe:/o:cumulusnetworks:cumulus_linux:2.5.4-6dc6e80-201510091936-build\nHOME_URL=\"http://www.cumulusnetworks.com/\"\nSUPPORT_URL=\"http://support.cumulusnetworks.com/\"" + }, + "platform.dist": ["", "", ""], + "distro": { + "codename": "", + "id": "cumulus-linux", + "name": "Cumulus Linux", + "version": "2.5.4", + "version_best": "2.5.4", + "os_release_info": {}, + "lsb_release_info": {} + }, + "result": { + "distribution": "Cumulus Linux", + "distribution_major_version": "2", + "distribution_release": "2.5.4-6dc6e80-201510091936-build", + "os_family": "Debian", + "distribution_version": "2.5.4" + } +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/cumulus_linux_3.7.3.json b/test/units/module_utils/facts/system/distribution/fixtures/cumulus_linux_3.7.3.json new file mode 100644 index 0000000..ec44af1 --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/cumulus_linux_3.7.3.json @@ -0,0 +1,23 @@ +{ + "name": "Cumulus Linux 3.7.3", + "input": { + "/etc/os-release": "NAME=\"Cumulus Linux\"\nVERSION_ID=3.7.3\nVERSION=\"Cumulus Linux 3.7.3\"\nPRETTY_NAME=\"Cumulus Linux\"\nID=cumulus-linux\nID_LIKE=debian\nCPE_NAME=cpe:/o:cumulusnetworks:cumulus_linux:3.7.3\nHOME_URL=\"http://www.cumulusnetworks.com/\"\nSUPPORT_URL=\"http://support.cumulusnetworks.com/\"" + }, + "platform.dist": ["debian", "8.11", ""], + "distro": { + "codename": "", + "id": "cumulus-linux", + "name": "Cumulus Linux", + "version": "3.7.3", + "version_best": "3.7.3", + "os_release_info": {}, + "lsb_release_info": {} + }, + "result": { + "distribution": "Cumulus Linux", + "distribution_major_version": "3", + "distribution_release": "Cumulus Linux 3.7.3", + "os_family": "Debian", + "distribution_version": "3.7.3" + } +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/debian_10.json b/test/units/module_utils/facts/system/distribution/fixtures/debian_10.json new file mode 100644 index 0000000..5ac3f45 --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/debian_10.json @@ -0,0 +1,42 @@ +{ + "name": "Debian 10", + "distro": { + "codename": "buster", + "id": "debian", + "name": "Debian GNU/Linux", + "version": "10", + "version_best": "10", + "lsb_release_info": { + "distributor_id": "Debian", + "description": "Debian GNU/Linux 10 (buster)", + "release": "10", + "codename": "buster" + }, + "os_release_info": { + "pretty_name": "Debian GNU/Linux 10 (buster)", + "name": "Debian GNU/Linux", + "version_id": "10", + "version": "10 (buster)", + "version_codename": "buster", + "id": "debian", + "home_url": "https://www.debian.org/", + "support_url": "https://www.debian.org/support", + "bug_report_url": "https://bugs.debian.org/", + "codename": "buster" + } + }, + "input": { + "/etc/os-release": "PRETTY_NAME=\"Debian GNU/Linux 10 (buster)\"\nNAME=\"Debian GNU/Linux\"\nVERSION_ID=\"10\"\nVERSION=\"10 (buster)\"\nVERSION_CODENAME=buster\nID=debian\nHOME_URL=\"https://www.debian.org/\"\nSUPPORT_URL=\"https://www.debian.org/support\"\nBUG_REPORT_URL=\"https://bugs.debian.org/\"\n", + "/usr/lib/os-release": "PRETTY_NAME=\"Debian GNU/Linux 10 (buster)\"\nNAME=\"Debian GNU/Linux\"\nVERSION_ID=\"10\"\nVERSION=\"10 (buster)\"\nVERSION_CODENAME=buster\nID=debian\nHOME_URL=\"https://www.debian.org/\"\nSUPPORT_URL=\"https://www.debian.org/support\"\nBUG_REPORT_URL=\"https://bugs.debian.org/\"\n", + "/etc/debian_version": "10.7\n" + }, + "platform.dist": ["debian", "10", "buster"], + "result": { + "distribution": "Debian", + "distribution_version": "10", + "distribution_release": "buster", + "distribution_major_version": "10", + "distribution_minor_version": "7", + "os_family": "Debian" + } +} diff --git a/test/units/module_utils/facts/system/distribution/fixtures/debian_7.9.json b/test/units/module_utils/facts/system/distribution/fixtures/debian_7.9.json new file mode 100644 index 0000000..894c942 --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/debian_7.9.json @@ -0,0 +1,39 @@ +{ + "name": "Debian 7.9", + "input": { + "/etc/os-release": "PRETTY_NAME=\"Debian GNU/Linux 7 (wheezy)\"\nNAME=\"Debian GNU/Linux\"\nVERSION_ID=\"7\"\nVERSION=\"7 (wheezy)\"\nID=debian\nANSI_COLOR=\"1;31\"\nHOME_URL=\"http://www.debian.org/\"\nSUPPORT_URL=\"http://www.debian.org/support/\"\nBUG_REPORT_URL=\"http://bugs.debian.org/\"" + }, + "platform.dist": ["debian", "7.9", ""], + "distro": { + "codename": "wheezy", + "id": "debian", + "name": "Debian GNU/Linux", + "version": "7", + "version_best": "7.9", + "os_release_info": { + "name": "Debian GNU/Linux", + "ansi_color": "1;31", + "support_url": "http://www.debian.org/support/", + "version_id": "7", + "bug_report_url": "http://bugs.debian.org/", + "pretty_name": "Debian GNU/Linux 7 (wheezy)", + "version": "7 (wheezy)", + "codename": "wheezy", + "home_url": "http://www.debian.org/", + "id": "debian" + }, + "lsb_release_info": { + "release": "7.9", + "codename": "wheezy", + "distributor_id": "Debian", + "description": "Debian GNU/Linux 7.9 (wheezy)" + } + }, + "result": { + "distribution": "Debian", + "distribution_major_version": "7", + "distribution_release": "wheezy", + "os_family": "Debian", + "distribution_version": "7.9" + } +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/debian_stretch_sid.json b/test/units/module_utils/facts/system/distribution/fixtures/debian_stretch_sid.json new file mode 100644 index 0000000..2338830 --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/debian_stretch_sid.json @@ -0,0 +1,36 @@ +{ + "name": "Debian stretch/sid", + "input": { + "/etc/os-release": "PRETTY_NAME=\"Debian GNU/Linux stretch/sid\"\nNAME=\"Debian GNU/Linux\"\nID=debian\nHOME_URL=\"https://www.debian.org/\"\nSUPPORT_URL=\"https://www.debian.org/support\"\nBUG_REPORT_URL=\"https://bugs.debian.org/\"", + "/etc/debian_version": "stretch/sid\n" + }, + "platform.dist": ["debian", "stretch/sid", ""], + "distro": { + "codename": "stretch", + "id": "debian", + "name": "Debian GNU/Linux", + "version": "9", + "version_best": "9.8", + "lsb_release_info": { + "release": "unstable", + "codename": "sid", + "distributor_id": "Debian", + "description": "Debian GNU/Linux stretch/sid" + }, + "os_release_info": { + "name": "Debian GNU/Linux", + "support_url": "https://www.debian.org/support", + "bug_report_url": "https://bugs.debian.org/", + "pretty_name": "Debian GNU/Linux stretch/sid", + "home_url": "https://www.debian.org/", + "id": "debian" + } + }, + "result": { + "distribution": "Debian", + "distribution_major_version": "9", + "distribution_release": "stretch", + "os_family": "Debian", + "distribution_version": "9.8" + } +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/deepin_20.4.json b/test/units/module_utils/facts/system/distribution/fixtures/deepin_20.4.json new file mode 100644 index 0000000..ca5d50d --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/deepin_20.4.json @@ -0,0 +1,29 @@ +{ + "name": "Deepin 20.4", + "distro": { + "codename": "apricot", + "id": "Deepin", + "name": "Deepin", + "version": "20.4", + "version_best": "20.4", + "os_release_info": {}, + "lsb_release_info": {} + }, + "input": { + "/etc/os-release": "PRETTY_NAME=\"Deepin 20.4\"\nNAME=\"Deepin\"\nVERSION_ID=\"20.4\"\nVERSION=\"20.4\"\nVERSION_CODENAME=\"apricot\"\nID=Deepin\nHOME_URL=\"https://www.deepin.org/\"\nBUG_REPORT_URL=\"https://bbs.deepin.org/\"\n", + "/etc/lsb-release": "DISTRIB_ID=Deepin\nDISTRIB_RELEASE=20.4\nDISTRIB_DESCRIPTION=\"Deepin 20.4\"\nDISTRIB_CODENAME=apricot\n", + "/usr/lib/os-release": "PRETTY_NAME=\"Deepin 20.4\"\nNAME=\"Deepin\"\nVERSION_ID=\"20.4\"\nVERSION=\"20.4\"\nVERSION_CODENAME=\"apricot\"\nID=Deepin\nHOME_URL=\"https://www.deepin.org/\"\nBUG_REPORT_URL=\"https://bbs.deepin.org/\"\n" + }, + "platform.dist": [ + "Deepin", + "20.4", + "apricot" + ], + "result": { + "distribution": "Deepin", + "distribution_version": "20.4", + "distribution_release": "apricot", + "distribution_major_version": "20", + "os_family": "Debian" + } +} diff --git a/test/units/module_utils/facts/system/distribution/fixtures/devuan.json b/test/units/module_utils/facts/system/distribution/fixtures/devuan.json new file mode 100644 index 0000000..d02fc2e --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/devuan.json @@ -0,0 +1,23 @@ +{ + "name": "Devuan", + "input": { + "/etc/os-release": "PRETTY_NAME=\"Devuan GNU/Linux ascii\"\nNAME=\"Devuan GNU/Linux\"\nID=devuan\nHOME_URL=\"https://www.devuan.org/\"\nSUPPORT_URL=\"https://devuan.org/os/community\"\nBUG_REPORT_URL=\"https://bugs.devuan.org/\"" + }, + "platform.dist": ["", "", ""], + "distro": { + "codename": "", + "id": "devuan", + "name": "Devuan GNU/Linux", + "version": "", + "version_best": "", + "os_release_info": {}, + "lsb_release_info": {} + }, + "result": { + "distribution": "Devuan", + "distribution_major_version": "NA", + "distribution_release": "ascii", + "os_family": "Debian", + "distribution_version": "NA" + } +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/dragonfly_5.2.2.json b/test/units/module_utils/facts/system/distribution/fixtures/dragonfly_5.2.2.json new file mode 100644 index 0000000..5b99a48 --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/dragonfly_5.2.2.json @@ -0,0 +1,25 @@ +{ + "name": "DragonFly v5.2.0-RELEASE #3", + "input": {}, + "platform.system": "DragonFly", + "platform.release": "5.2-RELEASE", + "command_output": { + "/sbin/sysctl -n kern.version": "DragonFly v5.2.0-RELEASE #1: Mon Apr 9 00:17:53 EDT 2018\nroot@www.shiningsilence.com:/usr/obj/home/justin/release/5_2/sys/X86_64_GENERIC" + }, + "distro": { + "codename": "", + "id": "dragonfly", + "name": "DragonFly", + "version": "5.2", + "version_best": "", + "os_release_info": {}, + "lsb_release_info": {} + }, + "result": { + "distribution": "DragonFly", + "distribution_major_version": "5", + "distribution_release": "5.2-RELEASE", + "os_family": "DragonFly", + "distribution_version": "5.2.0" + } +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/dragonfly_5.6.2.json b/test/units/module_utils/facts/system/distribution/fixtures/dragonfly_5.6.2.json new file mode 100644 index 0000000..90ec620 --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/dragonfly_5.6.2.json @@ -0,0 +1,25 @@ +{ + "name": "DragonFly v5.6.2-RELEASE #3", + "input": {}, + "platform.system": "DragonFly", + "platform.release": "5.6-RELEASE", + "command_output": { + "/sbin/sysctl -n kern.version": "DragonFly v5.6.2-RELEASE #3: Sat Aug 10 10:28:36 EDT 2019\nroot@www.shiningsilence.com:/usr/obj/home/justin/release/5_6/sys/X86_64_GENERIC" + }, + "distro": { + "codename": "", + "id": "dragonfly", + "name": "DragonFly", + "version": "5.2", + "version_best": "", + "os_release_info": {}, + "lsb_release_info": {} + }, + "result": { + "distribution": "DragonFly", + "distribution_major_version": "5", + "distribution_release": "5.6-RELEASE", + "os_family": "DragonFly", + "distribution_version": "5.6.2" + } +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/eurolinux_8.5.json b/test/units/module_utils/facts/system/distribution/fixtures/eurolinux_8.5.json new file mode 100644 index 0000000..add1b73 --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/eurolinux_8.5.json @@ -0,0 +1,46 @@ +{ + "name": "EuroLinux 8.5", + "distro": { + "codename": "Tirana", + "id": "eurolinux", + "name": "EuroLinux", + "version": "8.5", + "version_best": "8.5", + "lsb_release_info": {}, + "os_release_info": { + "name": "EuroLinux", + "version": "8.5 (Tirana)", + "id": "eurolinux", + "id_like": "rhel fedora centos", + "version_id": "8.5", + "platform_id": "platform:el8", + "pretty_name": "EuroLinux 8.5 (Tirana)", + "ansi_color": "0;34", + "cpe_name": "cpe:/o:eurolinux:eurolinux:8", + "home_url": "https://www.euro-linux.com/", + "bug_report_url": "https://github.com/EuroLinux/eurolinux-distro-bugs-and-rfc/", + "redhat_support_product": "EuroLinux", + "redhat_support_product_version": "8", + "codename": "Tirana" + } + }, + "input": { + "/etc/redhat-release": "EuroLinux release 8.5 (Tirana) \n", + "/etc/system-release": "EuroLinux release 8.5 (Tirana) \n", + "/etc/os-release": "NAME=\"EuroLinux\"\nVERSION=\"8.5 (Tirana)\"\nID=\"eurolinux\"\nID_LIKE=\"rhel fedora centos\"\nVERSION_ID=\"8.5\"\nPLATFORM_ID=\"platform:el8\"\nPRETTY_NAME=\"EuroLinux 8.5 (Tirana)\"\nANSI_COLOR=\"0;34\"\nCPE_NAME=\"cpe:/o:eurolinux:eurolinux:8\"\nHOME_URL=\"https://www.euro-linux.com/\"\nBUG_REPORT_URL=\"https://github.com/EuroLinux/eurolinux-distro-bugs-and-rfc/\"\nREDHAT_SUPPORT_PRODUCT=\"EuroLinux\"\nREDHAT_SUPPORT_PRODUCT_VERSION=\"8\"\n", + "/usr/lib/os-release": "NAME=\"EuroLinux\"\nVERSION=\"8.5 (Tirana)\"\nID=\"eurolinux\"\nID_LIKE=\"rhel fedora centos\"\nVERSION_ID=\"8.5\"\nPLATFORM_ID=\"platform:el8\"\nPRETTY_NAME=\"EuroLinux 8.5 (Tirana)\"\nANSI_COLOR=\"0;34\"\nCPE_NAME=\"cpe:/o:eurolinux:eurolinux:8\"\nHOME_URL=\"https://www.euro-linux.com/\"\nBUG_REPORT_URL=\"https://github.com/EuroLinux/eurolinux-distro-bugs-and-rfc/\"\nREDHAT_SUPPORT_PRODUCT=\"EuroLinux\"\nREDHAT_SUPPORT_PRODUCT_VERSION=\"8\"\n" + }, + "platform.dist": [ + "eurolinux", + "8.5", + "Tirana" + ], + "result": { + "distribution": "EuroLinux", + "distribution_version": "8.5", + "distribution_release": "Tirana", + "distribution_major_version": "8", + "os_family": "RedHat" + }, + "platform.release": "4.18.0-348.2.1.el8_5.x86_64" +} diff --git a/test/units/module_utils/facts/system/distribution/fixtures/fedora_22.json b/test/units/module_utils/facts/system/distribution/fixtures/fedora_22.json new file mode 100644 index 0000000..cec68d4 --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/fedora_22.json @@ -0,0 +1,25 @@ +{ + "name": "Fedora 22", + "platform.dist": ["fedora", "22", "Twenty Two"], + "distro": { + "codename": "Twenty Two", + "id": "fedora", + "name": "Fedora", + "version": "22", + "version_best": "22", + "os_release_info": {}, + "lsb_release_info": {} + }, + "input": { + "/etc/redhat-release": "Fedora release 22 (Twenty Two)\n", + "/etc/os-release": "NAME=Fedora\nVERSION=\"22 (Twenty Two)\"\nID=fedora\nVERSION_ID=22\nPRETTY_NAME=\"Fedora 22 (Twenty Two)\"\nANSI_COLOR=\"0;34\"\nCPE_NAME=\"cpe:/o:fedoraproject:fedora:22\"\nHOME_URL=\"https://fedoraproject.org/\"\nBUG_REPORT_URL=\"https://bugzilla.redhat.com/\"\nREDHAT_BUGZILLA_PRODUCT=\"Fedora\"\nREDHAT_BUGZILLA_PRODUCT_VERSION=22\nREDHAT_SUPPORT_PRODUCT=\"Fedora\"\nREDHAT_SUPPORT_PRODUCT_VERSION=22\nPRIVACY_POLICY_URL=https://fedoraproject.org/wiki/Legal:PrivacyPolicy\n", + "/etc/system-release": "Fedora release 22 (Twenty Two)\n" + }, + "result": { + "distribution_release": "Twenty Two", + "distribution": "Fedora", + "distribution_major_version": "22", + "os_family": "RedHat", + "distribution_version": "22" + } +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/fedora_25.json b/test/units/module_utils/facts/system/distribution/fixtures/fedora_25.json new file mode 100644 index 0000000..70b5bc3 --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/fedora_25.json @@ -0,0 +1,25 @@ +{ + "platform.dist": ["fedora", "25", "Rawhide"], + "distro": { + "codename": "Rawhide", + "id": "fedora", + "name": "Fedora", + "version": "25", + "version_best": "25", + "os_release_info": {}, + "lsb_release_info": {} + }, + "input": { + "/etc/redhat-release": "Fedora release 25 (Rawhide)\n", + "/etc/os-release": "NAME=Fedora\nVERSION=\"25 (Workstation Edition)\"\nID=fedora\nVERSION_ID=25\nPRETTY_NAME=\"Fedora 25 (Workstation Edition)\"\nANSI_COLOR=\"0;34\"\nCPE_NAME=\"cpe:/o:fedoraproject:fedora:25\"\nHOME_URL=\"https://fedoraproject.org/\"\nBUG_REPORT_URL=\"https://bugzilla.redhat.com/\"\nREDHAT_BUGZILLA_PRODUCT=\"Fedora\"\nREDHAT_BUGZILLA_PRODUCT_VERSION=rawhide\nREDHAT_SUPPORT_PRODUCT=\"Fedora\"\nREDHAT_SUPPORT_PRODUCT_VERSION=rawhide\nPRIVACY_POLICY_URL=https://fedoraproject.org/wiki/Legal:PrivacyPolicy\nVARIANT=\"Workstation Edition\"\nVARIANT_ID=workstation\n", + "/etc/system-release": "Fedora release 25 (Rawhide)\n" + }, + "name": "Fedora 25", + "result": { + "distribution_release": "Rawhide", + "distribution": "Fedora", + "distribution_major_version": "25", + "os_family": "RedHat", + "distribution_version": "25" + } +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/fedora_31.json b/test/units/module_utils/facts/system/distribution/fixtures/fedora_31.json new file mode 100644 index 0000000..e6d905e --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/fedora_31.json @@ -0,0 +1,55 @@ +{ + "name": "Fedora 31", + "distro": { + "codename": "", + "id": "fedora", + "name": "Fedora", + "version": "31", + "version_best": "31", + "lsb_release_info": { + "lsb_version": ":core-4.1-amd64:core-4.1-noarch", + "distributor_id": "Fedora", + "description": "Fedora release 31 (Thirty One)", + "release": "31", + "codename": "ThirtyOne" + }, + "os_release_info": { + "name": "Fedora", + "version": "31 (Workstation Edition)", + "id": "fedora", + "version_id": "31", + "version_codename": "", + "platform_id": "platform:f31", + "pretty_name": "Fedora 31 (Workstation Edition)", + "ansi_color": "0;34", + "logo": "fedora-logo-icon", + "cpe_name": "cpe:/o:fedoraproject:fedora:31", + "home_url": "https://fedoraproject.org/", + "documentation_url": "https://docs.fedoraproject.org/en-US/fedora/f31/system-administrators-guide/", + "support_url": "https://fedoraproject.org/wiki/Communicating_and_getting_help", + "bug_report_url": "https://bugzilla.redhat.com/", + "redhat_bugzilla_product": "Fedora", + "redhat_bugzilla_product_version": "31", + "redhat_support_product": "Fedora", + "redhat_support_product_version": "31", + "privacy_policy_url": "https://fedoraproject.org/wiki/Legal:PrivacyPolicy", + "variant": "Workstation Edition", + "variant_id": "workstation", + "codename": "" + } + }, + "input": { + "/etc/redhat-release": "Fedora release 31 (Thirty One)\n", + "/etc/system-release": "Fedora release 31 (Thirty One)\n", + "/etc/os-release": "NAME=Fedora\nVERSION=\"31 (Workstation Edition)\"\nID=fedora\nVERSION_ID=31\nVERSION_CODENAME=\"\"\nPLATFORM_ID=\"platform:f31\"\nPRETTY_NAME=\"Fedora 31 (Workstation Edition)\"\nANSI_COLOR=\"0;34\"\nLOGO=fedora-logo-icon\nCPE_NAME=\"cpe:/o:fedoraproject:fedora:31\"\nHOME_URL=\"https://fedoraproject.org/\"\nDOCUMENTATION_URL=\"https://docs.fedoraproject.org/en-US/fedora/f31/system-administrators-guide/\"\nSUPPORT_URL=\"https://fedoraproject.org/wiki/Communicating_and_getting_help\"\nBUG_REPORT_URL=\"https://bugzilla.redhat.com/\"\nREDHAT_BUGZILLA_PRODUCT=\"Fedora\"\nREDHAT_BUGZILLA_PRODUCT_VERSION=31\nREDHAT_SUPPORT_PRODUCT=\"Fedora\"\nREDHAT_SUPPORT_PRODUCT_VERSION=31\nPRIVACY_POLICY_URL=\"https://fedoraproject.org/wiki/Legal:PrivacyPolicy\"\nVARIANT=\"Workstation Edition\"\nVARIANT_ID=workstation\n", + "/usr/lib/os-release": "NAME=Fedora\nVERSION=\"31 (Workstation Edition)\"\nID=fedora\nVERSION_ID=31\nVERSION_CODENAME=\"\"\nPLATFORM_ID=\"platform:f31\"\nPRETTY_NAME=\"Fedora 31 (Workstation Edition)\"\nANSI_COLOR=\"0;34\"\nLOGO=fedora-logo-icon\nCPE_NAME=\"cpe:/o:fedoraproject:fedora:31\"\nHOME_URL=\"https://fedoraproject.org/\"\nDOCUMENTATION_URL=\"https://docs.fedoraproject.org/en-US/fedora/f31/system-administrators-guide/\"\nSUPPORT_URL=\"https://fedoraproject.org/wiki/Communicating_and_getting_help\"\nBUG_REPORT_URL=\"https://bugzilla.redhat.com/\"\nREDHAT_BUGZILLA_PRODUCT=\"Fedora\"\nREDHAT_BUGZILLA_PRODUCT_VERSION=31\nREDHAT_SUPPORT_PRODUCT=\"Fedora\"\nREDHAT_SUPPORT_PRODUCT_VERSION=31\nPRIVACY_POLICY_URL=\"https://fedoraproject.org/wiki/Legal:PrivacyPolicy\"\nVARIANT=\"Workstation Edition\"\nVARIANT_ID=workstation\n" + }, + "platform.dist": ["fedora", "31", ""], + "result": { + "distribution": "Fedora", + "distribution_version": "31", + "distribution_release": "", + "distribution_major_version": "31", + "os_family": "RedHat" + } +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/flatcar_3139.2.0.json b/test/units/module_utils/facts/system/distribution/fixtures/flatcar_3139.2.0.json new file mode 100644 index 0000000..3cd7fa7 --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/flatcar_3139.2.0.json @@ -0,0 +1,43 @@ +{ + "name": "Flatcar Container Linux by Kinvolk 3139.2.0", + "distro": { + "codename": "", + "id": "flatcar", + "name": "Flatcar Container Linux by Kinvolk", + "version": "3139.2.0", + "version_best": "3139.2.0", + "lsb_release_info": {}, + "os_release_info": { + "name": "Flatcar Container Linux by Kinvolk", + "id": "flatcar", + "id_like": "coreos", + "version": "3139.2.0", + "version_id": "3139.2.0", + "build_id": "2022-04-05-1803", + "pretty_name": "Flatcar Container Linux by Kinvolk 3139.2.0 (Oklo)", + "ansi_color": "38;5;75", + "home_url": "https://flatcar-linux.org/", + "bug_report_url": "https://issues.flatcar-linux.org", + "flatcar_board": "amd64-usr", + "cpe_name": "cpe:2.3:o:flatcar-linux:flatcar_linux:3139.2.0:*:*:*:*:*:*:*" + } + }, + "input": { + "/etc/os-release": "NAME=\"Flatcar Container Linux by Kinvolk\"\nID=flatcar\nID_LIKE=coreos\nVERSION=3139.2.0\nVERSION_ID=3139.2.0\nBUILD_ID=2022-04-05-1803\nPRETTY_NAME=\"Flatcar Container Linux by Kinvolk 3139.2.0 (Oklo)\"\nANSI_COLOR=\"38;5;75\"\nHOME_URL=\"https://flatcar-linux.org/\"\nBUG_REPORT_URL=\"https://issues.flatcar-linux.org\"\nFLATCAR_BOARD=\"amd64-usr\"\nCPE_NAME=\"cpe:2.3:o:flatcar-linux:flatcar_linux:3139.2.0:*:*:*:*:*:*:*\"\n", + "/etc/lsb-release": "DISTRIB_ID=\"Flatcar Container Linux by Kinvolk\"\nDISTRIB_RELEASE=3139.2.0\nDISTRIB_CODENAME=\"Oklo\"\nDISTRIB_DESCRIPTION=\"Flatcar Container Linux by Kinvolk 3139.2.0 (Oklo)\"\n", + "/usr/lib/os-release": "NAME=\"Flatcar Container Linux by Kinvolk\"\nID=flatcar\nID_LIKE=coreos\nVERSION=3139.2.0\nVERSION_ID=3139.2.0\nBUILD_ID=2022-04-05-1803\nPRETTY_NAME=\"Flatcar Container Linux by Kinvolk 3139.2.0 (Oklo)\"\nANSI_COLOR=\"38;5;75\"\nHOME_URL=\"https://flatcar-linux.org/\"\nBUG_REPORT_URL=\"https://issues.flatcar-linux.org\"\nFLATCAR_BOARD=\"amd64-usr\"\nCPE_NAME=\"cpe:2.3:o:flatcar-linux:flatcar_linux:3139.2.0:*:*:*:*:*:*:*\"\n" + }, + "platform.dist": [ + "flatcar", + "3139.2.0", + "" + ], + "result": { + "distribution": "Flatcar", + "distribution_version": "3139.2.0", + "distribution_release": "NA", + "distribution_major_version": "3139", + "os_family": "Flatcar" + }, + "platform.release": "5.15.32-flatcar" +} diff --git a/test/units/module_utils/facts/system/distribution/fixtures/kali_2019.1.json b/test/units/module_utils/facts/system/distribution/fixtures/kali_2019.1.json new file mode 100644 index 0000000..096b66f --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/kali_2019.1.json @@ -0,0 +1,25 @@ +{ + "name": "Kali 2019.1", + "input": { + "/etc/os-release": "PRETTY_NAME=\"Kali GNU/Linux Rolling\"\nNAME=\"Kali GNU/Linux\"\nID=kali\nVERSION=\"2019.1\"\nVERSION_ID=\"2019.1\"\nID_LIKE=debian\nANSI_COLOR=\"1;31\"\nHOME_URL=\"https://www.kali.org/\"\nSUPPORT_URL=\"https://forums.kali.org/\"\nBUG_REPORT_URL=\"https://bugs.kali.org/\"\n", + "/etc/lsb-release": "DISTRIB_ID=Kali\nDISTRIB_RELEASE=kali-rolling\nDISTRIB_CODENAME=kali-rolling\nDISTRIB_DESCRIPTION=\"Kali GNU/Linux Rolling\"\n", + "/usr/lib/os-release": "PRETTY_NAME=\"Kali GNU/Linux Rolling\"\nNAME=\"Kali GNU/Linux\"\nID=kali\nVERSION=\"2019.1\"\nVERSION_ID=\"2019.1\"\nID_LIKE=debian\nANSI_COLOR=\"1;31\"\nHOME_URL=\"https://www.kali.org/\"\nSUPPORT_URL=\"https://forums.kali.org/\"\nBUG_REPORT_URL=\"https://bugs.kali.org/\"\n" + }, + "platform.dist": ["kali", "2019.1", ""], + "distro": { + "codename": "kali-rolling", + "id": "kali", + "name": "Kali GNU/Linux Rolling", + "version": "2019.1", + "version_best": "2019.1", + "os_release_info": {}, + "lsb_release_info": {} + }, + "result": { + "distribution": "Kali", + "distribution_version": "2019.1", + "distribution_release": "kali-rolling", + "distribution_major_version": "2019", + "os_family": "Debian" + } +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/kde_neon_16.04.json b/test/units/module_utils/facts/system/distribution/fixtures/kde_neon_16.04.json new file mode 100644 index 0000000..5ff59c7 --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/kde_neon_16.04.json @@ -0,0 +1,42 @@ +{ + "platform.dist": ["neon", "16.04", "xenial"], + "distro": { + "codename": "xenial", + "id": "neon", + "name": "KDE neon", + "version": "16.04", + "version_best": "16.04", + "os_release_info": { + "support_url": "http://help.ubuntu.com/", + "version_codename": "xenial", + "pretty_name": "Ubuntu 16.04.6 LTS", + "home_url": "http://www.ubuntu.com/", + "bug_report_url": "http://bugs.launchpad.net/ubuntu/", + "version": "16.04.6 LTS (Xenial Xerus)", + "version_id": "16.04", + "id": "ubuntu", + "ubuntu_codename": "xenial", + "codename": "xenial", + "name": "Ubuntu", + "id_like": "debian" + }, + "lsb_release_info": { + "description": "Ubuntu 16.04.6 LTS", + "release": "16.04", + "distributor_id": "Ubuntu", + "codename": "xenial" + } + }, + "input": { + "/etc/os-release": "NAME=\"KDE neon\"\nVERSION=\"5.8\"\nID=neon\nID_LIKE=\"ubuntu debian\"\nPRETTY_NAME=\"KDE neon User Edition 5.8\"\nVERSION_ID=\"16.04\"\nHOME_URL=\"http://neon.kde.org/\"\nSUPPORT_URL=\"http://neon.kde.org/\"\nBUG_REPORT_URL=\"http://bugs.kde.org/\"\nVERSION_CODENAME=xenial\nUBUNTU_CODENAME=xenial\n", + "/etc/lsb-release": "DISTRIB_ID=neon\nDISTRIB_RELEASE=16.04\nDISTRIB_CODENAME=xenial\nDISTRIB_DESCRIPTION=\"KDE neon User Edition 5.8\"\n" + }, + "name": "KDE neon 16.04", + "result": { + "distribution_release": "xenial", + "distribution": "KDE neon", + "distribution_major_version": "16", + "os_family": "Debian", + "distribution_version": "16.04" + } +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/kylin_linux_advanced_server_v10.json b/test/units/module_utils/facts/system/distribution/fixtures/kylin_linux_advanced_server_v10.json new file mode 100644 index 0000000..e929b5a --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/kylin_linux_advanced_server_v10.json @@ -0,0 +1,38 @@ +{ + "name": "Kylin Linux Advanced Server V10", + "distro": { + "codename": "Sword", + "id": "kylin", + "name": "Kylin Linux Advanced Server", + "version": "V10", + "version_best": "V10", + "lsb_release_info": {}, + "os_release_info": { + "name": "Kylin Linux Advanced Server", + "version": "V10 (Sword)", + "id": "kylin", + "version_id": "V10", + "pretty_name": "Kylin Linux Advanced Server V10 (Sword)", + "ansi_color": "0;31", + "codename": "Sword" + } + }, + "input": { + "/etc/system-release": "Kylin Linux Advanced Server release V10 (Sword)\n", + "/etc/os-release": "NAME=\"Kylin Linux Advanced Server\"\nVERSION=\"V10 (Sword)\"\nID=\"kylin\"\nVERSION_ID=\"V10\"\nPRETTY_NAME=\"Kylin Linux Advanced Server V10 (Sword)\"\nANSI_COLOR=\"0;31\"\n\n", + "/etc/lsb-release": "DISTRIB_ID=Kylin\nDISTRIB_RELEASE=V10\nDISTRIB_CODENAME=juniper\nDISTRIB_DESCRIPTION=\"Kylin V10\"\nDISTRIB_KYLIN_RELEASE=V10\nDISTRIB_VERSION_TYPE=enterprise\nDISTRIB_VERSION_MODE=normal\n" + }, + "platform.dist": [ + "kylin", + "V10", + "Sword" + ], + "result": { + "distribution": "Kylin Linux Advanced Server", + "distribution_version": "V10", + "distribution_release": "Sword", + "distribution_major_version": "V10", + "os_family": "RedHat" + }, + "platform.release": "4.19.90-24.4.v2101.ky10.x86_64" +} diff --git a/test/units/module_utils/facts/system/distribution/fixtures/linux_mint_18.2.json b/test/units/module_utils/facts/system/distribution/fixtures/linux_mint_18.2.json new file mode 100644 index 0000000..74e628e --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/linux_mint_18.2.json @@ -0,0 +1,25 @@ +{ + "platform.dist": ["linuxmint", "18.2", "sonya"], + "input": { + "/etc/os-release": "NAME=\"Linux Mint\"\nVERSION=\"18.2 (Sonya)\"\nID=linuxmint\nID_LIKE=ubuntu\nPRETTY_NAME=\"Linux Mint 18.2\"\nVERSION_ID=\"18.2\"\nHOME_URL=\"http://www.linuxmint.com/\"\nSUPPORT_URL=\"http://forums.linuxmint.com/\"\nBUG_REPORT_URL=\"http://bugs.launchpad.net/linuxmint/\"\nVERSION_CODENAME=sonya\nUBUNTU_CODENAME=xenial\n", + "/usr/lib/os-release": "NAME=\"Linux Mint\"\nVERSION=\"18.2 (Sonya)\"\nID=linuxmint\nID_LIKE=ubuntu\nPRETTY_NAME=\"Linux Mint 18.2\"\nVERSION_ID=\"18.2\"\nHOME_URL=\"http://www.linuxmint.com/\"\nSUPPORT_URL=\"http://forums.linuxmint.com/\"\nBUG_REPORT_URL=\"http://bugs.launchpad.net/linuxmint/\"\nVERSION_CODENAME=sonya\nUBUNTU_CODENAME=xenial\n", + "/etc/lsb-release": "DISTRIB_ID=LinuxMint\nDISTRIB_RELEASE=18.2\nDISTRIB_CODENAME=sonya\nDISTRIB_DESCRIPTION=\"Linux Mint 18.2 Sonya\"\n" + }, + "result": { + "distribution_release": "sonya", + "distribution": "Linux Mint", + "distribution_major_version": "18", + "os_family": "Debian", + "distribution_version": "18.2" + }, + "name": "Linux Mint 18.2", + "distro": { + "codename": "sonya", + "version": "18.2", + "id": "linuxmint", + "version_best": "18.2", + "name": "Linux Mint", + "os_release_info": {}, + "lsb_release_info": {} + } +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/linux_mint_19.1.json b/test/units/module_utils/facts/system/distribution/fixtures/linux_mint_19.1.json new file mode 100644 index 0000000..7712856 --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/linux_mint_19.1.json @@ -0,0 +1,24 @@ +{ + "platform.dist": ["linuxmint", "19.1", "tessa"], + "input": { + "/usr/lib/os-release": "NAME=\"Linux Mint\"\nVERSION=\"19.1 (Tessa)\"\nID=linuxmint\nID_LIKE=ubuntu\nPRETTY_NAME=\"Linux Mint 19.1\"\nVERSION_ID=\"19.1\"\nHOME_URL=\"https://www.linuxmint.com/\"\nSUPPORT_URL=\"https://forums.ubuntu.com/\"\nBUG_REPORT_URL=\"http: //linuxmint-troubleshooting-guide.readthedocs.io/en/latest/\"\nPRIVACY_POLICY_URL=\"https://www.linuxmint.com/\"\nVERSION_CODENAME=tessa\nUBUNTU_CODENAME=bionic\n", + "/etc/lsb-release": "DISTRIB_ID=LinuxMint\nDISTRIB_RELEASE=19.1\nDISTRIB_CODENAME=tessa\nDISTRIB_DESCRIPTION=\"Linux Mint 19.1 Tessa\"\n" + }, + "result": { + "distribution_release": "tessa", + "distribution": "Linux Mint", + "distribution_major_version": "19", + "os_family": "Debian", + "distribution_version": "19.1" + }, + "name": "Linux Mint 19.1", + "distro": { + "codename": "tessa", + "version": "19.1", + "id": "linuxmint", + "version_best": "19.1", + "name": "Linux Mint", + "os_release_info": {}, + "lsb_release_info": {} + } +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/netbsd_8.2.json b/test/units/module_utils/facts/system/distribution/fixtures/netbsd_8.2.json new file mode 100644 index 0000000..65c4ed6 --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/netbsd_8.2.json @@ -0,0 +1,25 @@ +{ + "name": "NetBSD 8.2 (GENERIC) #0", + "input": {}, + "platform.system": "NetBSD", + "platform.release": "8.2", + "command_output": { + "/sbin/sysctl -n kern.version": "NetBSD 8.2 (GENERIC) #0: Tue Mar 31 05:08:40 UTC 2020\n mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/amd64/compile/GENERIC" + }, + "distro": { + "codename": "", + "id": "netbsd", + "name": "NetBSD", + "version": "8.2", + "version_best": "8.2", + "os_release_info": {}, + "lsb_release_info": {} + }, + "result": { + "distribution": "NetBSD", + "distribution_major_version": "8", + "distribution_release": "8.2", + "os_family": "NetBSD", + "distribution_version": "8.2" + } +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/nexenta_3.json b/test/units/module_utils/facts/system/distribution/fixtures/nexenta_3.json new file mode 100644 index 0000000..bdc942b --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/nexenta_3.json @@ -0,0 +1,25 @@ +{ + "name": "Nexenta 3", + "uname_v": "NexentaOS_134f", + "result": { + "distribution_release": "Open Storage Appliance v3.1.6", + "distribution": "Nexenta", + "os_family": "Solaris", + "distribution_version": "3.1.6" + }, + "platform.dist": ["", "", ""], + "distro": { + "codename": "", + "id": "", + "name": "", + "version": "", + "version_best": "", + "os_release_info": {}, + "lsb_release_info": {} + }, + "platform.release:": "", + "input": { + "/etc/release": " Open Storage Appliance v3.1.6\n Copyright (c) 2014 Nexenta Systems, Inc. All Rights Reserved.\n Copyright (c) 2011 Oracle. All Rights Reserved.\n Use is subject to license terms.\n" + }, + "platform.system": "SunOS" +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/nexenta_4.json b/test/units/module_utils/facts/system/distribution/fixtures/nexenta_4.json new file mode 100644 index 0000000..d24e9bc --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/nexenta_4.json @@ -0,0 +1,24 @@ +{ + "name": "Nexenta 4", + "uname_v": "NexentaOS_4:cd604cd066", + "result": { + "distribution_release": "Open Storage Appliance 4.0.3-FP2", + "distribution": "Nexenta", + "os_family": "Solaris", + "distribution_version": "4.0.3-FP2" + }, + "platform.dist": ["", "", ""], + "distro": { + "codename": "", + "id": "", + "name": "", + "version": "", + "version_best": "", + "os_release_info": {}, + "lsb_release_info": {} + }, + "input": { + "/etc/release": " Open Storage Appliance 4.0.3-FP2\n Copyright (c) 2014 Nexenta Systems, Inc. All Rights Reserved.\n Copyright (c) 2010 Oracle. All Rights Reserved.\n Use is subject to license terms.\n" + }, + "platform.system": "SunOS" +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/omnios.json b/test/units/module_utils/facts/system/distribution/fixtures/omnios.json new file mode 100644 index 0000000..8bb2b44 --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/omnios.json @@ -0,0 +1,24 @@ +{ + "name": "OmniOS", + "uname_v": "omnios-10b9c79", + "result": { + "distribution_release": "OmniOS v11 r151012", + "distribution": "OmniOS", + "os_family": "Solaris", + "distribution_version": "r151012" + }, + "platform.dist": ["", "", ""], + "distro": { + "codename": "", + "id": "", + "name": "", + "version": "", + "version_best": "", + "os_release_info": {}, + "lsb_release_info": {} + }, + "input": { + "/etc/release": " OmniOS v11 r151012\n Copyright 2014 OmniTI Computer Consulting, Inc. All rights reserved.\n Use is subject to license terms.\n\n" + }, + "platform.system": "SunOS" +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/openeuler_20.03.json b/test/units/module_utils/facts/system/distribution/fixtures/openeuler_20.03.json new file mode 100644 index 0000000..8310386 --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/openeuler_20.03.json @@ -0,0 +1,28 @@ +{ + "platform.dist": [ + "openeuler", + "20.03", + "LTS" + ], + "input": { + "/etc/os-release": "NAME=\"openEuler\"\nVERSION=\"20.03 (LTS)\"\nID=\"openEuler\"\nVERSION_ID=\"20.03\"\nPRETTY_NAME=\"openEuler 20.03 (LTS)\"\nANSI_COLOR=\"0;31\"\n\n", + "/etc/system-release": "openEuler release 20.03 (LTS)\n" + }, + "result": { + "distribution_release": "LTS", + "distribution": "openEuler", + "distribution_major_version": "20", + "os_family": "RedHat", + "distribution_version": "20.03" + }, + "name": "openEuler 20.03", + "distro": { + "codename": "LTS", + "version": "20.03", + "id": "openeuler", + "version_best": "20.03", + "name": "openEuler", + "os_release_info": {}, + "lsb_release_info": {} + } +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/openindiana.json b/test/units/module_utils/facts/system/distribution/fixtures/openindiana.json new file mode 100644 index 0000000..a055bb0 --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/openindiana.json @@ -0,0 +1,24 @@ +{ + "name": "OpenIndiana", + "uname_v": "oi_151a9", + "result": { + "distribution_release": "OpenIndiana Development oi_151.1.9 X86 (powered by illumos)", + "distribution": "OpenIndiana", + "os_family": "Solaris", + "distribution_version": "oi_151a9" + }, + "platform.dist": ["", "", ""], + "distro": { + "codename": "", + "id": "", + "name": "", + "version": "", + "version_best": "", + "os_release_info": {}, + "lsb_release_info": {} + }, + "input": { + "/etc/release": " OpenIndiana Development oi_151.1.9 X86 (powered by illumos)\n Copyright 2011 Oracle and/or its affiliates. All rights reserved.\n Use is subject to license terms.\n Assembled 17 January 2014\n" + }, + "platform.system": "SunOS" +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/opensuse_13.2.json b/test/units/module_utils/facts/system/distribution/fixtures/opensuse_13.2.json new file mode 100644 index 0000000..76d3a33 --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/opensuse_13.2.json @@ -0,0 +1,24 @@ +{ + "name": "openSUSE 13.2", + "input": { + "/etc/SuSE-release": "openSUSE 13.2 (x86_64)\nVERSION = 13.2\nCODENAME = Harlequin\n# /etc/SuSE-release is deprecated and will be removed in the future, use /etc/os-release instead", + "/etc/os-release": "NAME=openSUSE\nVERSION=\"13.2 (Harlequin)\"\nVERSION_ID=\"13.2\"\nPRETTY_NAME=\"openSUSE 13.2 (Harlequin) (x86_64)\"\nID=opensuse\nANSI_COLOR=\"0;32\"\nCPE_NAME=\"cpe:/o:opensuse:opensuse:13.2\"\nBUG_REPORT_URL=\"https://bugs.opensuse.org\"\nHOME_URL=\"https://opensuse.org/\"\nID_LIKE=\"suse\"" + }, + "platform.dist": ["SuSE", "13.2", "x86_64"], + "distro": { + "codename": "", + "id": "opensuse-harlequin", + "name": "openSUSE Harlequin", + "version": "13.2", + "version_best": "13.2", + "os_release_info": {}, + "lsb_release_info": {} + }, + "result": { + "distribution": "openSUSE", + "distribution_major_version": "13", + "distribution_release": "2", + "os_family": "Suse", + "distribution_version": "13.2" + } +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/opensuse_leap_15.0.json b/test/units/module_utils/facts/system/distribution/fixtures/opensuse_leap_15.0.json new file mode 100644 index 0000000..54f1265 --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/opensuse_leap_15.0.json @@ -0,0 +1,23 @@ +{ + "platform.dist": ["", "", ""], + "distro": { + "codename": "", + "id": "opensuse-leap", + "name": "openSUSE Leap", + "version": "15.0", + "version_best": "15.0", + "os_release_info": {}, + "lsb_release_info": {} + }, + "input": { + "/etc/os-release": "NAME=\"openSUSE Leap\"\n# VERSION=\"15.0\"\nID=opensuse-leap\nID_LIKE=\"suse opensuse\"\nVERSION_ID=\"15.0\"\nPRETTY_NAME=\"openSUSE Leap 15.0\"\nANSI_COLOR=\"0;32\"\nCPE_NAME=\"cpe:/o:opensuse:leap:15.0\"\nBUG_REPORT_URL=\"https://bugs.opensuse.org\"\nHOME_URL=\"https://www.opensuse.org/\"\n" + }, + "name": "openSUSE Leap 15.0", + "result": { + "distribution_release": "0", + "distribution": "openSUSE Leap", + "distribution_major_version": "15", + "os_family": "Suse", + "distribution_version": "15.0" + } +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/opensuse_leap_15.1.json b/test/units/module_utils/facts/system/distribution/fixtures/opensuse_leap_15.1.json new file mode 100644 index 0000000..d029423 --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/opensuse_leap_15.1.json @@ -0,0 +1,36 @@ +{ + "name": "openSUSE Leap 15.1", + "distro": { + "codename": "", + "id": "opensuse-leap", + "name": "openSUSE Leap", + "version": "15.1", + "version_best": "15.1", + "lsb_release_info": {}, + "os_release_info": { + "name": "openSUSE Leap", + "version": "15.1", + "codename": "", + "id": "opensuse-leap", + "id_like": "suse opensuse", + "version_id": "15.1", + "pretty_name": "openSUSE Leap 15.1", + "ansi_color": "0;32", + "cpe_name": "cpe:/o:opensuse:leap:15.1", + "bug_report_url": "https://bugs.opensuse.org", + "home_url": "https://www.opensuse.org/" + } + }, + "input": { + "/etc/os-release": "NAME=\"openSUSE Leap\"\nVERSION=\"15.1\"\nID=\"opensuse-leap\"\nID_LIKE=\"suse opensuse\"\nVERSION_ID=\"15.1\"\nPRETTY_NAME=\"openSUSE Leap 15.1\"\nANSI_COLOR=\"0;32\"\nCPE_NAME=\"cpe:/o:opensuse:leap:15.1\"\nBUG_REPORT_URL=\"https://bugs.opensuse.org\"\nHOME_URL=\"https://www.opensuse.org/\"\n", + "/usr/lib/os-release": "NAME=\"openSUSE Leap\"\nVERSION=\"15.1\"\nID=\"opensuse-leap\"\nID_LIKE=\"suse opensuse\"\nVERSION_ID=\"15.1\"\nPRETTY_NAME=\"openSUSE Leap 15.1\"\nANSI_COLOR=\"0;32\"\nCPE_NAME=\"cpe:/o:opensuse:leap:15.1\"\nBUG_REPORT_URL=\"https://bugs.opensuse.org\"\nHOME_URL=\"https://www.opensuse.org/\"\n" + }, + "platform.dist": ["opensuse-leap", "15.1", ""], + "result": { + "distribution": "openSUSE Leap", + "distribution_version": "15.1", + "distribution_release": "1", + "distribution_major_version": "15", + "os_family": "Suse" + } +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/opensuse_leap_42.1.json b/test/units/module_utils/facts/system/distribution/fixtures/opensuse_leap_42.1.json new file mode 100644 index 0000000..2142932 --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/opensuse_leap_42.1.json @@ -0,0 +1,24 @@ +{ + "name": "openSUSE Leap 42.1", + "input": { + "/etc/os-release": "NAME=\"openSUSE Leap\"\nVERSION=\"42.1\"\nVERSION_ID=\"42.1\"\nPRETTY_NAME=\"openSUSE Leap 42.1 (x86_64)\"\nID=opensuse\nANSI_COLOR=\"0;32\"\nCPE_NAME=\"cpe:/o:opensuse:opensuse:42.1\"\nBUG_REPORT_URL=\"https://bugs.opensuse.org\"\nHOME_URL=\"https://opensuse.org/\"\nID_LIKE=\"suse\"", + "/etc/SuSE-release": "openSUSE 42.1 (x86_64)\nVERSION = 42.1\nCODENAME = Malachite\n# /etc/SuSE-release is deprecated and will be removed in the future, use /etc/os-release instead" + }, + "platform.dist": ["SuSE", "42.1", "x86_64"], + "distro": { + "codename": "", + "id": "opensuse-leap", + "name": "openSUSE Leap", + "version": "42.1", + "version_best": "42.1", + "os_release_info": {}, + "lsb_release_info": {} + }, + "result": { + "distribution": "openSUSE Leap", + "distribution_major_version": "42", + "distribution_release": "1", + "os_family": "Suse", + "distribution_version": "42.1" + } +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/opensuse_tumbleweed_20160917.json b/test/units/module_utils/facts/system/distribution/fixtures/opensuse_tumbleweed_20160917.json new file mode 100644 index 0000000..db1a26c --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/opensuse_tumbleweed_20160917.json @@ -0,0 +1,23 @@ +{ + "platform.dist": ["", "", ""], + "distro": { + "codename": "", + "id": "opensuse-tumbleweed", + "name": "openSUSE Tumbleweed", + "version": "20160917", + "version_best": "20160917", + "os_release_info": {}, + "lsb_release_info": {} + }, + "input": { + "/etc/os-release": "NAME=\"openSUSE Tumbleweed\"\n# VERSION=\"20160917\"\nID=opensuse\nID_LIKE=\"suse\"\nVERSION_ID=\"20160917\"\nPRETTY_NAME=\"openSUSE Tumbleweed\"\nANSI_COLOR=\"0;32\"\nCPE_NAME=\"cpe:/o:opensuse:tumbleweed:20160917\"\nBUG_REPORT_URL=\"https://bugs.opensuse.org\"\nHOME_URL=\"https://www.opensuse.org/\"\n" + }, + "name": "openSUSE Tumbleweed 20160917", + "result": { + "distribution_release": "", + "distribution": "openSUSE Tumbleweed", + "distribution_major_version": "20160917", + "os_family": "Suse", + "distribution_version": "20160917" + } +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/osmc.json b/test/units/module_utils/facts/system/distribution/fixtures/osmc.json new file mode 100644 index 0000000..98a4923 --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/osmc.json @@ -0,0 +1,23 @@ +{ + "name": "OSMC", + "input": { + "/etc/os-release": "PRETTY_NAME=\"Open Source Media Center\"\nNAME=\"OSMC\"\nVERSION=\"March 2022\"\nVERSION_ID=\"2022.03-1\"\nID=osmc\nID_LIKE=debian\nANSI_COLOR=\"1;31\"\nHOME_URL=\"https://www.osmc.tv\"\nSUPPORT_URL=\"https://www.osmc.tv\"\nBUG_REPORT_URL=\"https://www.osmc.tv\"" + }, + "platform.dist": ["", "", ""], + "distro": { + "codename": "", + "id": "osmc", + "name": "OSMC", + "version": "", + "version_best": "", + "os_release_info": {}, + "lsb_release_info": {} + }, + "result": { + "distribution": "OSMC", + "distribution_major_version": "NA", + "distribution_release": "NA", + "os_family": "Debian", + "distribution_version": "March 2022" + } +} diff --git a/test/units/module_utils/facts/system/distribution/fixtures/pardus_19.1.json b/test/units/module_utils/facts/system/distribution/fixtures/pardus_19.1.json new file mode 100644 index 0000000..daf8f6e --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/pardus_19.1.json @@ -0,0 +1,41 @@ +{ + "name": "Pardus GNU/Linux 19.1", + "distro": { + "codename": "ondokuz", + "id": "pradus", + "name": "Pardus GNU/Linux", + "version": "19.1", + "version_best": "19.1", + "lsb_release_info": { + "release": "19.1", + "codename": "ondokuz", + "distributor_id": "Pardus", + "description": "Pardus GNU/Linux Ondokuz" + }, + "os_release_info": { + "pardus_codename": "ondokuz", + "name": "Pardus GNU/Linux", + "version_codename": "ondokuz", + "id_like": "debian", + "version_id": "19.1", + "bug_report_url": "https://talep.pardus.org.tr/", + "pretty_name": "Pardus GNU/Linux Ondokuz", + "version": "19.1 (Ondokuz)", + "codename": "ondokuz", + "home_url": "https://www.pardus.org.tr/", + "id": "pardus", + "support_url": "https://forum.pardus.org.tr/" + } + }, + "input": { + "/etc/os-release": "NAME=\"Pardus GNU/Linux\"\nVERSION=\"19.1 (Ondokuz)\"\nID=pardus\nID_LIKE=debian\nPRETTY_NAME=\"Pardus GNU/Linux Ondokuz\"\nVERSION_ID=\"19.1\"\nHOME_URL=\"https://www.pardus.org.tr/\"\nSUPPORT_URL=\"https://forum.pardus.org.tr/\"\nBUG_REPORT_URL=\"https://talep.pardus.org.tr/\"\nVERSION_CODENAME=ondokuz\nPARDUS_CODENAME=ondokuz" + }, + "platform.dist": ["debian", "10.0", ""], + "result": { + "distribution": "Pardus GNU/Linux", + "distribution_version": "19.1", + "distribution_release": "ondokuz", + "distribution_major_version": "19", + "os_family": "Debian" + } +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/parrot_4.8.json b/test/units/module_utils/facts/system/distribution/fixtures/parrot_4.8.json new file mode 100644 index 0000000..fd10ff6 --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/parrot_4.8.json @@ -0,0 +1,25 @@ +{ + "name": "Parrot 4.8", + "input": { + "/etc/os-release": "PRETTY_NAME=\"Parrot GNU/Linux 4.8\"\nNAME=\"Parrot GNU/Linux\"\nID=parrot\nVERSION=\"4.8\"\nVERSION_ID=\"4.8\"\nID_LIKE=debian\nHOME_URL=\"https://www.parrotlinux.org/\"\nSUPPORT_URL=\"https://community.parrotlinux.org/\"\nBUG_REPORT_URL=\"https://nest.parrot.sh/\"\n", + "/etc/lsb-release": "DISTRIB_ID=Parrot\nDISTRIB_RELEASE=4.8\nDISTRIB_CODENAME=rolling\nDISTRIB_DESCRIPTION=\"Parrot 4.8\"\n", + "/usr/lib/os-release": "PRETTY_NAME=\"Parrot GNU/Linux 4.8\"\nNAME=\"Parrot GNU/Linux\"\nID=parrot\nVERSION=\"4.8\"\nVERSION_ID=\"4.8\"\nID_LIKE=debian\nHOME_URL=\"https://www.parrotlinux.org/\"\nSUPPORT_URL=\"https://community.parrotlinux.org/\"\nBUG_REPORT_URL=\"https://nest.parrot.sh/\"\n" + }, + "platform.dist": ["parrot", "4.8", ""], + "distro": { + "codename": "rolling", + "id": "parrot", + "name": "Parrot GNU/Linux", + "version": "4.8", + "version_best": "4.8", + "os_release_info": {}, + "lsb_release_info": {} + }, + "result": { + "distribution": "Parrot", + "distribution_version": "4.8", + "distribution_release": "rolling", + "distribution_major_version": "4", + "os_family": "Debian" + } +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/pop_os_20.04.json b/test/units/module_utils/facts/system/distribution/fixtures/pop_os_20.04.json new file mode 100644 index 0000000..d3184ef --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/pop_os_20.04.json @@ -0,0 +1,29 @@ +{ + "name": "Pop!_OS 20.04", + "distro": { + "codename": "focal", + "id": "pop", + "name": "Pop!_OS", + "version": "20.04", + "version_best": "20.04", + "os_release_info": {}, + "lsb_release_info": {} + }, + "input": { + "/etc/os-release": "NAME=\"Pop!_OS\"\nVERSION=\"20.04\"\nID=pop\nID_LIKE=\"ubuntu debian\"\nPRETTY_NAME=\"Pop!_OS 20.04\"\nVERSION_ID=\"20.04\"\nHOME_URL=\"https://system76.com/pop\"\nSUPPORT_URL=\"http://support.system76.com\"\nBUG_REPORT_URL=\"https://github.com/pop-os/pop/issues\"\nPRIVACY_POLICY_URL=\"https://system76.com/privacy\"\nVERSION_CODENAME=focal\nUBUNTU_CODENAME=focal\nLOGO=distributor-logo-pop-os\n", + "/etc/lsb-release": "DISTRIB_ID=Pop\nDISTRIB_RELEASE=20.04\nDISTRIB_CODENAME=focal\nDISTRIB_DESCRIPTION=\"Pop!_OS 20.04\"\n", + "/usr/lib/os-release": "NAME=\"Pop!_OS\"\nVERSION=\"20.04\"\nID=pop\nID_LIKE=\"ubuntu debian\"\nPRETTY_NAME=\"Pop!_OS 20.04\"\nVERSION_ID=\"20.04\"\nHOME_URL=\"https://system76.com/pop\"\nSUPPORT_URL=\"http://support.system76.com\"\nBUG_REPORT_URL=\"https://github.com/pop-os/pop/issues\"\nPRIVACY_POLICY_URL=\"https://system76.com/privacy\"\nVERSION_CODENAME=focal\nUBUNTU_CODENAME=focal\nLOGO=distributor-logo-pop-os\n" + }, + "platform.dist": [ + "pop", + "20.04", + "focal" + ], + "result": { + "distribution": "Pop!_OS", + "distribution_version": "20.04", + "distribution_release": "focal", + "distribution_major_version": "20", + "os_family": "Debian" + } +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/redhat_6.7.json b/test/units/module_utils/facts/system/distribution/fixtures/redhat_6.7.json new file mode 100644 index 0000000..27a77d0 --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/redhat_6.7.json @@ -0,0 +1,25 @@ +{ + "name": "RedHat 6.7", + "platform.dist": ["redhat", "6.7", "Santiago"], + "distro": { + "codename": "Santiago", + "id": "rhel", + "name": "RedHat Enterprise Linux", + "version": "6.7", + "version_best": "6.7", + "os_release_info": {}, + "lsb_release_info": {} + }, + "input": { + "/etc/redhat-release": "Red Hat Enterprise Linux Server release 6.7 (Santiago)\n", + "/etc/lsb-release": "LSB_VERSION=base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch\n", + "/etc/system-release": "Red Hat Enterprise Linux Server release 6.7 (Santiago)\n" + }, + "result": { + "distribution_release": "Santiago", + "distribution": "RedHat", + "distribution_major_version": "6", + "os_family": "RedHat", + "distribution_version": "6.7" + } +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/redhat_7.2.json b/test/units/module_utils/facts/system/distribution/fixtures/redhat_7.2.json new file mode 100644 index 0000000..3900f82 --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/redhat_7.2.json @@ -0,0 +1,25 @@ +{ + "name": "RedHat 7.2", + "platform.dist": ["redhat", "7.2", "Maipo"], + "distro": { + "codename": "Maipo", + "id": "rhel", + "name": "RedHat Enterprise Linux", + "version": "7.2", + "version_best": "7.2", + "os_release_info": {}, + "lsb_release_info": {} + }, + "input": { + "/etc/redhat-release": "Red Hat Enterprise Linux Server release 7.2 (Maipo)\n", + "/etc/os-release": "NAME=\"Red Hat Enterprise Linux Server\"\nVERSION=\"7.2 (Maipo)\"\nID=\"rhel\"\nID_LIKE=\"fedora\"\nVERSION_ID=\"7.2\"\nPRETTY_NAME=\"Red Hat Enterprise Linux Server 7.2 (Maipo)\"\nANSI_COLOR=\"0;31\"\nCPE_NAME=\"cpe:/o:redhat:enterprise_linux:7.2:GA:server\"\nHOME_URL=\"https://www.redhat.com/\"\nBUG_REPORT_URL=\"https://bugzilla.redhat.com/\"\n\nREDHAT_BUGZILLA_PRODUCT=\"Red Hat Enterprise Linux 7\"\nREDHAT_BUGZILLA_PRODUCT_VERSION=7.2\nREDHAT_SUPPORT_PRODUCT=\"Red Hat Enterprise Linux\"\nREDHAT_SUPPORT_PRODUCT_VERSION=\"7.2\"\n", + "/etc/system-release": "Red Hat Enterprise Linux Server release 7.2 (Maipo)\n" + }, + "result": { + "distribution_release": "Maipo", + "distribution": "RedHat", + "distribution_major_version": "7", + "os_family": "RedHat", + "distribution_version": "7.2" + } +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/redhat_7.7.json b/test/units/module_utils/facts/system/distribution/fixtures/redhat_7.7.json new file mode 100644 index 0000000..b240efc --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/redhat_7.7.json @@ -0,0 +1,43 @@ +{ + "name": "RedHat 7.7", + "distro": { + "codename": "Maipo", + "id": "rhel", + "name": "Red Hat Enterprise Linux Server", + "version": "7.7", + "version_best": "7.7", + "lsb_release_info": {}, + "os_release_info": { + "name": "Red Hat Enterprise Linux Server", + "version": "7.7 (Maipo)", + "id": "rhel", + "id_like": "fedora", + "variant": "Server", + "variant_id": "server", + "version_id": "7.7", + "pretty_name": "Red Hat Enterprise Linux Server 7.7 (Maipo)", + "ansi_color": "0;31", + "cpe_name": "cpe:/o:redhat:enterprise_linux:7.7:GA:server", + "home_url": "https://www.redhat.com/", + "bug_report_url": "https://bugzilla.redhat.com/", + "redhat_bugzilla_product": "Red Hat Enterprise Linux 7", + "redhat_bugzilla_product_version": "7.7", + "redhat_support_product": "Red Hat Enterprise Linux", + "redhat_support_product_version": "7.7", + "codename": "Maipo" + } + }, + "input": { + "/etc/redhat-release": "Red Hat Enterprise Linux Server release 7.7 (Maipo)\n", + "/etc/system-release": "Red Hat Enterprise Linux Server release 7.7 (Maipo)\n", + "/etc/os-release": "NAME=\"Red Hat Enterprise Linux Server\"\nVERSION=\"7.7 (Maipo)\"\nID=\"rhel\"\nID_LIKE=\"fedora\"\nVARIANT=\"Server\"\nVARIANT_ID=\"server\"\nVERSION_ID=\"7.7\"\nPRETTY_NAME=\"Red Hat Enterprise Linux Server 7.7 (Maipo)\"\nANSI_COLOR=\"0;31\"\nCPE_NAME=\"cpe:/o:redhat:enterprise_linux:7.7:GA:server\"\nHOME_URL=\"https://www.redhat.com/\"\nBUG_REPORT_URL=\"https://bugzilla.redhat.com/\"\n\nREDHAT_BUGZILLA_PRODUCT=\"Red Hat Enterprise Linux 7\"\nREDHAT_BUGZILLA_PRODUCT_VERSION=7.7\nREDHAT_SUPPORT_PRODUCT=\"Red Hat Enterprise Linux\"\nREDHAT_SUPPORT_PRODUCT_VERSION=\"7.7\"\n" + }, + "platform.dist": ["rhel", "7.7", "Maipo"], + "result": { + "distribution": "RedHat", + "distribution_version": "7.7", + "distribution_release": "Maipo", + "distribution_major_version": "7", + "os_family": "RedHat" + } +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/rockylinux_8_3.json b/test/units/module_utils/facts/system/distribution/fixtures/rockylinux_8_3.json new file mode 100644 index 0000000..8c3ff76 --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/rockylinux_8_3.json @@ -0,0 +1,46 @@ +{ + "name": "Rocky 8.3", + "distro": { + "codename": "", + "id": "rocky", + "name": "Rocky Linux", + "version": "8.3", + "version_best": "8.3", + "lsb_release_info": {}, + "os_release_info": { + "name": "Rocky Linux", + "version": "8.3", + "id": "rocky", + "id_like": "rhel fedora", + "version_id": "8.3", + "platform_id": "platform:el8", + "pretty_name": "Rocky Linux 8.3", + "ansi_color": "0;31", + "cpe_name": "cpe:/o:rocky:rocky:8", + "home_url": "https://rockylinux.org/", + "bug_report_url": "https://bugs.rockylinux.org/", + "rocky_support_product": "Rocky Linux", + "rocky_support_product_version": "8" + } + }, + "input": { + "/etc/redhat-release": "Rocky Linux release 8.3\n", + "/etc/system-release": "Rocky Linux release 8.3\n", + "/etc/rocky-release": "Rocky Linux release 8.3\n", + "/etc/os-release": "NAME=\"Rocky Linux\"\nVERSION=\"8.3\"\nID=\"rocky\"\nID_LIKE=\"rhel fedora\"\nVERSION_ID=\"8.3\"\nPLATFORM_ID=\"platform:el8\"\nPRETTY_NAME=\"Rocky Linux 8.3\"\nANSI_COLOR=\"0;31\"\nCPE_NAME=\"cpe:/o:rocky:rocky:8\"\nHOME_URL=\"https://rockylinux.org/\"\nBUG_REPORT_URL=\"https://bugs.rockylinux.org/\"\nROCKY_SUPPORT_PRODUCT=\"Rocky Linux\"\nROCKY_SUPPORT_PRODUCT_VERSION=\"8\"\n", + "/usr/lib/os-release": "NAME=\"Rocky Linux\"\nVERSION=\"8.3\"\nID=\"rocky\"\nID_LIKE=\"rhel fedora\"\nVERSION_ID=\"8.3\"\nPLATFORM_ID=\"platform:el8\"\nPRETTY_NAME=\"Rocky Linux 8.3\"\nANSI_COLOR=\"0;31\"\nCPE_NAME=\"cpe:/o:rocky:rocky:8\"\nHOME_URL=\"https://rockylinux.org/\"\nBUG_REPORT_URL=\"https://bugs.rockylinux.org/\"\nROCKY_SUPPORT_PRODUCT=\"Rocky Linux\"\nROCKY_SUPPORT_PRODUCT_VERSION=\"8\"\n" + }, + "platform.dist": [ + "rocky", + "8.3", + "" + ], + "result": { + "distribution": "Rocky", + "distribution_version": "8.3", + "distribution_release": "NA", + "distribution_major_version": "8", + "os_family": "RedHat" + }, + "platform.release": "4.18.0-240.22.1.el8.x86_64" +} diff --git a/test/units/module_utils/facts/system/distribution/fixtures/sles_11.3.json b/test/units/module_utils/facts/system/distribution/fixtures/sles_11.3.json new file mode 100644 index 0000000..be71f1c --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/sles_11.3.json @@ -0,0 +1,23 @@ +{ + "name": "SLES 11.3", + "input": { + "/etc/SuSE-release": "SUSE Linux Enterprise Server 11 (x86_64)\nVERSION = 11\nPATCHLEVEL = 3" + }, + "platform.dist": ["SuSE", "11", "x86_64"], + "distro": { + "codename": "", + "id": "sles", + "name": "SUSE Linux Enterprise Server", + "version": "11", + "version_best": "11", + "os_release_info": {}, + "lsb_release_info": {} + }, + "result": { + "distribution": "SLES", + "distribution_major_version": "11", + "distribution_release": "3", + "os_family": "Suse", + "distribution_version": "11.3" + } +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/sles_11.4.json b/test/units/module_utils/facts/system/distribution/fixtures/sles_11.4.json new file mode 100644 index 0000000..3e4012a --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/sles_11.4.json @@ -0,0 +1,24 @@ +{ + "name": "SLES 11.4", + "input": { + "/etc/SuSE-release": "\nSUSE Linux Enterprise Server 11 (x86_64)\nVERSION = 11\nPATCHLEVEL = 4", + "/etc/os-release": "NAME=\"SLES\"\nVERSION=\"11.4\"\nVERSION_ID=\"11.4\"\nPRETTY_NAME=\"SUSE Linux Enterprise Server 11 SP4\"\nID=\"sles\"\nANSI_COLOR=\"0;32\"\nCPE_NAME=\"cpe:/o:suse:sles:11:4\"" + }, + "platform.dist": ["SuSE", "11", "x86_64"], + "distro": { + "codename": "", + "id": "sles", + "name": "SUSE Linux Enterprise Server", + "version": "11.4", + "version_best": "11.4", + "os_release_info": {}, + "lsb_release_info": {} + }, + "result": { + "distribution": "SLES", + "distribution_major_version": "11", + "distribution_release": "4", + "os_family": "Suse", + "distribution_version": "11.4" + } +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/sles_12_sp0.json b/test/units/module_utils/facts/system/distribution/fixtures/sles_12_sp0.json new file mode 100644 index 0000000..e84bbe5 --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/sles_12_sp0.json @@ -0,0 +1,24 @@ +{ + "name": "SLES 12 SP0", + "input": { + "/etc/SuSE-release": "\nSUSE Linux Enterprise Server 12 (x86_64)\nVERSION = 12\nPATCHLEVEL = 0\n# This file is deprecated and will be removed in a future service pack or release.\n# Please check /etc/os-release for details about this release.", + "/etc/os-release": "NAME=\"SLES\"\nVERSION=\"12\"\nVERSION_ID=\"12\"\nPRETTY_NAME=\"SUSE Linux Enterprise Server 12\"\nID=\"sles\"\nANSI_COLOR=\"0;32\"\nCPE_NAME=\"cpe:/o:suse:sles:12\"" + }, + "platform.dist": ["SuSE", "12", "x86_64"], + "distro": { + "codename": "", + "id": "sles", + "name": "SUSE Linux Enterprise Server", + "version": "12", + "version_best": "12", + "os_release_info": {}, + "lsb_release_info": {} + }, + "result": { + "distribution": "SLES", + "distribution_major_version": "12", + "distribution_release": "0", + "os_family": "Suse", + "distribution_version": "12" + } +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/sles_12_sp1.json b/test/units/module_utils/facts/system/distribution/fixtures/sles_12_sp1.json new file mode 100644 index 0000000..c78d53d --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/sles_12_sp1.json @@ -0,0 +1,24 @@ +{ + "name": "SLES 12 SP1", + "input": { + "/etc/SuSE-release": "\nSUSE Linux Enterprise Server 12 (x86_64)\nVERSION = 12\nPATCHLEVEL = 0\n# This file is deprecated and will be removed in a future service pack or release.\n# Please check /etc/os-release for details about this release.", + "/etc/os-release": "NAME=\"SLES\"\nVERSION=\"12-SP1\"\nVERSION_ID=\"12.1\"\nPRETTY_NAME=\"SUSE Linux Enterprise Server 12 SP1\"\nID=\"sles\"\nANSI_COLOR=\"0;32\"\nCPE_NAME=\"cpe:/o:suse:sles:12:sp1\"" + }, + "platform.dist": ["SuSE", "12", "x86_64"], + "distro": { + "codename": "", + "id": "sles", + "name": "SUSE Linux Enterprise Server", + "version": "12.1", + "version_best": "12.1", + "os_release_info": {}, + "lsb_release_info": {} + }, + "result": { + "distribution": "SLES", + "distribution_major_version": "12", + "distribution_release": "1", + "os_family": "Suse", + "distribution_version": "12.1" + } +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/smartos_global_zone.json b/test/units/module_utils/facts/system/distribution/fixtures/smartos_global_zone.json new file mode 100644 index 0000000..ae01a10 --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/smartos_global_zone.json @@ -0,0 +1,24 @@ +{ + "name": "SmartOS Global Zone", + "uname_v": "joyent_20160330T234717Z", + "result": { + "distribution_release": "SmartOS 20160330T234717Z x86_64", + "distribution": "SmartOS", + "os_family": "Solaris", + "distribution_version": "joyent_20160330T234717Z" + }, + "platform.dist": ["", "", ""], + "distro": { + "codename": "", + "id": "", + "name": "", + "version": "", + "version_best": "", + "os_release_info": {}, + "lsb_release_info": {} + }, + "input": { + "/etc/release": " SmartOS 20160330T234717Z x86_64\n Copyright 2010 Sun Microsystems, Inc. All Rights Reserved.\n Copyright 2010-2012 Joyent, Inc. All Rights Reserved.\n Use is subject to license terms.\n\n Built with the following components:\n\n[\n { \"repo\": \"smartos-live\", \"branch\": \"release-20160331\", \"rev\": \"a77c410f2afe6dc9853a915733caec3609cc50f1\", \"commit_date\": \"1459340323\", \"url\": \"git@github.com:joyent/smartos-live.git\" }\n , { \"repo\": \"illumos-joyent\", \"branch\": \"release-20160331\", \"rev\": \"ab664c06caf06e9ce7586bff956e7709df1e702e\", \"commit_date\": \"1459362533\", \"url\": \"/root/data/jenkins/workspace/smartos/MG/build/illumos-joyent\" }\n , { \"repo\": \"illumos-extra\", \"branch\": \"release-20160331\", \"rev\": \"cc723855bceace3df7860b607c9e3827d47e0ff4\", \"commit_date\": \"1458153188\", \"url\": \"/root/data/jenkins/workspace/smartos/MG/build/illumos-extra\" }\n , { \"repo\": \"kvm\", \"branch\": \"release-20160331\", \"rev\": \"a8befd521c7e673749c64f118585814009fe4b73\", \"commit_date\": \"1450081968\", \"url\": \"/root/data/jenkins/workspace/smartos/MG/build/illumos-kvm\" }\n , { \"repo\": \"kvm-cmd\", \"branch\": \"release-20160331\", \"rev\": \"c1a197c8e4582c68739ab08f7e3198b2392c9820\", \"commit_date\": \"1454723558\", \"url\": \"/root/data/jenkins/workspace/smartos/MG/build/illumos-kvm-cmd\" }\n , { \"repo\": \"mdata-client\", \"branch\": \"release-20160331\", \"rev\": \"58158c44603a3316928975deccc5d10864832770\", \"commit_date\": \"1429917227\", \"url\": \"/root/data/jenkins/workspace/smartos/MG/build/mdata-client\" }\n]\n" + }, + "platform.system": "SunOS" +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/smartos_zone.json b/test/units/module_utils/facts/system/distribution/fixtures/smartos_zone.json new file mode 100644 index 0000000..8f20113 --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/smartos_zone.json @@ -0,0 +1,25 @@ +{ + "name": "SmartOS Zone", + "uname_v": "joyent_20160330T234717Z", + "result": { + "distribution_release": "SmartOS x86_64", + "distribution": "SmartOS", + "os_family": "Solaris", + "distribution_version": "14.3.0" + }, + "platform.dist": ["", "", ""], + "distro": { + "codename": "", + "id": "", + "name": "", + "version": "", + "version_best": "", + "os_release_info": {}, + "lsb_release_info": {} + }, + "input": { + "/etc/release": " SmartOS x86_64\n Copyright 2010 Sun Microsystems, Inc. All Rights Reserved.\n Copyright 2010-2013 Joyent, Inc. All Rights Reserved.\n Use is subject to license terms.\n See joyent_20141002T182809Z for assembly date and time.\n", + "/etc/product": "Name: Joyent Instance\nImage: base64 14.3.0\nDocumentation: http://wiki.joyent.com/jpc2/Base+Instance\n" + }, + "platform.system": "SunOS" +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/smgl_na.json b/test/units/module_utils/facts/system/distribution/fixtures/smgl_na.json new file mode 100644 index 0000000..f3436b8 --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/smgl_na.json @@ -0,0 +1,23 @@ +{ + "platform.dist": ["", "", ""], + "distro": { + "codename": "", + "id": "smgl", + "name": "Source Mage GNU/Linux", + "version": "", + "version_best": "", + "os_release_info": {}, + "lsb_release_info": {} + }, + "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" + } +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/solaris_10.json b/test/units/module_utils/facts/system/distribution/fixtures/solaris_10.json new file mode 100644 index 0000000..de1dbdc --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/solaris_10.json @@ -0,0 +1,25 @@ +{ + "name": "Solaris 10", + "uname_r": "5.10", + "platform.dist": ["", "", ""], + "distro": { + "codename": "", + "id": "", + "name": "", + "version": "", + "version_best": "", + "os_release_info": {}, + "lsb_release_info": {} + }, + "input": { + "/etc/release": " Oracle Solaris 10 1/13 s10x_u11wos_24a X86\n Copyright (c) 1983, 2013, Oracle and/or its affiliates. All rights reserved.\n Assembled 17 January 2013\n" + }, + "platform.system": "SunOS", + "result": { + "distribution_release": "Oracle Solaris 10 1/13 s10x_u11wos_24a X86", + "distribution": "Solaris", + "os_family": "Solaris", + "distribution_major_version": "10", + "distribution_version": "10" + } +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/solaris_11.3.json b/test/units/module_utils/facts/system/distribution/fixtures/solaris_11.3.json new file mode 100644 index 0000000..056abe4 --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/solaris_11.3.json @@ -0,0 +1,25 @@ +{ + "name": "Solaris 11.3", + "uname_r": "5.11", + "platform.dist": ["", "", ""], + "distro": { + "codename": "", + "id": "", + "name": "", + "version": "", + "version_best": "", + "os_release_info": {}, + "lsb_release_info": {} + }, + "input": { + "/etc/release": " Oracle Solaris 11.3 X86\n Copyright (c) 1983, 2018, Oracle and/or its affiliates. All rights reserved.\n Assembled 09 May 2018\n" + }, + "platform.system": "SunOS", + "result": { + "distribution_release": "Oracle Solaris 11.3 X86", + "distribution": "Solaris", + "os_family": "Solaris", + "distribution_major_version": "11", + "distribution_version": "11.3" + } +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/solaris_11.4.json b/test/units/module_utils/facts/system/distribution/fixtures/solaris_11.4.json new file mode 100644 index 0000000..462d550 --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/solaris_11.4.json @@ -0,0 +1,35 @@ +{ + "name": "Solaris 11.4", + "uname_r": "5.11", + "platform.dist": ["", "", ""], + "distro": { + "codename": "", + "id": "", + "name": "", + "version": "", + "version_best": "", + "os_release_info": { + "support_url": "https://support.oracle.com/", + "name": "Oracle Solaris", + "pretty_name": "Oracle Solaris 11.4", + "version": "11.4", + "id": "solaris", + "version_id": "11.4", + "build_id": "11.4.0.0.1.15.0", + "home_url": "https://www.oracle.com/solaris/", + "cpe_name": "cpe:/o:oracle:solaris:11:4" + }, + "lsb_release_info": {} + }, + "input": { + "/etc/release": " Oracle Solaris 11.4 SPARC\n Copyright (c) 1983, 2018, Oracle and/or its affiliates. All rights reserved.\n Assembled 14 September 2018\n" + }, + "platform.system": "SunOS", + "result": { + "distribution_release": "Oracle Solaris 11.4 SPARC", + "distribution": "Solaris", + "os_family": "Solaris", + "distribution_major_version": "11", + "distribution_version": "11.4" + } +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/solaris_11.json b/test/units/module_utils/facts/system/distribution/fixtures/solaris_11.json new file mode 100644 index 0000000..749b8bc --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/solaris_11.json @@ -0,0 +1,26 @@ +{ + "name": "Solaris 11", + "uname_v": "11.0", + "uname_r": "5.11", + "result": { + "distribution_release": "Oracle Solaris 11 11/11 X86", + "distribution": "Solaris", + "os_family": "Solaris", + "distribution_major_version": "11", + "distribution_version": "11" + }, + "platform.dist": ["", "", ""], + "distro": { + "codename": "", + "id": "", + "name": "", + "version": "", + "version_best": "", + "os_release_info": {}, + "lsb_release_info": {} + }, + "input": { + "/etc/release": " Oracle Solaris 11 11/11 X86\n Copyright (c) 1983, 2011, Oracle and/or its affiliates. All rights reserved.\n Assembled 18 October 2011\n" + }, + "platform.system": "SunOS" +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/steamos_2.0.json b/test/units/module_utils/facts/system/distribution/fixtures/steamos_2.0.json new file mode 100644 index 0000000..7cb9c12 --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/steamos_2.0.json @@ -0,0 +1,40 @@ +{ + "name": "SteamOS 2.0", + "input": { + "/etc/os-release": "PRETTY_NAME=\"SteamOS GNU/Linux 2.0 (brewmaster)\"\nNAME=\"SteamOS GNU/Linux\"\nVERSION_ID=\"2\"\nVERSION=\"2 (brewmaster)\"\nID=steamos\nID_LIKE=debian\nHOME_URL=\"http://www.steampowered.com/\"\nSUPPORT_URL=\"http://support.steampowered.com/\"\nBUG_REPORT_URL=\"http://support.steampowered.com/\"", + "/etc/lsb-release": "DISTRIB_ID=SteamOS\nDISTRIB_RELEASE=2.0\nDISTRIB_CODENAME=brewmaster\nDISTRIB_DESCRIPTION=\"SteamOS 2.0\"" + }, + "platform.dist": ["Steamos", "2.0", "brewmaster"], + "distro": { + "codename": "brewmaster", + "id": "steamos", + "name": "SteamOS GNU/Linux", + "version": "2.0", + "version_best": "2.0", + "os_release_info": { + "bug_report_url": "http://support.steampowered.com/", + "id_like": "debian", + "version_id": "2", + "pretty_name": "SteamOS GNU/Linux 2.0 (brewmaster)", + "version": "2 (brewmaster)", + "home_url": "http://www.steampowered.com/", + "name": "SteamOS GNU/Linux", + "support_url": "http://support.steampowered.com/", + "codename": "brewmaster", + "id": "steamos" + }, + "lsb_release_info": { + "codename": "brewmaster", + "description": "SteamOS 2.0", + "distributor_id": "SteamOS", + "release": "2.0" + } + }, + "result": { + "distribution": "SteamOS", + "distribution_major_version": "2", + "distribution_release": "brewmaster", + "os_family": "Debian", + "distribution_version": "2.0" + } +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/tencentos_3_1.json b/test/units/module_utils/facts/system/distribution/fixtures/tencentos_3_1.json new file mode 100644 index 0000000..f1051dd --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/tencentos_3_1.json @@ -0,0 +1,50 @@ +{ + "name": "TencentOS 3.1", + "distro": { + "codename": "Final", + "id": "tencentos", + "name": "TencentOS Server", + "version": "3.1", + "version_best": "3.1", + "lsb_release_info": {}, + "os_release_info": { + "name": "TencentOS Server", + "version": "3.1 (Final)", + "id": "tencentos", + "id_like": "rhel fedora centos", + "version_id": "3.1", + "platform_id": "platform:el8", + "pretty_name": "TencentOS Server 3.1 (Final)", + "ansi_color": "0;31", + "cpe_name": "cpe:/o:tencentos:tencentos:3", + "home_url": "https://tlinux.qq.com/", + "bug_report_url": "https://tlinux.qq.com/", + "centos_mantisbt_project": "CentOS-8", + "centos_mantisbt_project_version": "8", + "redhat_support_product": "centos", + "redhat_support_product_version": "8", + "name_orig": "CentOS Linux", + "codename": "Final" + } + }, + "input": { + "/etc/centos-release": "NAME=\"TencentOS Server\"\nVERSION=\"3.1 (Final)\"\nID=\"tencentos\"\nID_LIKE=\"rhel fedora centos\"\nVERSION_ID=\"3.1\"\nPLATFORM_ID=\"platform:el8\"\nPRETTY_NAME=\"TencentOS Server 3.1 (Final)\"\nANSI_COLOR=\"0;31\"\nCPE_NAME=\"cpe:/o:tencentos:tencentos:3\"\nHOME_URL=\"https://tlinux.qq.com/\"\nBUG_REPORT_URL=\"https://tlinux.qq.com/\"\n\nCENTOS_MANTISBT_PROJECT=\"CentOS-8\"\nCENTOS_MANTISBT_PROJECT_VERSION=\"8\"\nREDHAT_SUPPORT_PRODUCT=\"centos\"\nREDHAT_SUPPORT_PRODUCT_VERSION=\"8\"\nNAME_ORIG=\"CentOS Linux\"\n", + "/etc/redhat-release": "CentOS Linux release 8.4.2105 (Core)\n", + "/etc/system-release": "NAME=\"TencentOS Server\"\nVERSION=\"3.1 (Final)\"\nID=\"tencentos\"\nID_LIKE=\"rhel fedora centos\"\nVERSION_ID=\"3.1\"\nPLATFORM_ID=\"platform:el8\"\nPRETTY_NAME=\"TencentOS Server 3.1 (Final)\"\nANSI_COLOR=\"0;31\"\nCPE_NAME=\"cpe:/o:tencentos:tencentos:3\"\nHOME_URL=\"https://tlinux.qq.com/\"\nBUG_REPORT_URL=\"https://tlinux.qq.com/\"\n\nCENTOS_MANTISBT_PROJECT=\"CentOS-8\"\nCENTOS_MANTISBT_PROJECT_VERSION=\"8\"\nREDHAT_SUPPORT_PRODUCT=\"centos\"\nREDHAT_SUPPORT_PRODUCT_VERSION=\"8\"\nNAME_ORIG=\"CentOS Linux\"\n", + "/etc/os-release": "NAME=\"TencentOS Server\"\nVERSION=\"3.1 (Final)\"\nID=\"tencentos\"\nID_LIKE=\"rhel fedora centos\"\nVERSION_ID=\"3.1\"\nPLATFORM_ID=\"platform:el8\"\nPRETTY_NAME=\"TencentOS Server 3.1 (Final)\"\nANSI_COLOR=\"0;31\"\nCPE_NAME=\"cpe:/o:tencentos:tencentos:3\"\nHOME_URL=\"https://tlinux.qq.com/\"\nBUG_REPORT_URL=\"https://tlinux.qq.com/\"\n\nCENTOS_MANTISBT_PROJECT=\"CentOS-8\"\nCENTOS_MANTISBT_PROJECT_VERSION=\"8\"\nREDHAT_SUPPORT_PRODUCT=\"centos\"\nREDHAT_SUPPORT_PRODUCT_VERSION=\"8\"\nNAME_ORIG=\"CentOS Linux\"\n", + "/usr/lib/os-release": "NAME=\"CentOS Linux\"\nVERSION=\"8\"\nID=\"centos\"\nID_LIKE=\"rhel fedora\"\nVERSION_ID=\"8\"\nPLATFORM_ID=\"platform:el8\"\nPRETTY_NAME=\"CentOS Linux 8\"\nANSI_COLOR=\"0;31\"\nCPE_NAME=\"cpe:/o:centos:centos:8\"\nHOME_URL=\"https://centos.org/\"\nBUG_REPORT_URL=\"https://bugs.centos.org/\"\nCENTOS_MANTISBT_PROJECT=\"CentOS-8\"\nCENTOS_MANTISBT_PROJECT_VERSION=\"8\"\n" + }, + "platform.dist": [ + "tencentos", + "3.1", + "Final" + ], + "result": { + "distribution": "TencentOS", + "distribution_version": "3.1", + "distribution_release": "Final", + "distribution_major_version": "3", + "os_family": "RedHat" + }, + "platform.release": "5.4.32-19-0001" +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/truenas_12.0rc1.json b/test/units/module_utils/facts/system/distribution/fixtures/truenas_12.0rc1.json new file mode 100644 index 0000000..9a9efe3 --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/truenas_12.0rc1.json @@ -0,0 +1,39 @@ +{ + "name": "FreeBSD 12.2", + "distro": { + "codename": "", + "id": "freebsd", + "name": "FreeBSD", + "version": "12.2", + "version_best": "12.2", + "lsb_release_info": {}, + "os_release_info": { + "name": "FreeBSD", + "version": "12.2-PRERELEASE", + "version_id": "12.2", + "id": "freebsd", + "ansi_color": "0;31", + "pretty_name": "FreeBSD 12.2-PRERELEASE", + "cpe_name": "cpe:/o:freebsd:freebsd:12.2", + "home_url": "https://FreeBSD.org/", + "bug_report_url": "https://bugs.FreeBSD.org/" + } + }, + "input": { + "/etc/os-release": "NAME=FreeBSD\nVERSION=12.2-PRERELEASE\nVERSION_ID=12.2\nID=freebsd\nANSI_COLOR=\"0;31\"\nPRETTY_NAME=\"FreeBSD 12.2-PRERELEASE\"\nCPE_NAME=cpe:/o:freebsd:freebsd:12.2\nHOME_URL=https://FreeBSD.org/\nBUG_REPORT_URL=https://bugs.FreeBSD.org/\n" + }, + "platform.dist": [ + "freebsd", + "12.2", + "" + ], + "result": { + "distribution": "FreeBSD", + "distribution_version": "12.2", + "distribution_release": "12.2-PRERELEASE", + "distribution_major_version": "12", + "os_family": "FreeBSD" + }, + "platform.system": "FreeBSD", + "platform.release": "12.2-PRERELEASE" +} diff --git a/test/units/module_utils/facts/system/distribution/fixtures/ubuntu_10.04_guess.json b/test/units/module_utils/facts/system/distribution/fixtures/ubuntu_10.04_guess.json new file mode 100644 index 0000000..38a6040 --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/ubuntu_10.04_guess.json @@ -0,0 +1,23 @@ +{ + "name": "Ubuntu 10.04 guess", + "input": { + "/etc/lsb-release": "DISTRIB_ID=Ubuntu\nDISTRIB_RELEASE=10.04\nDISTRIB_CODENAME=lucid\nDISTRIB_DESCRIPTION=\"Ubuntu 10.04.4 LTS" + }, + "platform.dist": ["Ubuntu", "10.04", "lucid"], + "distro": { + "codename": "lucid", + "id": "ubuntu", + "name": "Ubuntu", + "version": "10.04", + "version_best": "10.04.1", + "os_release_info": {}, + "lsb_release_info": {} + }, + "result": { + "distribution": "Ubuntu", + "distribution_major_version": "10", + "distribution_release": "lucid", + "os_family": "Debian", + "distribution_version": "10.04" + } +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/ubuntu_12.04.json b/test/units/module_utils/facts/system/distribution/fixtures/ubuntu_12.04.json new file mode 100644 index 0000000..01203b5 --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/ubuntu_12.04.json @@ -0,0 +1,24 @@ +{ + "name": "Ubuntu 12.04", + "input": { + "/etc/lsb-release": "DISTRIB_ID=Ubuntu\nDISTRIB_RELEASE=12.04\nDISTRIB_CODENAME=precise\nDISTRIB_DESCRIPTION=\"Ubuntu 12.04.5 LTS\"", + "/etc/os-release": "NAME=\"Ubuntu\"\nVERSION=\"12.04.5 LTS, Precise Pangolin\"\nID=ubuntu\nID_LIKE=debian\nPRETTY_NAME=\"Ubuntu precise (12.04.5 LTS)\"\nVERSION_ID=\"12.04\"" + }, + "platform.dist": ["Ubuntu", "12.04", "precise"], + "distro": { + "codename": "precise", + "id": "ubuntu", + "name": "Ubuntu", + "version": "12.04", + "version_best": "12.04.5", + "os_release_info": {}, + "lsb_release_info": {} + }, + "result": { + "distribution": "Ubuntu", + "distribution_major_version": "12", + "distribution_release": "precise", + "os_family": "Debian", + "distribution_version": "12.04" + } +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/ubuntu_14.04.json b/test/units/module_utils/facts/system/distribution/fixtures/ubuntu_14.04.json new file mode 100644 index 0000000..5d5af0a --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/ubuntu_14.04.json @@ -0,0 +1,24 @@ +{ + "name": "Ubuntu 14.04", + "input": { + "/etc/lsb-release": "DISTRIB_ID=Ubuntu\nDISTRIB_RELEASE=14.04\nDISTRIB_CODENAME=trusty\nDISTRIB_DESCRIPTION=\"Ubuntu 14.04.4 LTS\"", + "/etc/os-release": "NAME=\"Ubuntu\"\nVERSION=\"14.04.4 LTS, Trusty Tahr\"\nID=ubuntu\nID_LIKE=debian\nPRETTY_NAME=\"Ubuntu 14.04.4 LTS\"\nVERSION_ID=\"14.04\"\nHOME_URL=\"http://www.ubuntu.com/\"\nSUPPORT_URL=\"http://help.ubuntu.com/\"\nBUG_REPORT_URL=\"http://bugs.launchpad.net/ubuntu/\"" + }, + "platform.dist": ["Ubuntu", "14.04", "trusty"], + "distro": { + "codename": "trusty", + "id": "ubuntu", + "name": "Ubuntu", + "version": "14.04", + "version_best": "14.04.4", + "os_release_info": {}, + "lsb_release_info": {} + }, + "result": { + "distribution": "Ubuntu", + "distribution_major_version": "14", + "distribution_release": "trusty", + "os_family": "Debian", + "distribution_version": "14.04" + } +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/ubuntu_16.04.json b/test/units/module_utils/facts/system/distribution/fixtures/ubuntu_16.04.json new file mode 100644 index 0000000..f8f50a9 --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/ubuntu_16.04.json @@ -0,0 +1,24 @@ +{ + "platform.dist": ["Ubuntu", "16.04", "xenial"], + "distro": { + "codename": "xenial", + "id": "ubuntu", + "name": "Ubuntu", + "version": "16.04", + "version_best": "16.04.6", + "os_release_info": {}, + "lsb_release_info": {} + }, + "input": { + "/etc/os-release": "NAME=\"Ubuntu\"\nVERSION=\"16.04 LTS (Xenial Xerus)\"\nID=ubuntu\nID_LIKE=debian\nPRETTY_NAME=\"Ubuntu 16.04 LTS\"\nVERSION_ID=\"16.04\"\nHOME_URL=\"http://www.ubuntu.com/\"\nSUPPORT_URL=\"http://help.ubuntu.com/\"\nBUG_REPORT_URL=\"http://bugs.launchpad.net/ubuntu/\"\nUBUNTU_CODENAME=xenial\n", + "/etc/lsb-release": "DISTRIB_ID=Ubuntu\nDISTRIB_RELEASE=16.04\nDISTRIB_CODENAME=xenial\nDISTRIB_DESCRIPTION=\"Ubuntu 16.04 LTS\"\n" + }, + "name": "Ubuntu 16.04", + "result": { + "distribution_release": "xenial", + "distribution": "Ubuntu", + "distribution_major_version": "16", + "os_family": "Debian", + "distribution_version": "16.04" + } +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/ubuntu_18.04.json b/test/units/module_utils/facts/system/distribution/fixtures/ubuntu_18.04.json new file mode 100644 index 0000000..12d15b5 --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/ubuntu_18.04.json @@ -0,0 +1,39 @@ +{ + "name": "Ubuntu 18.04", + "distro": { + "codename": "bionic", + "id": "ubuntu", + "name": "Ubuntu", + "version": "18.04", + "version_best": "18.04.3", + "lsb_release_info": {}, + "os_release_info": { + "name": "Ubuntu", + "version": "18.04.3 LTS (Bionic Beaver)", + "id": "ubuntu", + "id_like": "debian", + "pretty_name": "Ubuntu 18.04.3 LTS", + "version_id": "18.04", + "home_url": "https://www.ubuntu.com/", + "support_url": "https://help.ubuntu.com/", + "bug_report_url": "https://bugs.launchpad.net/ubuntu/", + "privacy_policy_url": "https://www.ubuntu.com/legal/terms-and-policies/privacy-policy", + "version_codename": "bionic", + "ubuntu_codename": "bionic", + "codename": "bionic" + } + }, + "input": { + "/etc/os-release": "NAME=\"Ubuntu\"\nVERSION=\"18.04.3 LTS (Bionic Beaver)\"\nID=ubuntu\nID_LIKE=debian\nPRETTY_NAME=\"Ubuntu 18.04.3 LTS\"\nVERSION_ID=\"18.04\"\nHOME_URL=\"https://www.ubuntu.com/\"\nSUPPORT_URL=\"https://help.ubuntu.com/\"\nBUG_REPORT_URL=\"https://bugs.launchpad.net/ubuntu/\"\nPRIVACY_POLICY_URL=\"https://www.ubuntu.com/legal/terms-and-policies/privacy-policy\"\nVERSION_CODENAME=bionic\nUBUNTU_CODENAME=bionic\n", + "/etc/lsb-release": "DISTRIB_ID=Ubuntu\nDISTRIB_RELEASE=18.04\nDISTRIB_CODENAME=bionic\nDISTRIB_DESCRIPTION=\"Ubuntu 18.04.3 LTS\"\n", + "/usr/lib/os-release": "NAME=\"Ubuntu\"\nVERSION=\"18.04.3 LTS (Bionic Beaver)\"\nID=ubuntu\nID_LIKE=debian\nPRETTY_NAME=\"Ubuntu 18.04.3 LTS\"\nVERSION_ID=\"18.04\"\nHOME_URL=\"https://www.ubuntu.com/\"\nSUPPORT_URL=\"https://help.ubuntu.com/\"\nBUG_REPORT_URL=\"https://bugs.launchpad.net/ubuntu/\"\nPRIVACY_POLICY_URL=\"https://www.ubuntu.com/legal/terms-and-policies/privacy-policy\"\nVERSION_CODENAME=bionic\nUBUNTU_CODENAME=bionic\n" + }, + "platform.dist": ["ubuntu", "18.04", "bionic"], + "result": { + "distribution": "Ubuntu", + "distribution_version": "18.04", + "distribution_release": "bionic", + "distribution_major_version": "18", + "os_family": "Debian" + } +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/fixtures/uos_20.json b/test/units/module_utils/facts/system/distribution/fixtures/uos_20.json new file mode 100644 index 0000000..d51f62d --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/uos_20.json @@ -0,0 +1,29 @@ +{ + "name": "Uos 20", + "distro": { + "codename": "fou", + "id": "Uos", + "name": "Uos", + "version": "20", + "version_best": "20", + "os_release_info": {}, + "lsb_release_info": {} + }, + "input": { + "/etc/os-release": "PRETTY_NAME=\"UnionTech OS Server 20\"\nNAME=\"UnionTech OS Server 20\"\nVERSION_ID=\"20\"\nVERSION=\"20\"\nID=UOS\nHOME_URL=\"https://www.chinauos.com/\"\nBUG_REPORT_URL=\"https://bbs.chinauos.com/\"\nVERSION_CODENAME=fou", + "/etc/lsb-release": "DISTRIB_ID=uos\nDISTRIB_RELEASE=20\nDISTRIB_DESCRIPTION=\"UnionTech OS Server 20\"\nDISTRIB_CODENAME=fou\n", + "/usr/lib/os-release": "PRETTY_NAME=\"UnionTech OS Server 20\"\nNAME=\"UnionTech OS Server 20\"\nVERSION_ID=\"20\"\nVERSION=\"20\"\nID=UOS\nHOME_URL=\"https://www.chinauos.com/\"\nBUG_REPORT_URL=\"https://bbs.chinauos.com/\"\nVERSION_CODENAME=fou" + }, + "platform.dist": [ + "uos", + "20", + "fou" + ], + "result": { + "distribution": "Uos", + "distribution_version": "20", + "distribution_release": "fou", + "distribution_major_version": "20", + "os_family": "Debian" + } +} diff --git a/test/units/module_utils/facts/system/distribution/fixtures/virtuozzo_7.3.json b/test/units/module_utils/facts/system/distribution/fixtures/virtuozzo_7.3.json new file mode 100644 index 0000000..d9c2f47 --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/fixtures/virtuozzo_7.3.json @@ -0,0 +1,25 @@ +{ + "name": "Virtuozzo 7.3", + "platform.dist": ["redhat", "7.3", ""], + "distro": { + "codename": "", + "id": "virtuozzo", + "name": "Virtuozzo Linux", + "version": "7.3", + "version_best": "7.3", + "os_release_info": {}, + "lsb_release_info": {} + }, + "input": { + "/etc/redhat-release": "Virtuozzo Linux release 7.3\n", + "/etc/os-release": "NAME=\"Virtuozzo\"\nVERSION=\"7.0.3\"\nID=\"virtuozzo\"\nID_LIKE=\"rhel fedora\"\nVERSION_ID=\"7\"\nPRETTY_NAME=\"Virtuozzo release 7.0.3\"\nANSI_COLOR=\"0;31\"\nCPE_NAME=\"cpe:/o:virtuozzoproject:vz:7\"\nHOME_URL=\"http://www.virtuozzo.com\"\nBUG_REPORT_URL=\"https://bugs.openvz.org/\"\n", + "/etc/system-release": "Virtuozzo release 7.0.3 (640)\n" + }, + "result": { + "distribution_release": "NA", + "distribution": "Virtuozzo", + "distribution_major_version": "7", + "os_family": "RedHat", + "distribution_version": "7.3" + } +}
\ No newline at end of file diff --git a/test/units/module_utils/facts/system/distribution/test_distribution_sles4sap.py b/test/units/module_utils/facts/system/distribution/test_distribution_sles4sap.py new file mode 100644 index 0000000..ab465ea --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/test_distribution_sles4sap.py @@ -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) diff --git a/test/units/module_utils/facts/system/distribution/test_distribution_version.py b/test/units/module_utils/facts/system/distribution/test_distribution_version.py new file mode 100644 index 0000000..a990274 --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/test_distribution_version.py @@ -0,0 +1,158 @@ +# -*- coding: utf-8 -*- +# Copyright: (c) 2017 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 glob +import json +import os +import pytest +from itertools import product + +from ansible.module_utils.six.moves import builtins + +# the module we are actually testing (sort of) +from ansible.module_utils.facts.system.distribution import DistributionFactCollector + +# to generate the testcase data, you can use the script gen_distribution_version_testcase.py in hacking/tests +TESTSETS = [] + +for datafile in glob.glob(os.path.join(os.path.dirname(__file__), 'fixtures/*.json')): + with open(os.path.join(os.path.dirname(__file__), '%s' % datafile)) as f: + TESTSETS.append(json.loads(f.read())) + + +@pytest.mark.parametrize("stdin, testcase", product([{}], TESTSETS), ids=lambda x: x.get('name'), indirect=['stdin']) +def test_distribution_version(am, mocker, testcase): + """tests the distribution parsing code of the Facts class + + testsets have + * a name (for output/debugging only) + * input files that are faked + * those should be complete and also include "irrelevant" files that might be mistaken as coming from other distributions + * all files that are not listed here are assumed to not exist at all + * the output of ansible.module_utils.distro.linux_distribution() [called platform.dist() for historical reasons] + * results for the ansible variables distribution* and os_family + + """ + + # prepare some mock functions to get the testdata in + def mock_get_file_content(fname, default=None, strip=True): + """give fake content if it exists, otherwise pretend the file is empty""" + data = default + if fname in testcase['input']: + # for debugging + print('faked %s for %s' % (fname, testcase['name'])) + data = testcase['input'][fname].strip() + if strip and data is not None: + data = data.strip() + return data + + def mock_get_file_lines(fname, strip=True): + """give fake lines if file exists, otherwise return empty list""" + data = mock_get_file_content(fname=fname, strip=strip) + if data: + return [data] + return [] + + def mock_get_uname(am, flags): + if '-v' in flags: + return testcase.get('uname_v', None) + elif '-r' in flags: + return testcase.get('uname_r', None) + else: + return None + + def mock_file_exists(fname, allow_empty=False): + if fname not in testcase['input']: + return False + + if allow_empty: + return True + return bool(len(testcase['input'][fname])) + + def mock_platform_system(): + return testcase.get('platform.system', 'Linux') + + def mock_platform_release(): + return testcase.get('platform.release', '') + + def mock_platform_version(): + return testcase.get('platform.version', '') + + def mock_distro_name(): + return testcase['distro']['name'] + + def mock_distro_id(): + return testcase['distro']['id'] + + def mock_distro_version(best=False): + if best: + return testcase['distro']['version_best'] + return testcase['distro']['version'] + + def mock_distro_codename(): + return testcase['distro']['codename'] + + def mock_distro_os_release_info(): + return testcase['distro']['os_release_info'] + + def mock_distro_lsb_release_info(): + return testcase['distro']['lsb_release_info'] + + def mock_open(filename, mode='r'): + if filename in testcase['input']: + file_object = mocker.mock_open(read_data=testcase['input'][filename]).return_value + file_object.__iter__.return_value = testcase['input'][filename].splitlines(True) + else: + file_object = real_open(filename, mode) + return file_object + + def mock_os_path_is_file(filename): + if filename in testcase['input']: + return True + return False + + def mock_run_command_output(v, command): + ret = (0, '', '') + if 'command_output' in testcase: + ret = (0, testcase['command_output'].get(command, ''), '') + return ret + + mocker.patch('ansible.module_utils.facts.system.distribution.get_file_content', mock_get_file_content) + mocker.patch('ansible.module_utils.facts.system.distribution.get_file_lines', mock_get_file_lines) + mocker.patch('ansible.module_utils.facts.system.distribution.get_uname', mock_get_uname) + mocker.patch('ansible.module_utils.facts.system.distribution._file_exists', mock_file_exists) + mocker.patch('ansible.module_utils.distro.name', mock_distro_name) + mocker.patch('ansible.module_utils.distro.id', mock_distro_id) + mocker.patch('ansible.module_utils.distro.version', mock_distro_version) + mocker.patch('ansible.module_utils.distro.codename', mock_distro_codename) + mocker.patch( + 'ansible.module_utils.common.sys_info.distro.os_release_info', + mock_distro_os_release_info) + mocker.patch( + 'ansible.module_utils.common.sys_info.distro.lsb_release_info', + mock_distro_lsb_release_info) + mocker.patch('os.path.isfile', mock_os_path_is_file) + mocker.patch('platform.system', mock_platform_system) + mocker.patch('platform.release', mock_platform_release) + mocker.patch('platform.version', mock_platform_version) + mocker.patch('ansible.module_utils.basic.AnsibleModule.run_command', mock_run_command_output) + + real_open = builtins.open + mocker.patch.object(builtins, 'open', new=mock_open) + + # run Facts() + distro_collector = DistributionFactCollector() + generated_facts = distro_collector.collect(am) + + # compare with the expected output + + # testcase['result'] has a list of variables and values it expects Facts() to set + for key, val in testcase['result'].items(): + assert key in generated_facts + msg = 'Comparing value of %s on %s, should: %s, is: %s' %\ + (key, testcase['name'], val, generated_facts[key]) + assert generated_facts[key] == val, msg diff --git a/test/units/module_utils/facts/system/distribution/test_parse_distribution_file_ClearLinux.py b/test/units/module_utils/facts/system/distribution/test_parse_distribution_file_ClearLinux.py new file mode 100644 index 0000000..c095756 --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/test_parse_distribution_file_ClearLinux.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019 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 os +import pytest + +from ansible.module_utils.facts.system.distribution import DistributionFiles + + +@pytest.fixture +def test_input(): + return { + 'name': 'Clearlinux', + 'path': '/usr/lib/os-release', + 'collected_facts': None, + } + + +def test_parse_distribution_file_clear_linux(mock_module, test_input): + test_input['data'] = open(os.path.join(os.path.dirname(__file__), '../../fixtures/distribution_files/ClearLinux')).read() + + result = ( + True, + { + 'distribution': 'Clear Linux OS', + 'distribution_major_version': '28120', + 'distribution_release': 'clear-linux-os', + 'distribution_version': '28120' + } + ) + + distribution = DistributionFiles(module=mock_module()) + assert result == distribution.parse_distribution_file_ClearLinux(**test_input) + + +@pytest.mark.parametrize('distro_file', ('CoreOS', 'LinuxMint')) +def test_parse_distribution_file_clear_linux_no_match(mock_module, distro_file, test_input): + """ + Test against data from Linux Mint and CoreOS to ensure we do not get a reported + match from parse_distribution_file_ClearLinux() + """ + test_input['data'] = open(os.path.join(os.path.dirname(__file__), '../../fixtures/distribution_files', distro_file)).read() + + result = (False, {}) + + distribution = DistributionFiles(module=mock_module()) + assert result == distribution.parse_distribution_file_ClearLinux(**test_input) diff --git a/test/units/module_utils/facts/system/distribution/test_parse_distribution_file_Slackware.py b/test/units/module_utils/facts/system/distribution/test_parse_distribution_file_Slackware.py new file mode 100644 index 0000000..53fd4ea --- /dev/null +++ b/test/units/module_utils/facts/system/distribution/test_parse_distribution_file_Slackware.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2019 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 os +import pytest + +from ansible.module_utils.facts.system.distribution import DistributionFiles + + +@pytest.mark.parametrize( + ('distro_file', 'expected_version'), + ( + ('Slackware', '14.1'), + ('SlackwareCurrent', '14.2+'), + ) +) +def test_parse_distribution_file_slackware(mock_module, distro_file, expected_version): + test_input = { + 'name': 'Slackware', + 'data': open(os.path.join(os.path.dirname(__file__), '../../fixtures/distribution_files', distro_file)).read(), + 'path': '/etc/os-release', + 'collected_facts': None, + } + + result = ( + True, + { + 'distribution': 'Slackware', + 'distribution_version': expected_version + } + ) + distribution = DistributionFiles(module=mock_module()) + assert result == distribution.parse_distribution_file_Slackware(**test_input) |