2016-04-14 18:26:00 +02:00
# -*- coding: utf-8 -*-
2017-12-05 21:43:13 +01:00
# Copyright: (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
2016-04-14 18:26:00 +02:00
2017-12-05 21:43:13 +01:00
from __future__ import absolute_import , division , print_function
2016-04-14 18:26:00 +02:00
__metaclass__ = type
2017-12-05 21:43:13 +01:00
from itertools import product
2016-04-14 18:26:00 +02:00
2017-02-08 21:41:47 +01:00
import pytest
2016-04-14 18:26:00 +02:00
2018-12-11 02:04:14 +01:00
from ansible . module_utils . six . moves import builtins
2017-12-05 21:43:13 +01:00
# the module we are actually testing (sort of)
Facts Refresh (2.4 roadmap) (#23012)
Facts Refresh (2.4 roadmap)
This commit implements most of the 2.4 roadmap 'Facts Refresh'
- move facts.py to facts/__init__.py
- move facts Distribution() to its own class
- add a facts/utils.py
- move get_file_content and get_uname_version to facts/utils.py
- move Facts() class from facts/__init__ to facts/facts.py
- mv get_file_lines to facts/utils.py
- mv Ohai()/Facter() class to facts/ohai.py and facter.py
- Start moving fact Hardware() classes to facts/hardware/*.py
- mv HPUX() hardware class to facts/hardware/hpux.py
- move SunOSHardware() fact class to facts/hardware/sunos.py
- move OpenBSDHardware() class to facts/hardware/openbsd.py
- mv FreeBsdHardware() and DragonFlyHardware() to facts/hardware/
- mv NetBSDHardware() to facts/hardware/netbsd.py
- mv Darwin() hardware class to facts/hardware/darwin.py
- pep8/etc cleanups on facts/hardware/*.py
- Mv network facts classes to facts/network/*.py
- mv Virtual fact classes to facts/virtual
- mv Hardware.get_sysctl to facts/sysctl.py:get_sysctl
- Also mv get_uname_version from facts/utils.py -> distribution.py
since distribution.py is the only thing using it.
- add collector.py with new BaseFactCollector
- add a subclass for AnsibleFactCollector
- hook up dict key munging FactNamespaces
- add some test cases for testing the names of facts
- mv timeout stuff to facts.timeout
- rm ansible_facts()/get_all_facts() etc
- Instead of calling facts.ansible_facts(), fact collection
api used by setup.py is now to create an AnsibleFactCollector()
and call it's collect method.
- replace Facts.get_user_facts with UserFactCollector
- add a 'systems' facts package, mv UserFactCollector there
- mv get_dns_facts to DnsFactCollector
- mv get_env_facts to EnvFactCollector
- include the timeout length in exception message
- modules and module_utils that use AnsibleFactCollector
can now theoretically set the 'valid_subsets'
May be useful for network facts module that currently have
to reimplement a good chunk of facts.py to get gather_subsets
to work.
- get_local_facts -> system/LocalFactCollector
- get_date_time -> system/date_time.py
- get_fips_facts -> system/fips.py
- get_caps_facts() -> system/caps.py
- get_apparmor_facts -> system/apparmor.py
- get_selinux_facts -> system/selinux.py
- get_lsb_facts -> system/lsb.py
- get_service_mgr_facts -> system/service_mgr.py
- Facts.is_systemd_managed -> system/service_mgr.py
- get_pkg_mgr_facts -> system/pkg_mgr.py
- Facts()._get_mount_size_facts() -> facts.utils.get_mount_size()
- add unit test for EnvFactCollector
- add a test case for minimal gather_subsets
- add test case for collect_ids
- Make gather_subset match existing behavior or '!all'
If 'gather_subset' is provided as '!all', the existing behavior
(in 2.2/2.3) is that means 'dont collect any facts except those
from the Facts() class'. So 'skip everything except
'apparmor', 'caps', 'date_time', 'env', 'fips', 'local', 'lsb',
'pkg_mgr', 'python', 'selinux', 'service_mgr', 'user', 'platform', etc.
The new facts setup was making '!all' mean no facts at all, since
it can add/exclude at a finer granularity. Since that makes more
sense for the ansible collector, and the set of minimal facts to
collect is really more up to setup.py to decide we do just that.
So if setup.py needs to always collect some gather_subset, even
on !all, setup.py needs to have the that subset added to the
list it passes as minimal_gather_subset.
This should fix some intg tests that assume '!all' means that
some facts are still collected (user info and env for example).
If we want to make setup.py collect a more minimal set, we can do that.
- force facts_dicts.keys() to a list so py3 works
- split fact collector tests to test_collectors.py
- convert Facter(Facts) -> other/facter.py:FacterFactCollector
- add FactCollector.collect_with_namespace()
regular .collect() will return a dict with the key names
using the base names ('ip_address', 'service_mgr' etc)
.collect_with_namespace() will return a dict where the key names
have been transformed with the collectors namespace, if there is
one. For most, this means a namespace that adds 'ansible_' to the
start of the key name.
For 'FacterFactCollector', the namespace transforms the key to
'facter_*'.
- add test cases for collect_with_namespace
- move all the concrete 'which facts does setup.py' stuff to setup.py
The caller of AnsibleFactCollector.from_gather_subset() needs to
pass in the list of collector classes now.
- update system/setup.py to import all of the fact classes and pass
in that list.
- split the Distribution fact class up a bit
extracted the 'distro release' file handling (ie, linux
boxes with /etc/release, /etc/os-release etc) into its
own class.
- extract get_cmdline_facts -> cmdline.py
- extract get_public_ssh_host_keys -> system/ssh_pub_keys.py
- extract get_platform_facts -> system/platform.py
platform.py may be a good candidate for further splitting.
- rm test for plain Facts() base class
- let the base class for Collector unit tests provide collected_facts
some Collectors and/or their migrated Facts() subsclasses need
to look at facts collected by other modules ('ansible_architecture'
the main one...).
Collector.collect() has the collected_facts arg for this, so add
a class variable to BaseFactsTest so we can specify it.
- mv Ohai to other/ohai.py and convert to Collector
- update hardware/*.py to return facts (no side effects)
- mv AnsibleFactCollector to setup.py
- extra collector class gathering to module method in
facts/__init__.py (collector_classes_from_gather_subset)
- add a CollectorMetaDataCollector collector used to provide
the 'gather_setup' fact
- add unit test module for 'setup' module
(test/units/modules/system/setup.py)
- Collector init now doesnt need a module, but collect does
An instance of a FactCollector() isnt tied to a AnsibleModule
instance, but the collect() method can be, so optionally pass
in module to FactCollector.collect() (everywhere)
- add a default_collectors for list of default collectors
import and use it from setup.py module
eventually, would like to replace this with a plugin loader
style class finder/loader
- unit tests for module_utils/facts/__init__.py
- add unit tests for ohai facts collector
- remove self.facts side effect on populate() in hardware/sunos.py
- convert OpenBSDHardware() to rm side effects on self.facts
- try to rm some self.facts side effects in Network()
plumb in collected_facts from populate() where it is needed.
stop passing collected_facts into Network() [via cached_facts=,
where it eventually becomes self.facts]
- nothing provides Fact() cached_facts arg now, rm it
Facts() should be internal only implementation so nothing
should be using it.
Of course, now someone will.
- add a Collector.name attr to build a map of name->_fact_ids
To properly exclude a gather_subset spec like '!hardware', we
need to know that 'hardware' also means 'devices', 'dmi', etc.
Before, '!hardware' would remove the 'hardware' collector name
but not 'devices'. Since both would end up in id_collector_map,
we would still end up with the HardwareCollector in the collector
list. End result being that '!hardware' wouldn't stop hardware
from being collected.
So we need to be able to build that map, so add the Collector.name
attribute that is the primary name (like 'hardware') and let
Collector._fact_ids be the other fact ids that a collector is
responsible for.
Construct the aliases_map of Collector.name -> set of _fact_ids
in fact/__init__.py get_collector_names, and use it when we are
populating the exclude set.
- refactor of distribution.py
make the big OS_FAMILY literal a little easier to read
Also keys can now be any string instead of python literals
99% sure the test for 'KDE Neon' was wrong
I don't see how/where it should or could get 'Neon' instead
of 'KDE Neon' as provided in os-release NAME=
Use 'distribution' string for key to OS_MAP
ie, we dont need to make it a valid python label anymore so dont.
move _has_dist_file to module as _file_exists
easier to mock without mucking with os.path
mv platform.system() calls to within get_distribution_facts() instead
of Distribution() init.
- remove _json compat module
The code in here was to support:
-a 'json' python module that was not the standard one included
with python since 2.6.
- potentially fallback to simplejson if 'json' was not available.
'json' is available for all supported python versions now so
no longer needed.
- mv get_collector_names -> facts.collector
- mv collector_classes_from_gather_subset -> facts.collector
- mv collector tests from test_facts -> test_collector
- Use six's reduce() in sunos/netbsd hardware facts
- rm extraneous get_uname_version in utils
only system/distribution.py uses it
- Remove Facts() subclass metaclass usage
- using fact_id and a platform id for matching collectors
gut most of Facts() subclasses
rm Facts() subclasses with weird metaclass
only add collectors that match the fact_ids and the platform_info
to the list of collectors used.
atm, a collectors platform_id will default to 'Generic', and
any platform matches 'Generic'
goal is to select collector classes including matching the
systems platform in collector.py, instead of relying on
metaclasses in hardware/*. To finish this, the various
Facts() subclasses will need to be replaced entirely with
Collector() subclasses.
use collector classmethod platform_match() to match the platform
This lets the particular class decide if it is compatible with
a given platform_info. platform_info is a dict like obj, so it could be
expanded in the future.
Add a default platform_match to BaseFactCollector that matches
platform_info['system'] == cls._platform
They were needed previously to trigger a module
load on all the collector classes when we import
facts/hardare so that the Hardware() and related
classes that used __new__ and find_all_subclasses()
would work.
Now that is done in collectors based on platform matching
at runtime we dont need to do it py module import/parse
time. So the non empty __init__.pys are no longer needed
and their is a more flexible mechanism for selection
platform specific stuff.
facts/facts.py is no longer used, rm'ed
- if we dont find an implement class for gather spec.. just ignore it.
Would be useful to add a warn to warn about this case.
- Fix SD-UX typo (should be HP-UX)
- Port fix for #21893 (0 sockets) to this branch
This readds the change from 8ad182059d5a085e4f8ecfe8ae63bad14a7dc01c
that got lost in merge/rebase
Fixes #21893
- port sunos fact locale fix for #24542 to this branch
based on e558ec19cd1fd9d00e299cf1938d4ca3cec85cda
Fixes #24542
Solaris fact fix (#24793)
ensure locale for solaris fact gathering
fixes issue with locale interfering with proper reading of decimals
- raise exceptions in the air like we just dont care.
Pretty much ignore any not exit exception in facts
collection. And add some test cases.
- added new selinux fact to clarify python lib
the selinux fact is boolean false when the library is not installed,
a dictionary/hash otherwise, but this is ambigous
added new fact so we can eventually remove the type dichtomy and normalize it as a dict
Re-add of devel commit 85c7a7b844bf429fc9cc0ffce5dd9bf05ed47b5a to
the new code layout, since it got removed in merge/rebase
2017-06-01 17:17:49 +02:00
from ansible . module_utils . facts . system . distribution import DistributionFactCollector
2016-04-14 18:26:00 +02:00
2017-12-05 21:43:13 +01:00
2016-04-14 19:44:06 +02:00
# to generate the testcase data, you can use the script gen_distribution_version_testcase.py in hacking/tests
TESTSETS = [
{
2017-01-29 08:28:53 +01:00
" platform.dist " : [
" centos " ,
" 7.2.1511 " ,
" Core "
2017-05-30 19:05:19 +02:00
] ,
2019-06-29 01:21:35 +02:00
' distro ' : {
' codename ' : ' Core ' ,
' id ' : ' centos ' ,
' name ' : ' CentOS Linux ' ,
' version ' : ' 7 ' ,
' version_best ' : ' 7.2.1511 ' ,
2020-02-11 22:46:48 +01:00
" lsb_release_info " : {
" release " : " 7.2.1511 " ,
" codename " : " Core " ,
" distributor_id " : " CentOS " ,
" lsb_version " : " :core-4.1-amd64:core-4.1-noarch " ,
" description " : " CentOS Linux release 7.2.1511 (Core) "
} ,
" os_release_info " : {
" name " : " CentOS Linux " ,
" ansi_color " : " 0;31 " ,
" id_like " : " rhel fedora " ,
" version_id " : " 7 " ,
" bug_report_url " : " https://bugs.centos.org/ " ,
" centos_mantisbt_project " : " CentOS-7 " ,
" pretty_name " : " CentOS Linux 7 (Core) " ,
" version " : " 7 (Core) " ,
" redhat_support_product_version " : " 7 " ,
" centos_mantisbt_project_version " : " 7 " ,
" redhat_support_product " : " centos " ,
" home_url " : " https://www.centos.org/ " ,
" cpe_name " : " cpe:/o:centos:centos:7 " ,
" id " : " centos " ,
" codename " : " Core "
} ,
2019-06-29 01:21:35 +02:00
} ,
2017-01-29 08:28:53 +01:00
" input " : {
" /etc/redhat-release " : " CentOS Linux release 7.2.1511 (Core) \n " ,
2017-05-30 19:05:19 +02:00
" /etc/os-release " : (
" NAME= \" CentOS Linux \" \n VERSION= \" 7 (Core) \" \n ID= \" centos \" \n ID_LIKE= \" rhel fedora \" \n VERSION_ID= \" 7 \" \n "
" PRETTY_NAME= \" CentOS Linux 7 (Core) \" \n ANSI_COLOR= \" 0;31 \" \n CPE_NAME= \" cpe:/o:centos:centos:7 \" \n "
" HOME_URL= \" https://www.centos.org/ \" \n BUG_REPORT_URL= \" https://bugs.centos.org/ \" \n \n CENTOS_MANTISBT_PROJECT= \" CentOS-7 \" \n "
" CENTOS_MANTISBT_PROJECT_VERSION= \" 7 \" \n REDHAT_SUPPORT_PRODUCT= \" centos \" \n REDHAT_SUPPORT_PRODUCT_VERSION= \" 7 \" \n \n "
) ,
2017-01-29 08:28:53 +01:00
" /etc/system-release " : " CentOS Linux release 7.2.1511 (Core) \n "
2017-05-30 19:05:19 +02:00
} ,
2017-01-29 08:28:53 +01:00
" name " : " CentOS 7.2.1511 " ,
" result " : {
" distribution_release " : " Core " ,
" distribution " : " CentOS " ,
" distribution_major_version " : " 7 " ,
" os_family " : " RedHat " ,
2019-06-29 01:21:35 +02:00
" distribution_version " : " 7.2 " ,
2017-05-30 19:05:19 +02:00
}
} ,
2016-04-29 22:18:50 +02:00
{
2017-01-29 08:28:53 +01:00
" name " : " CentOS 6.7 " ,
" platform.dist " : [
" centos " ,
" 6.7 " ,
" Final "
2017-05-30 19:05:19 +02:00
] ,
2019-06-29 01:21:35 +02:00
' distro ' : {
' codename ' : ' Final ' ,
' id ' : ' centos ' ,
' name ' : ' CentOS Linux ' ,
' version ' : ' 6.7 ' ,
' version_best ' : ' 6.7 ' ,
2020-02-11 22:46:48 +01:00
' 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) '
} ,
2019-06-29 01:21:35 +02:00
} ,
2017-01-29 08:28:53 +01:00
" input " : {
" /etc/redhat-release " : " CentOS release 6.7 (Final) \n " ,
2017-05-30 19:05:19 +02:00
" /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 "
) ,
2017-01-29 08:28:53 +01:00
" /etc/system-release " : " CentOS release 6.7 (Final) \n "
2017-05-30 19:05:19 +02:00
} ,
2017-01-29 08:28:53 +01:00
" result " : {
" distribution_release " : " Final " ,
" distribution " : " CentOS " ,
" distribution_major_version " : " 6 " ,
" os_family " : " RedHat " ,
" distribution_version " : " 6.7 "
2017-05-30 19:05:19 +02:00
}
} ,
2020-02-11 22:46:48 +01:00
{
" 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 \" \n VERSION= \" 7.7 (Maipo) \" \n ID= \" rhel \" \n ID_LIKE= \" fedora \" \n VARIANT= \" Server \" \n VARIANT_ID= \" server \" \n VERSION_ID= \" 7.7 \" \n PRETTY_NAME= \" Red Hat Enterprise Linux Server 7.7 (Maipo) \" \n ANSI_COLOR= \" 0;31 \" \n CPE_NAME= \" cpe:/o:redhat:enterprise_linux:7.7:GA:server \" \n HOME_URL= \" https://www.redhat.com/ \" \n BUG_REPORT_URL= \" https://bugzilla.redhat.com/ \" \n \n REDHAT_BUGZILLA_PRODUCT= \" Red Hat Enterprise Linux 7 \" \n REDHAT_BUGZILLA_PRODUCT_VERSION=7.7 \n REDHAT_SUPPORT_PRODUCT= \" Red Hat Enterprise Linux \" \n REDHAT_SUPPORT_PRODUCT_VERSION= \" 7.7 \" \n " # noqa
} ,
" platform.dist " : [
" rhel " ,
" 7.7 " ,
" Maipo "
] ,
" result " : {
" distribution " : " RedHat " ,
" distribution_version " : " 7.7 " ,
" distribution_release " : " Maipo " ,
" distribution_major_version " : " 7 " ,
" os_family " : " RedHat "
}
} ,
2017-01-29 08:28:53 +01:00
{
" name " : " RedHat 7.2 " ,
" platform.dist " : [
" redhat " ,
" 7.2 " ,
" Maipo "
2017-05-30 19:05:19 +02:00
] ,
2019-06-29 01:21:35 +02:00
' distro ' : {
' codename ' : ' Maipo ' ,
' id ' : ' rhel ' ,
' name ' : ' RedHat Enterprise Linux ' ,
' version ' : ' 7.2 ' ,
' version_best ' : ' 7.2 ' ,
2020-02-11 22:46:48 +01:00
' os_release_info ' : { } ,
' lsb_release_info ' : { } ,
2019-06-29 01:21:35 +02:00
} ,
2017-01-29 08:28:53 +01:00
" input " : {
" /etc/redhat-release " : " Red Hat Enterprise Linux Server release 7.2 (Maipo) \n " ,
2017-05-30 19:05:19 +02:00
" /etc/os-release " : (
" NAME= \" Red Hat Enterprise Linux Server \" \n VERSION= \" 7.2 (Maipo) \" \n ID= \" rhel \" \n ID_LIKE= \" fedora \" \n VERSION_ID= \" 7.2 \" \n "
" PRETTY_NAME= \" Red Hat Enterprise Linux Server 7.2 (Maipo) \" \n ANSI_COLOR= \" 0;31 \" \n "
" CPE_NAME= \" cpe:/o:redhat:enterprise_linux:7.2:GA:server \" \n HOME_URL= \" https://www.redhat.com/ \" \n "
" BUG_REPORT_URL= \" https://bugzilla.redhat.com/ \" \n \n REDHAT_BUGZILLA_PRODUCT= \" Red Hat Enterprise Linux 7 \" \n "
" REDHAT_BUGZILLA_PRODUCT_VERSION=7.2 \n REDHAT_SUPPORT_PRODUCT= \" Red Hat Enterprise Linux \" \n "
" REDHAT_SUPPORT_PRODUCT_VERSION= \" 7.2 \" \n "
) ,
2017-01-29 08:28:53 +01:00
" /etc/system-release " : " Red Hat Enterprise Linux Server release 7.2 (Maipo) \n "
2017-05-30 19:05:19 +02:00
} ,
2017-01-29 08:28:53 +01:00
" result " : {
" distribution_release " : " Maipo " ,
" distribution " : " RedHat " ,
" distribution_major_version " : " 7 " ,
" os_family " : " RedHat " ,
" distribution_version " : " 7.2 "
2017-05-30 19:05:19 +02:00
}
} ,
2017-01-29 08:28:53 +01:00
{
" name " : " RedHat 6.7 " ,
" platform.dist " : [
" redhat " ,
" 6.7 " ,
" Santiago "
2017-05-30 19:05:19 +02:00
] ,
2019-06-29 01:21:35 +02:00
' distro ' : {
' codename ' : ' Santiago ' ,
' id ' : ' rhel ' ,
' name ' : ' RedHat Enterprise Linux ' ,
' version ' : ' 6.7 ' ,
' version_best ' : ' 6.7 ' ,
2020-02-11 22:46:48 +01:00
' os_release_info ' : { } ,
' lsb_release_info ' : { } ,
2019-06-29 01:21:35 +02:00
} ,
2017-01-29 08:28:53 +01:00
" input " : {
" /etc/redhat-release " : " Red Hat Enterprise Linux Server release 6.7 (Santiago) \n " ,
2017-05-30 19:05:19 +02:00
" /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 "
) ,
2017-01-29 08:28:53 +01:00
" /etc/system-release " : " Red Hat Enterprise Linux Server release 6.7 (Santiago) \n "
2017-05-30 19:05:19 +02:00
} ,
2017-01-29 08:28:53 +01:00
" result " : {
" distribution_release " : " Santiago " ,
" distribution " : " RedHat " ,
" distribution_major_version " : " 6 " ,
" os_family " : " RedHat " ,
" distribution_version " : " 6.7 "
2017-05-30 19:05:19 +02:00
}
} ,
2017-03-28 12:24:54 +02:00
{
" name " : " Virtuozzo 7.3 " ,
" platform.dist " : [
" redhat " ,
" 7.3 " ,
" "
2017-05-30 19:05:19 +02:00
] ,
2019-06-29 01:21:35 +02:00
' distro ' : {
' codename ' : ' ' ,
' id ' : ' virtuozzo ' ,
' name ' : ' Virtuozzo Linux ' ,
' version ' : ' 7.3 ' ,
' version_best ' : ' 7.3 ' ,
2020-02-11 22:46:48 +01:00
' os_release_info ' : { } ,
' lsb_release_info ' : { } ,
2019-06-29 01:21:35 +02:00
} ,
2017-03-28 12:24:54 +02:00
" input " : {
" /etc/redhat-release " : " Virtuozzo Linux release 7.3 \n " ,
2017-05-30 19:05:19 +02:00
" /etc/os-release " : (
" NAME= \" Virtuozzo \" \n "
" VERSION= \" 7.0.3 \" \n "
" ID= \" virtuozzo \" \n "
" ID_LIKE= \" rhel fedora \" \n "
" VERSION_ID= \" 7 \" \n "
" PRETTY_NAME= \" Virtuozzo release 7.0.3 \" \n "
" ANSI_COLOR= \" 0;31 \" \n "
" CPE_NAME= \" cpe:/o:virtuozzoproject:vz:7 \" \n "
" HOME_URL= \" http://www.virtuozzo.com \" \n "
" BUG_REPORT_URL= \" https://bugs.openvz.org/ \" \n "
) ,
2017-03-28 12:24:54 +02:00
" /etc/system-release " : " Virtuozzo release 7.0.3 (640) \n "
2017-05-30 19:05:19 +02:00
} ,
2017-03-28 12:24:54 +02:00
" result " : {
" distribution_release " : " NA " ,
" distribution " : " Virtuozzo " ,
" distribution_major_version " : " 7 " ,
" os_family " : " RedHat " ,
" distribution_version " : " 7.3 "
2017-05-30 19:05:19 +02:00
}
} ,
2016-04-29 22:18:50 +02:00
{
2017-05-30 19:05:19 +02:00
" name " : " openSUSE Leap 42.1 " ,
2016-04-14 19:44:06 +02:00
" input " : {
2019-06-29 01:21:35 +02:00
" /etc/os-release " : (
' NAME= " openSUSE Leap " \n VERSION= " 42.1 " \n VERSION_ID= " 42.1 " \n PRETTY_NAME= " openSUSE Leap 42.1 (x86_64) " \n ID=opensuse \n '
' ANSI_COLOR= " 0;32 " \n CPE_NAME= " cpe:/o:opensuse:opensuse:42.1 " \n BUG_REPORT_URL= " https://bugs.opensuse.org " \n '
' HOME_URL= " https://opensuse.org/ " \n ID_LIKE= " suse " ' ) ,
" /etc/SuSE-release " : (
' openSUSE 42.1 (x86_64) \n VERSION = 42.1 \n CODENAME = Malachite \n # /etc/SuSE-release is deprecated and will be removed in the future, '
' use /etc/os-release instead ' ) ,
2016-04-14 19:44:06 +02:00
} ,
" platform.dist " : [ ' SuSE ' , ' 42.1 ' , ' x86_64 ' ] ,
2019-06-29 01:21:35 +02:00
' distro ' : {
' codename ' : ' ' ,
' id ' : ' opensuse-leap ' ,
' name ' : ' openSUSE Leap ' ,
' version ' : ' 42.1 ' ,
' version_best ' : ' 42.1 ' ,
2020-02-11 22:46:48 +01:00
' os_release_info ' : { } ,
' lsb_release_info ' : { } ,
2019-06-29 01:21:35 +02:00
} ,
2017-05-30 19:05:19 +02:00
" result " : {
2016-04-14 19:44:06 +02:00
" distribution " : " openSUSE Leap " ,
" distribution_major_version " : " 42 " ,
2017-02-27 21:01:02 +01:00
" distribution_release " : " 1 " ,
2016-09-17 23:27:35 +02:00
" os_family " : " Suse " ,
2016-04-14 19:44:06 +02:00
" distribution_version " : " 42.1 " ,
}
} ,
2020-02-11 22:46:48 +01:00
{
" 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 \" \n VERSION= \" 15.1 \" \n ID= \" opensuse-leap \" \n ID_LIKE= \" suse opensuse \" \n VERSION_ID= \" 15.1 \" \n PRETTY_NAME= \" openSUSE Leap 15.1 \" \n ANSI_COLOR= \" 0;32 \" \n CPE_NAME= \" cpe:/o:opensuse:leap:15.1 \" \n BUG_REPORT_URL= \" https://bugs.opensuse.org \" \n HOME_URL= \" https://www.opensuse.org/ \" \n " , # noqa
" /usr/lib/os-release " : " NAME= \" openSUSE Leap \" \n VERSION= \" 15.1 \" \n ID= \" opensuse-leap \" \n ID_LIKE= \" suse opensuse \" \n VERSION_ID= \" 15.1 \" \n PRETTY_NAME= \" openSUSE Leap 15.1 \" \n ANSI_COLOR= \" 0;32 \" \n CPE_NAME= \" cpe:/o:opensuse:leap:15.1 \" \n BUG_REPORT_URL= \" https://bugs.opensuse.org \" \n HOME_URL= \" https://www.opensuse.org/ \" \n " # noqa
} ,
" platform.dist " : [
" opensuse-leap " ,
" 15.1 " ,
" "
] ,
" result " : {
" distribution " : " openSUSE Leap " ,
" distribution_version " : " 15.1 " ,
" distribution_release " : " 1 " ,
" distribution_major_version " : " 15 " ,
" os_family " : " Suse "
}
} ,
2017-01-28 10:39:40 +01:00
{
2016-04-14 19:44:06 +02:00
' name ' : ' openSUSE 13.2 ' ,
2017-05-30 19:05:19 +02:00
' input ' : {
2019-06-29 01:21:35 +02:00
' /etc/SuSE-release ' : (
' openSUSE 13.2 (x86_64) \n VERSION = 13.2 \n CODENAME = Harlequin \n '
' # /etc/SuSE-release is deprecated and will be removed in the future, use /etc/os-release instead ' ) ,
' /etc/os-release ' : (
' NAME=openSUSE \n VERSION= " 13.2 (Harlequin) " \n VERSION_ID= " 13.2 " \n PRETTY_NAME= " openSUSE 13.2 (Harlequin) (x86_64) " \n ID=opensuse \n '
' ANSI_COLOR= " 0;32 " \n CPE_NAME= " cpe:/o:opensuse:opensuse:13.2 " \n BUG_REPORT_URL= " https://bugs.opensuse.org " \n '
' HOME_URL= " https://opensuse.org/ " \n ID_LIKE= " suse " ' ) ,
2017-05-30 19:05:19 +02:00
} ,
2016-04-14 19:44:06 +02:00
' platform.dist ' : ( ' SuSE ' , ' 13.2 ' , ' x86_64 ' ) ,
2019-06-29 01:21:35 +02:00
' distro ' : {
' codename ' : ' ' ,
' id ' : ' opensuse-harlequin ' ,
' name ' : ' openSUSE Harlequin ' ,
' version ' : ' 13.2 ' ,
' version_best ' : ' 13.2 ' ,
2020-02-11 22:46:48 +01:00
' os_release_info ' : { } ,
' lsb_release_info ' : { } ,
2019-06-29 01:21:35 +02:00
} ,
2017-05-30 19:05:19 +02:00
' result ' : {
' distribution ' : u ' openSUSE ' ,
' distribution_major_version ' : u ' 13 ' ,
' distribution_release ' : u ' 2 ' ,
' os_family ' : u ' Suse ' ,
' distribution_version ' : u ' 13.2 '
}
2016-04-14 19:44:06 +02:00
} ,
2016-09-14 22:34:53 +02:00
{
" platform.dist " : [
2017-01-28 00:20:31 +01:00
" " ,
" " ,
2016-09-14 22:34:53 +02:00
" "
2017-01-28 00:20:31 +01:00
] ,
2019-06-29 01:21:35 +02:00
' distro ' : {
' codename ' : ' ' ,
' id ' : ' opensuse-tumbleweed ' ,
' name ' : ' openSUSE Tumbleweed ' ,
' version ' : ' 20160917 ' ,
' version_best ' : ' 20160917 ' ,
2020-02-11 22:46:48 +01:00
' os_release_info ' : { } ,
' lsb_release_info ' : { } ,
2019-06-29 01:21:35 +02:00
} ,
2016-09-14 22:34:53 +02:00
" input " : {
2017-05-30 19:05:19 +02:00
" /etc/os-release " : (
" NAME= \" openSUSE Tumbleweed \" \n # VERSION= \" 20160917 \" \n ID=opensuse \n ID_LIKE= \" suse \" \n VERSION_ID= \" 20160917 \" \n "
" PRETTY_NAME= \" openSUSE Tumbleweed \" \n ANSI_COLOR= \" 0;32 \" \n CPE_NAME= \" cpe:/o:opensuse:tumbleweed:20160917 \" \n "
" BUG_REPORT_URL= \" https://bugs.opensuse.org \" \n HOME_URL= \" https://www.opensuse.org/ \" \n "
)
2017-01-28 00:20:31 +01:00
} ,
" name " : " openSUSE Tumbleweed 20160917 " ,
2016-09-14 22:34:53 +02:00
" result " : {
2017-02-27 21:01:02 +01:00
" distribution_release " : " " ,
2017-01-28 00:20:31 +01:00
" distribution " : " openSUSE Tumbleweed " ,
2018-06-18 15:53:50 +02:00
" distribution_major_version " : " 20160917 " ,
2017-01-28 00:20:31 +01:00
" os_family " : " Suse " ,
2016-09-14 22:34:53 +02:00
" distribution_version " : " 20160917 "
}
} ,
2018-06-18 15:53:50 +02:00
{
" platform.dist " : [
" " ,
" " ,
" "
] ,
2019-06-29 01:21:35 +02:00
' distro ' : {
' codename ' : ' ' ,
' id ' : ' opensuse-leap ' ,
' name ' : ' openSUSE Leap ' ,
' version ' : ' 15.0 ' ,
' version_best ' : ' 15.0 ' ,
2020-02-11 22:46:48 +01:00
' os_release_info ' : { } ,
' lsb_release_info ' : { } ,
2019-06-29 01:21:35 +02:00
} ,
2018-06-18 15:53:50 +02:00
" input " : {
" /etc/os-release " : (
" NAME= \" openSUSE Leap \" \n # VERSION= \" 15.0 \" \n ID=opensuse-leap \n ID_LIKE= \" suse opensuse \" \n VERSION_ID= \" 15.0 \" \n "
" PRETTY_NAME= \" openSUSE Leap 15.0 \" \n ANSI_COLOR= \" 0;32 \" \n CPE_NAME= \" cpe:/o:opensuse:leap:15.0 \" \n "
" BUG_REPORT_URL= \" https://bugs.opensuse.org \" \n HOME_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 "
}
} ,
2017-02-10 18:33:48 +01:00
{ # see https://github.com/ansible/ansible/issues/14837
2016-04-14 19:44:06 +02:00
" name " : " SLES 11.3 " ,
" input " : {
2019-06-29 01:21:35 +02:00
" /etc/SuSE-release " : " SUSE Linux Enterprise Server 11 (x86_64) \n VERSION = 11 \n PATCHLEVEL = 3 "
2016-04-14 19:44:06 +02:00
} ,
" platform.dist " : [ ' SuSE ' , ' 11 ' , ' x86_64 ' ] ,
2019-06-29 01:21:35 +02:00
' distro ' : {
' codename ' : ' ' ,
' id ' : ' sles ' ,
' name ' : ' SUSE Linux Enterprise Server ' ,
' version ' : ' 11 ' ,
' version_best ' : ' 11 ' ,
2020-02-11 22:46:48 +01:00
' os_release_info ' : { } ,
' lsb_release_info ' : { } ,
2019-06-29 01:21:35 +02:00
} ,
2017-05-30 19:05:19 +02:00
" result " : {
2016-04-14 19:44:06 +02:00
" distribution " : " SLES " ,
" distribution_major_version " : " 11 " ,
" distribution_release " : " 3 " ,
2016-09-17 23:27:35 +02:00
" os_family " : " Suse " ,
2016-04-14 19:44:06 +02:00
" distribution_version " : " 11.3 " ,
}
} ,
2017-02-10 18:33:48 +01:00
{ # see https://github.com/ansible/ansible/issues/14837
2016-04-14 19:44:06 +02:00
" name " : " SLES 11.4 " ,
" input " : {
2019-06-29 01:21:35 +02:00
" /etc/SuSE-release " : " \n SUSE Linux Enterprise Server 11 (x86_64) \n VERSION = 11 \n PATCHLEVEL = 4 " ,
" /etc/os-release " : (
' NAME= " SLES " \n VERSION= " 11.4 " \n VERSION_ID= " 11.4 " \n PRETTY_NAME= " SUSE Linux Enterprise Server 11 SP4 " \n ID= " sles " \n '
' ANSI_COLOR= " 0;32 " \n CPE_NAME= " cpe:/o:suse:sles:11:4 " ' ) ,
2016-04-14 19:44:06 +02:00
} ,
" platform.dist " : [ ' SuSE ' , ' 11 ' , ' x86_64 ' ] ,
2019-06-29 01:21:35 +02:00
' distro ' : {
' codename ' : ' ' ,
' id ' : ' sles ' ,
' name ' : ' SUSE Linux Enterprise Server ' ,
' version ' : ' 11.4 ' ,
' version_best ' : ' 11.4 ' ,
2020-02-11 22:46:48 +01:00
' os_release_info ' : { } ,
' lsb_release_info ' : { } ,
2019-06-29 01:21:35 +02:00
} ,
" result " : {
2016-04-14 19:44:06 +02:00
" distribution " : " SLES " ,
" distribution_major_version " : " 11 " ,
" distribution_release " : " 4 " ,
2016-09-17 23:27:35 +02:00
" os_family " : " Suse " ,
2016-04-14 19:44:06 +02:00
" distribution_version " : " 11.4 " ,
}
} ,
2017-02-10 18:33:48 +01:00
{ # see https://github.com/ansible/ansible/issues/14837
2016-04-14 19:44:06 +02:00
" name " : " SLES 12 SP0 " ,
" input " : {
2019-06-29 01:21:35 +02:00
" /etc/SuSE-release " : (
' \n SUSE Linux Enterprise Server 12 (x86_64) \n VERSION = 12 \n PATCHLEVEL = 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 " \n VERSION= " 12 " \n VERSION_ID= " 12 " \n PRETTY_NAME= " SUSE Linux Enterprise Server 12 " \n ID= " sles " \n '
' ANSI_COLOR= " 0;32 " \n CPE_NAME= " cpe:/o:suse:sles:12 " ' ) ,
2016-04-14 19:44:06 +02:00
} ,
" platform.dist " : [ ' SuSE ' , ' 12 ' , ' x86_64 ' ] ,
2019-06-29 01:21:35 +02:00
' distro ' : {
' codename ' : ' ' ,
' id ' : ' sles ' ,
' name ' : ' SUSE Linux Enterprise Server ' ,
' version ' : ' 12 ' ,
' version_best ' : ' 12 ' ,
2020-02-11 22:46:48 +01:00
' os_release_info ' : { } ,
' lsb_release_info ' : { } ,
2019-06-29 01:21:35 +02:00
} ,
2017-05-30 19:05:19 +02:00
" result " : {
2016-04-14 19:44:06 +02:00
" distribution " : " SLES " ,
" distribution_major_version " : " 12 " ,
" distribution_release " : " 0 " ,
2016-09-17 23:27:35 +02:00
" os_family " : " Suse " ,
2016-04-14 19:44:06 +02:00
" distribution_version " : " 12 " ,
}
} ,
2017-02-10 18:33:48 +01:00
{ # see https://github.com/ansible/ansible/issues/14837
2016-04-14 19:44:06 +02:00
" name " : " SLES 12 SP1 " ,
" input " : {
2019-06-29 01:21:35 +02:00
" /etc/SuSE-release " : (
' \n SUSE Linux Enterprise Server 12 (x86_64) \n VERSION = 12 \n PATCHLEVEL = 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 " \n VERSION= " 12-SP1 " \n VERSION_ID= " 12.1 " \n PRETTY_NAME= " SUSE Linux Enterprise Server 12 SP1 " \n ID= " sles " \n '
' ANSI_COLOR= " 0;32 " \n CPE_NAME= " cpe:/o:suse:sles:12:sp1 " ' ) ,
2016-04-14 19:44:06 +02:00
} ,
" platform.dist " : [ ' SuSE ' , ' 12 ' , ' x86_64 ' ] ,
2019-06-29 01:21:35 +02:00
' distro ' : {
' codename ' : ' ' ,
' id ' : ' sles ' ,
' name ' : ' SUSE Linux Enterprise Server ' ,
' version ' : ' 12.1 ' ,
' version_best ' : ' 12.1 ' ,
2020-02-11 22:46:48 +01:00
' os_release_info ' : { } ,
' lsb_release_info ' : { } ,
2019-06-29 01:21:35 +02:00
} ,
" result " : {
2016-04-14 19:44:06 +02:00
" distribution " : " SLES " ,
" distribution_major_version " : " 12 " ,
" distribution_release " : " 1 " ,
2016-09-17 23:27:35 +02:00
" os_family " : " Suse " ,
2016-04-14 19:44:06 +02:00
" distribution_version " : " 12.1 " ,
}
} ,
2018-11-06 14:12:38 +01:00
{
" name " : " SLES4SAP 12 SP2 " ,
" input " : {
2019-06-29 01:21:35 +02:00
" /etc/SuSE-release " : (
' SUSE Linux Enterprise Server 12 (x86_64) \n VERSION = 12 \n PATCHLEVEL = 2 \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_SAP " \n VERSION= " 12-SP2 " \n VERSION_ID= " 12.2 " \n PRETTY_NAME= " SUSE Linux Enterprise Server for SAP Applications 12 SP2 " \n '
' ID= " sles_sap " \n ANSI_COLOR= " 0;32 " \n CPE_NAME= " cpe:/o:suse:sles_sap:12:sp2 " ' ) ,
2018-11-06 14:12:38 +01:00
} ,
" platform.dist " : [ ' SuSE ' , ' 12 ' , ' x86_64 ' ] ,
2019-06-29 01:21:35 +02:00
' distro ' : {
' codename ' : ' ' ,
' id ' : ' sles ' ,
' name ' : ' SUSE Linux Enterprise Server ' ,
' version ' : ' 12.2 ' ,
' version_best ' : ' 12.2 ' ,
2020-02-11 22:46:48 +01:00
' os_release_info ' : { } ,
' lsb_release_info ' : { } ,
2019-06-29 01:21:35 +02:00
} ,
" result " : {
2018-11-06 14:12:38 +01:00
" distribution " : " SLES_SAP " ,
" distribution_major_version " : " 12 " ,
" distribution_release " : " 2 " ,
" os_family " : " Suse " ,
" distribution_version " : " 12.2 " ,
}
} ,
{
" name " : " SLES4SAP 12 SP3 " ,
" input " : {
2019-06-29 01:21:35 +02:00
" /etc/SuSE-release " : (
' SUSE Linux Enterprise Server 12 (x86_64)VERSION = 12PATCHLEVEL = 3 '
' \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 " \n VERSION= " 12-SP3 " \n VERSION_ID= " 12.3 " \n PRETTY_NAME= " SUSE Linux Enterprise Server 12 SP3 " \n '
' ID= " sles " \n ANSI_COLOR= " 0;32 " \n CPE_NAME= " cpe:/o:suse:sles_sap:12:sp3 " ' ) ,
2018-11-06 14:12:38 +01:00
} ,
" platform.dist " : [ ' SuSE ' , ' 12 ' , ' x86_64 ' ] ,
2019-06-29 01:21:35 +02:00
' distro ' : {
' codename ' : ' ' ,
' id ' : ' sles ' ,
' name ' : ' SUSE Linux Enterprise Server ' ,
' version ' : ' 12.3 ' ,
' version_best ' : ' 12.3 ' ,
2020-02-11 22:46:48 +01:00
' os_release_info ' : { } ,
' lsb_release_info ' : { } ,
2019-06-29 01:21:35 +02:00
} ,
" result " : {
2018-11-06 14:12:38 +01:00
" distribution " : " SLES_SAP " ,
" distribution_major_version " : " 12 " ,
" distribution_release " : " 3 " ,
" os_family " : " Suse " ,
" distribution_version " : " 12.3 " ,
}
} ,
2020-02-11 22:46:48 +01:00
{
" 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) \" \n NAME= \" Debian GNU/Linux \" \n VERSION_ID= \" 10 \" \n VERSION= \" 10 (buster) \" \n VERSION_CODENAME=buster \n ID=debian \n HOME_URL= \" https://www.debian.org/ \" \n SUPPORT_URL= \" https://www.debian.org/support \" \n BUG_REPORT_URL= \" https://bugs.debian.org/ \" \n " , # noqa
" /usr/lib/os-release " : " PRETTY_NAME= \" Debian GNU/Linux 10 (buster) \" \n NAME= \" Debian GNU/Linux \" \n VERSION_ID= \" 10 \" \n VERSION= \" 10 (buster) \" \n VERSION_CODENAME=buster \n ID=debian \n HOME_URL= \" https://www.debian.org/ \" \n SUPPORT_URL= \" https://www.debian.org/support \" \n BUG_REPORT_URL= \" https://bugs.debian.org/ \" \n " # noqa
} ,
" platform.dist " : [
" debian " ,
" 10 " ,
" buster "
] ,
" result " : {
" distribution " : " Debian " ,
" distribution_version " : " 10 " ,
" distribution_release " : " buster " ,
" distribution_major_version " : " 10 " ,
" os_family " : " Debian "
}
} ,
2016-04-14 19:44:06 +02:00
{
" name " : " Debian stretch/sid " ,
" input " : {
2019-06-29 01:21:35 +02:00
" /etc/os-release " : (
' PRETTY_NAME= " Debian GNU/Linux stretch/sid " \n NAME= " Debian GNU/Linux " \n ID=debian \n HOME_URL= " https://www.debian.org/ " \n '
' SUPPORT_URL= " https://www.debian.org/support " \n BUG_REPORT_URL= " https://bugs.debian.org/ " ' ) ,
" /etc/debian_version " : ' stretch/sid \n ' ,
2016-04-14 19:44:06 +02:00
} ,
" platform.dist " : ( ' debian ' , ' stretch/sid ' , ' ' ) ,
2019-06-29 01:21:35 +02:00
' distro ' : {
' codename ' : ' stretch ' ,
' id ' : ' debian ' ,
' name ' : ' Debian GNU/Linux ' ,
' version ' : ' 9 ' ,
' version_best ' : ' 9.8 ' ,
2020-02-11 22:46:48 +01:00
" 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 "
} ,
2019-06-29 01:21:35 +02:00
} ,
2017-05-30 19:05:19 +02:00
" result " : {
2016-04-14 19:44:06 +02:00
" distribution " : " Debian " ,
2019-06-29 01:21:35 +02:00
" distribution_major_version " : " 9 " ,
" distribution_release " : " stretch " ,
2016-09-17 23:27:35 +02:00
" os_family " : " Debian " ,
2019-06-29 01:21:35 +02:00
" distribution_version " : " 9.8 " ,
2016-04-14 19:44:06 +02:00
}
} ,
{
' name ' : " Debian 7.9 " ,
2017-05-30 19:05:19 +02:00
' input ' : {
2019-06-29 01:21:35 +02:00
' /etc/os-release ' : (
' PRETTY_NAME= " Debian GNU/Linux 7 (wheezy) " \n NAME= " Debian GNU/Linux " \n VERSION_ID= " 7 " \n VERSION= " 7 (wheezy) " \n ID=debian \n ANSI_COLOR= " 1;31 " \n '
' HOME_URL= " http://www.debian.org/ " \n SUPPORT_URL= " http://www.debian.org/support/ " \n BUG_REPORT_URL= " http://bugs.debian.org/ " ' ) ,
2017-05-30 19:05:19 +02:00
} ,
2016-04-14 19:44:06 +02:00
' platform.dist ' : ( ' debian ' , ' 7.9 ' , ' ' ) ,
2019-06-29 01:21:35 +02:00
' distro ' : {
' codename ' : ' wheezy ' ,
' id ' : ' debian ' ,
' name ' : ' Debian GNU/Linux ' ,
' version ' : ' 7 ' ,
' version_best ' : ' 7.9 ' ,
2020-02-11 22:46:48 +01:00
' 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) '
} ,
2019-06-29 01:21:35 +02:00
} ,
2017-05-30 19:05:19 +02:00
' result ' : {
' distribution ' : u ' Debian ' ,
' distribution_major_version ' : u ' 7 ' ,
' distribution_release ' : u ' wheezy ' ,
" os_family " : " Debian " ,
' distribution_version ' : u ' 7.9 '
}
2016-04-14 19:44:06 +02:00
} ,
2018-03-21 16:50:54 +01:00
{
' name ' : " SteamOS 2.0 " ,
' input ' : {
2019-06-29 01:21:35 +02:00
' /etc/os-release ' : (
' PRETTY_NAME= " SteamOS GNU/Linux 2.0 (brewmaster) " \n NAME= " SteamOS GNU/Linux " \n VERSION_ID= " 2 " \n VERSION= " 2 (brewmaster) " \n '
' ID=steamos \n ID_LIKE=debian \n HOME_URL= " http://www.steampowered.com/ " \n SUPPORT_URL= " http://support.steampowered.com/ " \n '
' BUG_REPORT_URL= " http://support.steampowered.com/ " ' ) ,
' /etc/lsb-release ' : ' DISTRIB_ID=SteamOS \n DISTRIB_RELEASE=2.0 \n DISTRIB_CODENAME=brewmaster \n DISTRIB_DESCRIPTION= " SteamOS 2.0 " ' ,
2018-03-21 16:50:54 +01:00
} ,
' platform.dist ' : ( ' Steamos ' , ' 2.0 ' , ' brewmaster ' ) ,
2019-06-29 01:21:35 +02:00
' distro ' : {
' codename ' : ' brewmaster ' ,
' id ' : ' steamos ' ,
' name ' : ' SteamOS GNU/Linux ' ,
' version ' : ' 2.0 ' ,
' version_best ' : ' 2.0 ' ,
2020-02-11 22:46:48 +01:00
' 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 '
} ,
2019-06-29 01:21:35 +02:00
} ,
2018-03-21 16:50:54 +01:00
' result ' : {
' distribution ' : u ' SteamOS ' ,
' distribution_major_version ' : u ' 2 ' ,
' distribution_release ' : u ' brewmaster ' ,
" os_family " : " Debian " ,
' distribution_version ' : u ' 2.0 '
}
} ,
2018-09-04 14:38:57 +02:00
{
' name ' : " Devuan " ,
' input ' : {
2019-06-29 01:21:35 +02:00
' /etc/os-release ' : ( ' PRETTY_NAME= " Devuan GNU/Linux 1 (jessie) " \n NAME= " Devuan GNU/Linux " \n VERSION_ID= " 1 " \n VERSION= " 1 (jessie) " \n '
' ID=devuan \n HOME_URL= " http://www.devuan.org/ " \n SUPPORT_URL= " http://www.devuan.org/support/ " \n BUG_REPORT_URL= " https://bugs.devuan.org/ " ' ) ,
2018-09-04 14:38:57 +02:00
} ,
' platform.dist ' : ( ' ' , ' ' , ' ' ) ,
2019-06-29 01:21:35 +02:00
' distro ' : {
' codename ' : ' jessie ' ,
' id ' : ' devuan ' ,
' name ' : ' Devuan GNU/Linux ' ,
' version ' : ' 1 ' ,
' version_best ' : ' 1 ' ,
2020-02-11 22:46:48 +01:00
' os_release_info ' : { } ,
' lsb_release_info ' : { } ,
2019-06-29 01:21:35 +02:00
} ,
2018-09-04 14:38:57 +02:00
' result ' : {
' distribution ' : u ' Devuan ' ,
' distribution_major_version ' : u ' 1 ' ,
' distribution_release ' : u ' jessie ' ,
' os_family ' : ' Debian ' ,
' distribution_version ' : u ' 1 '
}
} ,
2019-01-07 23:08:01 +01:00
{
' name ' : " Devuan " ,
' input ' : {
2019-06-29 01:21:35 +02:00
' /etc/os-release ' : (
' PRETTY_NAME= " Devuan GNU/Linux ascii " \n NAME= " Devuan GNU/Linux " \n ID=devuan \n HOME_URL= " https://www.devuan.org/ " \n '
' SUPPORT_URL= " https://devuan.org/os/community " \n BUG_REPORT_URL= " https://bugs.devuan.org/ " ' ) ,
2019-01-07 23:08:01 +01:00
} ,
' platform.dist ' : ( ' ' , ' ' , ' ' ) ,
2019-06-29 01:21:35 +02:00
' distro ' : {
' codename ' : ' ' ,
' id ' : ' devuan ' ,
' name ' : ' Devuan GNU/Linux ' ,
' version ' : ' ' ,
' version_best ' : ' ' ,
2020-02-11 22:46:48 +01:00
' os_release_info ' : { } ,
' lsb_release_info ' : { } ,
2019-06-29 01:21:35 +02:00
} ,
2019-01-07 23:08:01 +01:00
' result ' : {
' distribution ' : u ' Devuan ' ,
' distribution_major_version ' : u ' NA ' ,
' distribution_release ' : u ' ascii ' ,
' os_family ' : ' Debian ' ,
' distribution_version ' : u ' NA '
}
} ,
2020-02-11 22:46:48 +01:00
{
" 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 \" \n VERSION= \" 18.04.3 LTS (Bionic Beaver) \" \n ID=ubuntu \n ID_LIKE=debian \n PRETTY_NAME= \" Ubuntu 18.04.3 LTS \" \n VERSION_ID= \" 18.04 \" \n HOME_URL= \" https://www.ubuntu.com/ \" \n SUPPORT_URL= \" https://help.ubuntu.com/ \" \n BUG_REPORT_URL= \" https://bugs.launchpad.net/ubuntu/ \" \n PRIVACY_POLICY_URL= \" https://www.ubuntu.com/legal/terms-and-policies/privacy-policy \" \n VERSION_CODENAME=bionic \n UBUNTU_CODENAME=bionic \n " , # noqa
" /etc/lsb-release " : " DISTRIB_ID=Ubuntu \n DISTRIB_RELEASE=18.04 \n DISTRIB_CODENAME=bionic \n DISTRIB_DESCRIPTION= \" Ubuntu 18.04.3 LTS \" \n " ,
" /usr/lib/os-release " : " NAME= \" Ubuntu \" \n VERSION= \" 18.04.3 LTS (Bionic Beaver) \" \n ID=ubuntu \n ID_LIKE=debian \n PRETTY_NAME= \" Ubuntu 18.04.3 LTS \" \n VERSION_ID= \" 18.04 \" \n HOME_URL= \" https://www.ubuntu.com/ \" \n SUPPORT_URL= \" https://help.ubuntu.com/ \" \n BUG_REPORT_URL= \" https://bugs.launchpad.net/ubuntu/ \" \n PRIVACY_POLICY_URL= \" https://www.ubuntu.com/legal/terms-and-policies/privacy-policy \" \n VERSION_CODENAME=bionic \n UBUNTU_CODENAME=bionic \n " # noqa
} ,
" platform.dist " : [
" ubuntu " ,
" 18.04 " ,
" bionic "
] ,
" result " : {
" distribution " : " Ubuntu " ,
" distribution_version " : " 18.04 " ,
" distribution_release " : " bionic " ,
" distribution_major_version " : " 18 " ,
" os_family " : " Debian "
}
} ,
2016-07-04 15:57:57 +02:00
{
" platform.dist " : [
" Ubuntu " ,
" 16.04 " ,
" xenial "
] ,
2019-06-29 01:21:35 +02:00
' distro ' : {
' codename ' : ' xenial ' ,
' id ' : ' ubuntu ' ,
' name ' : ' Ubuntu ' ,
' version ' : ' 16.04 ' ,
' version_best ' : ' 16.04.6 ' ,
2020-02-11 22:46:48 +01:00
' os_release_info ' : { } ,
' lsb_release_info ' : { } ,
2019-06-29 01:21:35 +02:00
} ,
2016-07-04 15:57:57 +02:00
" input " : {
2017-05-30 19:05:19 +02:00
" /etc/os-release " : (
" NAME= \" Ubuntu \" \n VERSION= \" 16.04 LTS (Xenial Xerus) \" \n ID=ubuntu \n ID_LIKE=debian \n PRETTY_NAME= \" Ubuntu 16.04 LTS \" \n "
" VERSION_ID= \" 16.04 \" \n HOME_URL= \" http://www.ubuntu.com/ \" \n SUPPORT_URL= \" http://help.ubuntu.com/ \" \n "
" BUG_REPORT_URL= \" http://bugs.launchpad.net/ubuntu/ \" \n UBUNTU_CODENAME=xenial \n "
) ,
2016-07-04 15:57:57 +02:00
" /etc/lsb-release " : " DISTRIB_ID=Ubuntu \n DISTRIB_RELEASE=16.04 \n DISTRIB_CODENAME=xenial \n DISTRIB_DESCRIPTION= \" Ubuntu 16.04 LTS \" \n "
} ,
" name " : " Ubuntu 16.04 " ,
" result " : {
" distribution_release " : " xenial " ,
" distribution " : " Ubuntu " ,
" distribution_major_version " : " 16 " ,
2016-09-17 23:27:35 +02:00
" os_family " : " Debian " ,
2016-07-04 15:57:57 +02:00
" distribution_version " : " 16.04 "
}
} ,
2017-10-03 21:32:33 +02:00
{
' name ' : " Ubuntu 10.04 guess " ,
' input ' :
{
2019-06-29 01:21:35 +02:00
' /etc/lsb-release ' : ' DISTRIB_ID=Ubuntu \n DISTRIB_RELEASE=10.04 \n DISTRIB_CODENAME=lucid \n DISTRIB_DESCRIPTION= " Ubuntu 10.04.4 LTS ' ,
2017-10-03 21:32:33 +02:00
} ,
' platform.dist ' : ( ' Ubuntu ' , ' 10.04 ' , ' lucid ' ) ,
2019-06-29 01:21:35 +02:00
' distro ' : {
' codename ' : ' lucid ' ,
' id ' : ' ubuntu ' ,
' name ' : ' Ubuntu ' ,
' version ' : ' 10.04 ' ,
' version_best ' : ' 10.04.1 ' ,
2020-02-11 22:46:48 +01:00
' os_release_info ' : { } ,
' lsb_release_info ' : { } ,
2019-06-29 01:21:35 +02:00
} ,
2017-10-03 21:32:33 +02:00
' result ' :
{
' distribution ' : u ' Ubuntu ' ,
' distribution_major_version ' : u ' 10 ' ,
' distribution_release ' : u ' lucid ' ,
" os_family " : " Debian " ,
' distribution_version ' : u ' 10.04 '
}
} ,
2016-04-14 19:44:06 +02:00
{
' name ' : " Ubuntu 14.04 " ,
2017-05-30 19:05:19 +02:00
' input ' : {
2019-06-29 01:21:35 +02:00
' /etc/lsb-release ' : ' DISTRIB_ID=Ubuntu \n DISTRIB_RELEASE=14.04 \n DISTRIB_CODENAME=trusty \n DISTRIB_DESCRIPTION= " Ubuntu 14.04.4 LTS " ' ,
' /etc/os-release ' : (
' NAME= " Ubuntu " \n VERSION= " 14.04.4 LTS, Trusty Tahr " \n ID=ubuntu \n ID_LIKE=debian \n PRETTY_NAME= " Ubuntu 14.04.4 LTS " \n VERSION_ID= " 14.04 " \n '
' HOME_URL= " http://www.ubuntu.com/ " \n SUPPORT_URL= " http://help.ubuntu.com/ " \n BUG_REPORT_URL= " http://bugs.launchpad.net/ubuntu/ " ' ) ,
2017-05-30 19:05:19 +02:00
} ,
2016-04-14 19:44:06 +02:00
' platform.dist ' : ( ' Ubuntu ' , ' 14.04 ' , ' trusty ' ) ,
2019-06-29 01:21:35 +02:00
' distro ' : {
' codename ' : ' trusty ' ,
' id ' : ' ubuntu ' ,
' name ' : ' Ubuntu ' ,
' version ' : ' 14.04 ' ,
' version_best ' : ' 14.04.4 ' ,
2020-02-11 22:46:48 +01:00
' os_release_info ' : { } ,
' lsb_release_info ' : { } ,
2019-06-29 01:21:35 +02:00
} ,
2017-05-30 19:05:19 +02:00
' result ' : {
' distribution ' : u ' Ubuntu ' ,
' distribution_major_version ' : u ' 14 ' ,
' distribution_release ' : u ' trusty ' ,
" os_family " : " Debian " ,
' distribution_version ' : u ' 14.04 '
}
2016-04-14 19:44:06 +02:00
} ,
{
' name ' : " Ubuntu 12.04 " ,
2019-06-29 01:21:35 +02:00
' input ' : {
' /etc/lsb-release ' : ' DISTRIB_ID=Ubuntu \n DISTRIB_RELEASE=12.04 \n DISTRIB_CODENAME=precise \n DISTRIB_DESCRIPTION= " Ubuntu 12.04.5 LTS " ' ,
' /etc/os-release ' : (
' NAME= " Ubuntu " \n VERSION= " 12.04.5 LTS, Precise Pangolin " \n ID=ubuntu \n ID_LIKE=debian \n '
' PRETTY_NAME= " Ubuntu precise (12.04.5 LTS) " \n VERSION_ID= " 12.04 " ' ) ,
} ,
2016-04-14 19:44:06 +02:00
' platform.dist ' : ( ' Ubuntu ' , ' 12.04 ' , ' precise ' ) ,
2019-06-29 01:21:35 +02:00
' distro ' : {
' codename ' : ' precise ' ,
' id ' : ' ubuntu ' ,
' name ' : ' Ubuntu ' ,
' version ' : ' 12.04 ' ,
' version_best ' : ' 12.04.5 ' ,
2020-02-11 22:46:48 +01:00
' os_release_info ' : { } ,
' lsb_release_info ' : { } ,
2019-06-29 01:21:35 +02:00
} ,
2016-04-14 19:44:06 +02:00
' result ' : { ' distribution ' : u ' Ubuntu ' ,
' distribution_major_version ' : u ' 12 ' ,
' distribution_release ' : u ' precise ' ,
2016-09-17 23:27:35 +02:00
" os_family " : " Debian " ,
2016-04-14 19:44:06 +02:00
' distribution_version ' : u ' 12.04 ' }
} ,
2019-01-03 05:13:24 +01:00
{
' name ' : ' Kali 2019.1 ' ,
' input ' : {
' /etc/os-release ' : ( " PRETTY_NAME= \" Kali GNU/Linux Rolling \" \n NAME= \" Kali GNU/Linux \" \n ID=kali \n VERSION= \" 2019.1 \" \n "
" VERSION_ID= \" 2019.1 \" \n ID_LIKE=debian \n ANSI_COLOR= \" 1;31 \" \n HOME_URL= \" https://www.kali.org/ \" \n "
" SUPPORT_URL= \" https://forums.kali.org/ \" \n BUG_REPORT_URL= \" https://bugs.kali.org/ \" \n " ) ,
' /etc/lsb-release ' : ( " DISTRIB_ID=Kali \n DISTRIB_RELEASE=kali-rolling \n DISTRIB_CODENAME=kali-rolling \n "
" DISTRIB_DESCRIPTION= \" Kali GNU/Linux Rolling \" \n " ) ,
' /usr/lib/os-release ' : ( " PRETTY_NAME= \" Kali GNU/Linux Rolling \" \n NAME= \" Kali GNU/Linux \" \n ID=kali \n VERSION= \" 2019.1 \" \n "
" VERSION_ID= \" 2019.1 \" \n ID_LIKE=debian \n ANSI_COLOR= \" 1;31 \" \n HOME_URL= \" https://www.kali.org/ \" \n "
" SUPPORT_URL= \" https://forums.kali.org/ \" \n BUG_REPORT_URL= \" https://bugs.kali.org/ \" \n " )
} ,
' platform.dist ' : [
' kali ' ,
' 2019.1 ' ,
' '
] ,
2019-06-29 01:21:35 +02:00
' distro ' : {
' codename ' : ' kali-rolling ' ,
' id ' : ' kali ' ,
' name ' : ' Kali GNU/Linux Rolling ' ,
' version ' : ' 2019.1 ' ,
' version_best ' : ' 2019.1 ' ,
2020-02-11 22:46:48 +01:00
' os_release_info ' : { } ,
' lsb_release_info ' : { } ,
2019-06-29 01:21:35 +02:00
} ,
2019-01-03 05:13:24 +01:00
' result ' : {
' distribution ' : ' Kali ' ,
' distribution_version ' : ' 2019.1 ' ,
' distribution_release ' : ' kali-rolling ' ,
' distribution_major_version ' : ' 2019 ' ,
' os_family ' : ' Debian '
}
} ,
2016-10-27 20:22:08 +02:00
{
" platform.dist " : [
" neon " ,
" 16.04 " ,
" xenial "
] ,
2019-06-29 01:21:35 +02:00
' distro ' : {
' codename ' : ' xenial ' ,
' id ' : ' neon ' ,
' name ' : ' KDE neon ' ,
' version ' : ' 16.04 ' ,
' version_best ' : ' 16.04 ' ,
2020-02-11 22:46:48 +01:00
' 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 '
} ,
2019-06-29 01:21:35 +02:00
} ,
2016-10-27 20:22:08 +02:00
" input " : {
2017-02-10 18:33:48 +01:00
" /etc/os-release " : ( " NAME= \" KDE neon \" \n VERSION= \" 5.8 \" \n ID=neon \n ID_LIKE= \" ubuntu debian \" \n PRETTY_NAME= \" KDE neon User Edition 5.8 \" \n "
" VERSION_ID= \" 16.04 \" \n HOME_URL= \" http://neon.kde.org/ \" \n SUPPORT_URL= \" http://neon.kde.org/ \" \n "
" BUG_REPORT_URL= \" http://bugs.kde.org/ \" \n VERSION_CODENAME=xenial \n UBUNTU_CODENAME=xenial \n " ) ,
2016-10-27 20:22:08 +02:00
" /etc/lsb-release " : " DISTRIB_ID=neon \n DISTRIB_RELEASE=16.04 \n DISTRIB_CODENAME=xenial \n DISTRIB_DESCRIPTION= \" KDE neon User Edition 5.8 \" \n "
} ,
" name " : " KDE neon 16.04 " ,
" result " : {
" distribution_release " : " xenial " ,
Facts Refresh (2.4 roadmap) (#23012)
Facts Refresh (2.4 roadmap)
This commit implements most of the 2.4 roadmap 'Facts Refresh'
- move facts.py to facts/__init__.py
- move facts Distribution() to its own class
- add a facts/utils.py
- move get_file_content and get_uname_version to facts/utils.py
- move Facts() class from facts/__init__ to facts/facts.py
- mv get_file_lines to facts/utils.py
- mv Ohai()/Facter() class to facts/ohai.py and facter.py
- Start moving fact Hardware() classes to facts/hardware/*.py
- mv HPUX() hardware class to facts/hardware/hpux.py
- move SunOSHardware() fact class to facts/hardware/sunos.py
- move OpenBSDHardware() class to facts/hardware/openbsd.py
- mv FreeBsdHardware() and DragonFlyHardware() to facts/hardware/
- mv NetBSDHardware() to facts/hardware/netbsd.py
- mv Darwin() hardware class to facts/hardware/darwin.py
- pep8/etc cleanups on facts/hardware/*.py
- Mv network facts classes to facts/network/*.py
- mv Virtual fact classes to facts/virtual
- mv Hardware.get_sysctl to facts/sysctl.py:get_sysctl
- Also mv get_uname_version from facts/utils.py -> distribution.py
since distribution.py is the only thing using it.
- add collector.py with new BaseFactCollector
- add a subclass for AnsibleFactCollector
- hook up dict key munging FactNamespaces
- add some test cases for testing the names of facts
- mv timeout stuff to facts.timeout
- rm ansible_facts()/get_all_facts() etc
- Instead of calling facts.ansible_facts(), fact collection
api used by setup.py is now to create an AnsibleFactCollector()
and call it's collect method.
- replace Facts.get_user_facts with UserFactCollector
- add a 'systems' facts package, mv UserFactCollector there
- mv get_dns_facts to DnsFactCollector
- mv get_env_facts to EnvFactCollector
- include the timeout length in exception message
- modules and module_utils that use AnsibleFactCollector
can now theoretically set the 'valid_subsets'
May be useful for network facts module that currently have
to reimplement a good chunk of facts.py to get gather_subsets
to work.
- get_local_facts -> system/LocalFactCollector
- get_date_time -> system/date_time.py
- get_fips_facts -> system/fips.py
- get_caps_facts() -> system/caps.py
- get_apparmor_facts -> system/apparmor.py
- get_selinux_facts -> system/selinux.py
- get_lsb_facts -> system/lsb.py
- get_service_mgr_facts -> system/service_mgr.py
- Facts.is_systemd_managed -> system/service_mgr.py
- get_pkg_mgr_facts -> system/pkg_mgr.py
- Facts()._get_mount_size_facts() -> facts.utils.get_mount_size()
- add unit test for EnvFactCollector
- add a test case for minimal gather_subsets
- add test case for collect_ids
- Make gather_subset match existing behavior or '!all'
If 'gather_subset' is provided as '!all', the existing behavior
(in 2.2/2.3) is that means 'dont collect any facts except those
from the Facts() class'. So 'skip everything except
'apparmor', 'caps', 'date_time', 'env', 'fips', 'local', 'lsb',
'pkg_mgr', 'python', 'selinux', 'service_mgr', 'user', 'platform', etc.
The new facts setup was making '!all' mean no facts at all, since
it can add/exclude at a finer granularity. Since that makes more
sense for the ansible collector, and the set of minimal facts to
collect is really more up to setup.py to decide we do just that.
So if setup.py needs to always collect some gather_subset, even
on !all, setup.py needs to have the that subset added to the
list it passes as minimal_gather_subset.
This should fix some intg tests that assume '!all' means that
some facts are still collected (user info and env for example).
If we want to make setup.py collect a more minimal set, we can do that.
- force facts_dicts.keys() to a list so py3 works
- split fact collector tests to test_collectors.py
- convert Facter(Facts) -> other/facter.py:FacterFactCollector
- add FactCollector.collect_with_namespace()
regular .collect() will return a dict with the key names
using the base names ('ip_address', 'service_mgr' etc)
.collect_with_namespace() will return a dict where the key names
have been transformed with the collectors namespace, if there is
one. For most, this means a namespace that adds 'ansible_' to the
start of the key name.
For 'FacterFactCollector', the namespace transforms the key to
'facter_*'.
- add test cases for collect_with_namespace
- move all the concrete 'which facts does setup.py' stuff to setup.py
The caller of AnsibleFactCollector.from_gather_subset() needs to
pass in the list of collector classes now.
- update system/setup.py to import all of the fact classes and pass
in that list.
- split the Distribution fact class up a bit
extracted the 'distro release' file handling (ie, linux
boxes with /etc/release, /etc/os-release etc) into its
own class.
- extract get_cmdline_facts -> cmdline.py
- extract get_public_ssh_host_keys -> system/ssh_pub_keys.py
- extract get_platform_facts -> system/platform.py
platform.py may be a good candidate for further splitting.
- rm test for plain Facts() base class
- let the base class for Collector unit tests provide collected_facts
some Collectors and/or their migrated Facts() subsclasses need
to look at facts collected by other modules ('ansible_architecture'
the main one...).
Collector.collect() has the collected_facts arg for this, so add
a class variable to BaseFactsTest so we can specify it.
- mv Ohai to other/ohai.py and convert to Collector
- update hardware/*.py to return facts (no side effects)
- mv AnsibleFactCollector to setup.py
- extra collector class gathering to module method in
facts/__init__.py (collector_classes_from_gather_subset)
- add a CollectorMetaDataCollector collector used to provide
the 'gather_setup' fact
- add unit test module for 'setup' module
(test/units/modules/system/setup.py)
- Collector init now doesnt need a module, but collect does
An instance of a FactCollector() isnt tied to a AnsibleModule
instance, but the collect() method can be, so optionally pass
in module to FactCollector.collect() (everywhere)
- add a default_collectors for list of default collectors
import and use it from setup.py module
eventually, would like to replace this with a plugin loader
style class finder/loader
- unit tests for module_utils/facts/__init__.py
- add unit tests for ohai facts collector
- remove self.facts side effect on populate() in hardware/sunos.py
- convert OpenBSDHardware() to rm side effects on self.facts
- try to rm some self.facts side effects in Network()
plumb in collected_facts from populate() where it is needed.
stop passing collected_facts into Network() [via cached_facts=,
where it eventually becomes self.facts]
- nothing provides Fact() cached_facts arg now, rm it
Facts() should be internal only implementation so nothing
should be using it.
Of course, now someone will.
- add a Collector.name attr to build a map of name->_fact_ids
To properly exclude a gather_subset spec like '!hardware', we
need to know that 'hardware' also means 'devices', 'dmi', etc.
Before, '!hardware' would remove the 'hardware' collector name
but not 'devices'. Since both would end up in id_collector_map,
we would still end up with the HardwareCollector in the collector
list. End result being that '!hardware' wouldn't stop hardware
from being collected.
So we need to be able to build that map, so add the Collector.name
attribute that is the primary name (like 'hardware') and let
Collector._fact_ids be the other fact ids that a collector is
responsible for.
Construct the aliases_map of Collector.name -> set of _fact_ids
in fact/__init__.py get_collector_names, and use it when we are
populating the exclude set.
- refactor of distribution.py
make the big OS_FAMILY literal a little easier to read
Also keys can now be any string instead of python literals
99% sure the test for 'KDE Neon' was wrong
I don't see how/where it should or could get 'Neon' instead
of 'KDE Neon' as provided in os-release NAME=
Use 'distribution' string for key to OS_MAP
ie, we dont need to make it a valid python label anymore so dont.
move _has_dist_file to module as _file_exists
easier to mock without mucking with os.path
mv platform.system() calls to within get_distribution_facts() instead
of Distribution() init.
- remove _json compat module
The code in here was to support:
-a 'json' python module that was not the standard one included
with python since 2.6.
- potentially fallback to simplejson if 'json' was not available.
'json' is available for all supported python versions now so
no longer needed.
- mv get_collector_names -> facts.collector
- mv collector_classes_from_gather_subset -> facts.collector
- mv collector tests from test_facts -> test_collector
- Use six's reduce() in sunos/netbsd hardware facts
- rm extraneous get_uname_version in utils
only system/distribution.py uses it
- Remove Facts() subclass metaclass usage
- using fact_id and a platform id for matching collectors
gut most of Facts() subclasses
rm Facts() subclasses with weird metaclass
only add collectors that match the fact_ids and the platform_info
to the list of collectors used.
atm, a collectors platform_id will default to 'Generic', and
any platform matches 'Generic'
goal is to select collector classes including matching the
systems platform in collector.py, instead of relying on
metaclasses in hardware/*. To finish this, the various
Facts() subclasses will need to be replaced entirely with
Collector() subclasses.
use collector classmethod platform_match() to match the platform
This lets the particular class decide if it is compatible with
a given platform_info. platform_info is a dict like obj, so it could be
expanded in the future.
Add a default platform_match to BaseFactCollector that matches
platform_info['system'] == cls._platform
They were needed previously to trigger a module
load on all the collector classes when we import
facts/hardare so that the Hardware() and related
classes that used __new__ and find_all_subclasses()
would work.
Now that is done in collectors based on platform matching
at runtime we dont need to do it py module import/parse
time. So the non empty __init__.pys are no longer needed
and their is a more flexible mechanism for selection
platform specific stuff.
facts/facts.py is no longer used, rm'ed
- if we dont find an implement class for gather spec.. just ignore it.
Would be useful to add a warn to warn about this case.
- Fix SD-UX typo (should be HP-UX)
- Port fix for #21893 (0 sockets) to this branch
This readds the change from 8ad182059d5a085e4f8ecfe8ae63bad14a7dc01c
that got lost in merge/rebase
Fixes #21893
- port sunos fact locale fix for #24542 to this branch
based on e558ec19cd1fd9d00e299cf1938d4ca3cec85cda
Fixes #24542
Solaris fact fix (#24793)
ensure locale for solaris fact gathering
fixes issue with locale interfering with proper reading of decimals
- raise exceptions in the air like we just dont care.
Pretty much ignore any not exit exception in facts
collection. And add some test cases.
- added new selinux fact to clarify python lib
the selinux fact is boolean false when the library is not installed,
a dictionary/hash otherwise, but this is ambigous
added new fact so we can eventually remove the type dichtomy and normalize it as a dict
Re-add of devel commit 85c7a7b844bf429fc9cc0ffce5dd9bf05ed47b5a to
the new code layout, since it got removed in merge/rebase
2017-06-01 17:17:49 +02:00
" distribution " : " KDE neon " ,
2016-10-27 20:22:08 +02:00
" distribution_major_version " : " 16 " ,
" os_family " : " Debian " ,
" distribution_version " : " 16.04 "
}
} ,
2016-04-14 19:44:06 +02:00
{
' name ' : ' Core OS ' ,
' input ' : {
2019-06-29 01:21:35 +02:00
' /etc/os-release ' : (
' NAME=CoreOS \n ID=coreos \n VERSION=976.0.0 \n VERSION_ID=976.0.0 \n BUILD_ID=2016-03-03-2324 \n PRETTY_NAME= " CoreOS 976.0.0 (Coeur Rouge) " \n '
' ANSI_COLOR= " 1;32 " \n HOME_URL= " https://coreos.com/ " \n BUG_REPORT_URL= " https://github.com/coreos/bugs/issues " ' ) ,
' /etc/lsb-release ' : (
' DISTRIB_ID=CoreOS \n DISTRIB_RELEASE=976.0.0 \n DISTRIB_CODENAME= " Coeur Rouge " \n DISTRIB_DESCRIPTION= " CoreOS 976.0.0 (Coeur Rouge) " ' ) ,
2016-04-14 19:44:06 +02:00
} ,
' platform.dist ' : ( ' ' , ' ' , ' ' ) ,
2019-06-29 01:21:35 +02:00
' distro ' : {
' codename ' : ' Coeur Rouge ' ,
' id ' : ' coreos ' ,
' name ' : ' CoreOS ' ,
' version ' : ' 976.0.0 ' ,
' version_best ' : ' 976.0.0 ' ,
2020-02-11 22:46:48 +01:00
' os_release_info ' : { } ,
' lsb_release_info ' : { } ,
2019-06-29 01:21:35 +02:00
} ,
Facts Refresh (2.4 roadmap) (#23012)
Facts Refresh (2.4 roadmap)
This commit implements most of the 2.4 roadmap 'Facts Refresh'
- move facts.py to facts/__init__.py
- move facts Distribution() to its own class
- add a facts/utils.py
- move get_file_content and get_uname_version to facts/utils.py
- move Facts() class from facts/__init__ to facts/facts.py
- mv get_file_lines to facts/utils.py
- mv Ohai()/Facter() class to facts/ohai.py and facter.py
- Start moving fact Hardware() classes to facts/hardware/*.py
- mv HPUX() hardware class to facts/hardware/hpux.py
- move SunOSHardware() fact class to facts/hardware/sunos.py
- move OpenBSDHardware() class to facts/hardware/openbsd.py
- mv FreeBsdHardware() and DragonFlyHardware() to facts/hardware/
- mv NetBSDHardware() to facts/hardware/netbsd.py
- mv Darwin() hardware class to facts/hardware/darwin.py
- pep8/etc cleanups on facts/hardware/*.py
- Mv network facts classes to facts/network/*.py
- mv Virtual fact classes to facts/virtual
- mv Hardware.get_sysctl to facts/sysctl.py:get_sysctl
- Also mv get_uname_version from facts/utils.py -> distribution.py
since distribution.py is the only thing using it.
- add collector.py with new BaseFactCollector
- add a subclass for AnsibleFactCollector
- hook up dict key munging FactNamespaces
- add some test cases for testing the names of facts
- mv timeout stuff to facts.timeout
- rm ansible_facts()/get_all_facts() etc
- Instead of calling facts.ansible_facts(), fact collection
api used by setup.py is now to create an AnsibleFactCollector()
and call it's collect method.
- replace Facts.get_user_facts with UserFactCollector
- add a 'systems' facts package, mv UserFactCollector there
- mv get_dns_facts to DnsFactCollector
- mv get_env_facts to EnvFactCollector
- include the timeout length in exception message
- modules and module_utils that use AnsibleFactCollector
can now theoretically set the 'valid_subsets'
May be useful for network facts module that currently have
to reimplement a good chunk of facts.py to get gather_subsets
to work.
- get_local_facts -> system/LocalFactCollector
- get_date_time -> system/date_time.py
- get_fips_facts -> system/fips.py
- get_caps_facts() -> system/caps.py
- get_apparmor_facts -> system/apparmor.py
- get_selinux_facts -> system/selinux.py
- get_lsb_facts -> system/lsb.py
- get_service_mgr_facts -> system/service_mgr.py
- Facts.is_systemd_managed -> system/service_mgr.py
- get_pkg_mgr_facts -> system/pkg_mgr.py
- Facts()._get_mount_size_facts() -> facts.utils.get_mount_size()
- add unit test for EnvFactCollector
- add a test case for minimal gather_subsets
- add test case for collect_ids
- Make gather_subset match existing behavior or '!all'
If 'gather_subset' is provided as '!all', the existing behavior
(in 2.2/2.3) is that means 'dont collect any facts except those
from the Facts() class'. So 'skip everything except
'apparmor', 'caps', 'date_time', 'env', 'fips', 'local', 'lsb',
'pkg_mgr', 'python', 'selinux', 'service_mgr', 'user', 'platform', etc.
The new facts setup was making '!all' mean no facts at all, since
it can add/exclude at a finer granularity. Since that makes more
sense for the ansible collector, and the set of minimal facts to
collect is really more up to setup.py to decide we do just that.
So if setup.py needs to always collect some gather_subset, even
on !all, setup.py needs to have the that subset added to the
list it passes as minimal_gather_subset.
This should fix some intg tests that assume '!all' means that
some facts are still collected (user info and env for example).
If we want to make setup.py collect a more minimal set, we can do that.
- force facts_dicts.keys() to a list so py3 works
- split fact collector tests to test_collectors.py
- convert Facter(Facts) -> other/facter.py:FacterFactCollector
- add FactCollector.collect_with_namespace()
regular .collect() will return a dict with the key names
using the base names ('ip_address', 'service_mgr' etc)
.collect_with_namespace() will return a dict where the key names
have been transformed with the collectors namespace, if there is
one. For most, this means a namespace that adds 'ansible_' to the
start of the key name.
For 'FacterFactCollector', the namespace transforms the key to
'facter_*'.
- add test cases for collect_with_namespace
- move all the concrete 'which facts does setup.py' stuff to setup.py
The caller of AnsibleFactCollector.from_gather_subset() needs to
pass in the list of collector classes now.
- update system/setup.py to import all of the fact classes and pass
in that list.
- split the Distribution fact class up a bit
extracted the 'distro release' file handling (ie, linux
boxes with /etc/release, /etc/os-release etc) into its
own class.
- extract get_cmdline_facts -> cmdline.py
- extract get_public_ssh_host_keys -> system/ssh_pub_keys.py
- extract get_platform_facts -> system/platform.py
platform.py may be a good candidate for further splitting.
- rm test for plain Facts() base class
- let the base class for Collector unit tests provide collected_facts
some Collectors and/or their migrated Facts() subsclasses need
to look at facts collected by other modules ('ansible_architecture'
the main one...).
Collector.collect() has the collected_facts arg for this, so add
a class variable to BaseFactsTest so we can specify it.
- mv Ohai to other/ohai.py and convert to Collector
- update hardware/*.py to return facts (no side effects)
- mv AnsibleFactCollector to setup.py
- extra collector class gathering to module method in
facts/__init__.py (collector_classes_from_gather_subset)
- add a CollectorMetaDataCollector collector used to provide
the 'gather_setup' fact
- add unit test module for 'setup' module
(test/units/modules/system/setup.py)
- Collector init now doesnt need a module, but collect does
An instance of a FactCollector() isnt tied to a AnsibleModule
instance, but the collect() method can be, so optionally pass
in module to FactCollector.collect() (everywhere)
- add a default_collectors for list of default collectors
import and use it from setup.py module
eventually, would like to replace this with a plugin loader
style class finder/loader
- unit tests for module_utils/facts/__init__.py
- add unit tests for ohai facts collector
- remove self.facts side effect on populate() in hardware/sunos.py
- convert OpenBSDHardware() to rm side effects on self.facts
- try to rm some self.facts side effects in Network()
plumb in collected_facts from populate() where it is needed.
stop passing collected_facts into Network() [via cached_facts=,
where it eventually becomes self.facts]
- nothing provides Fact() cached_facts arg now, rm it
Facts() should be internal only implementation so nothing
should be using it.
Of course, now someone will.
- add a Collector.name attr to build a map of name->_fact_ids
To properly exclude a gather_subset spec like '!hardware', we
need to know that 'hardware' also means 'devices', 'dmi', etc.
Before, '!hardware' would remove the 'hardware' collector name
but not 'devices'. Since both would end up in id_collector_map,
we would still end up with the HardwareCollector in the collector
list. End result being that '!hardware' wouldn't stop hardware
from being collected.
So we need to be able to build that map, so add the Collector.name
attribute that is the primary name (like 'hardware') and let
Collector._fact_ids be the other fact ids that a collector is
responsible for.
Construct the aliases_map of Collector.name -> set of _fact_ids
in fact/__init__.py get_collector_names, and use it when we are
populating the exclude set.
- refactor of distribution.py
make the big OS_FAMILY literal a little easier to read
Also keys can now be any string instead of python literals
99% sure the test for 'KDE Neon' was wrong
I don't see how/where it should or could get 'Neon' instead
of 'KDE Neon' as provided in os-release NAME=
Use 'distribution' string for key to OS_MAP
ie, we dont need to make it a valid python label anymore so dont.
move _has_dist_file to module as _file_exists
easier to mock without mucking with os.path
mv platform.system() calls to within get_distribution_facts() instead
of Distribution() init.
- remove _json compat module
The code in here was to support:
-a 'json' python module that was not the standard one included
with python since 2.6.
- potentially fallback to simplejson if 'json' was not available.
'json' is available for all supported python versions now so
no longer needed.
- mv get_collector_names -> facts.collector
- mv collector_classes_from_gather_subset -> facts.collector
- mv collector tests from test_facts -> test_collector
- Use six's reduce() in sunos/netbsd hardware facts
- rm extraneous get_uname_version in utils
only system/distribution.py uses it
- Remove Facts() subclass metaclass usage
- using fact_id and a platform id for matching collectors
gut most of Facts() subclasses
rm Facts() subclasses with weird metaclass
only add collectors that match the fact_ids and the platform_info
to the list of collectors used.
atm, a collectors platform_id will default to 'Generic', and
any platform matches 'Generic'
goal is to select collector classes including matching the
systems platform in collector.py, instead of relying on
metaclasses in hardware/*. To finish this, the various
Facts() subclasses will need to be replaced entirely with
Collector() subclasses.
use collector classmethod platform_match() to match the platform
This lets the particular class decide if it is compatible with
a given platform_info. platform_info is a dict like obj, so it could be
expanded in the future.
Add a default platform_match to BaseFactCollector that matches
platform_info['system'] == cls._platform
They were needed previously to trigger a module
load on all the collector classes when we import
facts/hardare so that the Hardware() and related
classes that used __new__ and find_all_subclasses()
would work.
Now that is done in collectors based on platform matching
at runtime we dont need to do it py module import/parse
time. So the non empty __init__.pys are no longer needed
and their is a more flexible mechanism for selection
platform specific stuff.
facts/facts.py is no longer used, rm'ed
- if we dont find an implement class for gather spec.. just ignore it.
Would be useful to add a warn to warn about this case.
- Fix SD-UX typo (should be HP-UX)
- Port fix for #21893 (0 sockets) to this branch
This readds the change from 8ad182059d5a085e4f8ecfe8ae63bad14a7dc01c
that got lost in merge/rebase
Fixes #21893
- port sunos fact locale fix for #24542 to this branch
based on e558ec19cd1fd9d00e299cf1938d4ca3cec85cda
Fixes #24542
Solaris fact fix (#24793)
ensure locale for solaris fact gathering
fixes issue with locale interfering with proper reading of decimals
- raise exceptions in the air like we just dont care.
Pretty much ignore any not exit exception in facts
collection. And add some test cases.
- added new selinux fact to clarify python lib
the selinux fact is boolean false when the library is not installed,
a dictionary/hash otherwise, but this is ambigous
added new fact so we can eventually remove the type dichtomy and normalize it as a dict
Re-add of devel commit 85c7a7b844bf429fc9cc0ffce5dd9bf05ed47b5a to
the new code layout, since it got removed in merge/rebase
2017-06-01 17:17:49 +02:00
' platform.release ' : ' ' ,
2017-05-30 19:05:19 +02:00
' result ' : {
2016-04-14 19:44:06 +02:00
" distribution " : " CoreOS " ,
2019-06-29 01:21:35 +02:00
" distribution_major_version " : " 976 " ,
2016-04-14 19:44:06 +02:00
" distribution_version " : " 976.0.0 " ,
}
2016-06-07 21:12:37 +02:00
} ,
# Solaris and derivatives: https://gist.github.com/natefoo/7af6f3d47bb008669467
{
" name " : " SmartOS Global Zone " ,
" uname_v " : " joyent_20160330T234717Z " ,
" result " : {
" distribution_release " : " SmartOS 20160330T234717Z x86_64 " ,
" distribution " : " SmartOS " ,
2016-09-17 23:27:35 +02:00
" os_family " : " Solaris " ,
2016-06-07 21:12:37 +02:00
" distribution_version " : " joyent_20160330T234717Z "
} ,
" platform.dist " : [
" " ,
" " ,
" "
] ,
2019-06-29 01:21:35 +02:00
' distro ' : {
' codename ' : ' ' ,
' id ' : ' ' ,
' name ' : ' ' ,
' version ' : ' ' ,
' version_best ' : ' ' ,
2020-02-11 22:46:48 +01:00
' os_release_info ' : { } ,
' lsb_release_info ' : { } ,
2019-06-29 01:21:35 +02:00
} ,
2016-06-07 21:12:37 +02:00
" input " : {
2017-02-10 18:33:48 +01:00
" /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 " )
2016-06-07 21:12:37 +02:00
} ,
" platform.system " : " SunOS "
} ,
{
" name " : " SmartOS Zone " ,
" uname_v " : " joyent_20160330T234717Z " ,
" result " : {
" distribution_release " : " SmartOS x86_64 " ,
" distribution " : " SmartOS " ,
2016-09-17 23:27:35 +02:00
" os_family " : " Solaris " ,
2016-06-07 21:12:37 +02:00
" distribution_version " : " 14.3.0 "
} ,
" platform.dist " : [
" " ,
" " ,
" "
] ,
2019-06-29 01:21:35 +02:00
' distro ' : {
' codename ' : ' ' ,
' id ' : ' ' ,
' name ' : ' ' ,
' version ' : ' ' ,
' version_best ' : ' ' ,
2020-02-11 22:46:48 +01:00
' os_release_info ' : { } ,
' lsb_release_info ' : { } ,
2019-06-29 01:21:35 +02:00
} ,
2016-06-07 21:12:37 +02:00
" input " : {
2017-02-10 18:33:48 +01:00
" /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 " ) ,
2016-06-07 21:12:37 +02:00
" /etc/product " : " Name: Joyent Instance \n Image: base64 14.3.0 \n Documentation: http://wiki.joyent.com/jpc2/Base+Instance \n "
} ,
" platform.system " : " SunOS "
} ,
{
" name " : " OpenIndiana " ,
" uname_v " : " oi_151a9 " ,
" result " : {
" distribution_release " : " OpenIndiana Development oi_151.1.9 X86 (powered by illumos) " ,
" distribution " : " OpenIndiana " ,
2016-09-17 23:27:35 +02:00
" os_family " : " Solaris " ,
2016-06-07 21:12:37 +02:00
" distribution_version " : " oi_151a9 "
} ,
" platform.dist " : [
" " ,
" " ,
" "
] ,
2019-06-29 01:21:35 +02:00
' distro ' : {
' codename ' : ' ' ,
' id ' : ' ' ,
' name ' : ' ' ,
' version ' : ' ' ,
' version_best ' : ' ' ,
2020-02-11 22:46:48 +01:00
' os_release_info ' : { } ,
' lsb_release_info ' : { } ,
2019-06-29 01:21:35 +02:00
} ,
2016-06-07 21:12:37 +02:00
" input " : {
2017-02-10 18:33:48 +01:00
" /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 " )
2016-06-07 21:12:37 +02:00
} ,
" platform.system " : " SunOS "
} ,
{
" name " : " OmniOS " ,
" uname_v " : " omnios-10b9c79 " ,
" result " : {
" distribution_release " : " OmniOS v11 r151012 " ,
" distribution " : " OmniOS " ,
2016-09-17 23:27:35 +02:00
" os_family " : " Solaris " ,
2016-06-07 21:12:37 +02:00
" distribution_version " : " r151012 "
} ,
" platform.dist " : [
" " ,
" " ,
" "
] ,
2019-06-29 01:21:35 +02:00
' distro ' : {
' codename ' : ' ' ,
' id ' : ' ' ,
' name ' : ' ' ,
' version ' : ' ' ,
' version_best ' : ' ' ,
2020-02-11 22:46:48 +01:00
' os_release_info ' : { } ,
' lsb_release_info ' : { } ,
2019-06-29 01:21:35 +02:00
} ,
Facts Refresh (2.4 roadmap) (#23012)
Facts Refresh (2.4 roadmap)
This commit implements most of the 2.4 roadmap 'Facts Refresh'
- move facts.py to facts/__init__.py
- move facts Distribution() to its own class
- add a facts/utils.py
- move get_file_content and get_uname_version to facts/utils.py
- move Facts() class from facts/__init__ to facts/facts.py
- mv get_file_lines to facts/utils.py
- mv Ohai()/Facter() class to facts/ohai.py and facter.py
- Start moving fact Hardware() classes to facts/hardware/*.py
- mv HPUX() hardware class to facts/hardware/hpux.py
- move SunOSHardware() fact class to facts/hardware/sunos.py
- move OpenBSDHardware() class to facts/hardware/openbsd.py
- mv FreeBsdHardware() and DragonFlyHardware() to facts/hardware/
- mv NetBSDHardware() to facts/hardware/netbsd.py
- mv Darwin() hardware class to facts/hardware/darwin.py
- pep8/etc cleanups on facts/hardware/*.py
- Mv network facts classes to facts/network/*.py
- mv Virtual fact classes to facts/virtual
- mv Hardware.get_sysctl to facts/sysctl.py:get_sysctl
- Also mv get_uname_version from facts/utils.py -> distribution.py
since distribution.py is the only thing using it.
- add collector.py with new BaseFactCollector
- add a subclass for AnsibleFactCollector
- hook up dict key munging FactNamespaces
- add some test cases for testing the names of facts
- mv timeout stuff to facts.timeout
- rm ansible_facts()/get_all_facts() etc
- Instead of calling facts.ansible_facts(), fact collection
api used by setup.py is now to create an AnsibleFactCollector()
and call it's collect method.
- replace Facts.get_user_facts with UserFactCollector
- add a 'systems' facts package, mv UserFactCollector there
- mv get_dns_facts to DnsFactCollector
- mv get_env_facts to EnvFactCollector
- include the timeout length in exception message
- modules and module_utils that use AnsibleFactCollector
can now theoretically set the 'valid_subsets'
May be useful for network facts module that currently have
to reimplement a good chunk of facts.py to get gather_subsets
to work.
- get_local_facts -> system/LocalFactCollector
- get_date_time -> system/date_time.py
- get_fips_facts -> system/fips.py
- get_caps_facts() -> system/caps.py
- get_apparmor_facts -> system/apparmor.py
- get_selinux_facts -> system/selinux.py
- get_lsb_facts -> system/lsb.py
- get_service_mgr_facts -> system/service_mgr.py
- Facts.is_systemd_managed -> system/service_mgr.py
- get_pkg_mgr_facts -> system/pkg_mgr.py
- Facts()._get_mount_size_facts() -> facts.utils.get_mount_size()
- add unit test for EnvFactCollector
- add a test case for minimal gather_subsets
- add test case for collect_ids
- Make gather_subset match existing behavior or '!all'
If 'gather_subset' is provided as '!all', the existing behavior
(in 2.2/2.3) is that means 'dont collect any facts except those
from the Facts() class'. So 'skip everything except
'apparmor', 'caps', 'date_time', 'env', 'fips', 'local', 'lsb',
'pkg_mgr', 'python', 'selinux', 'service_mgr', 'user', 'platform', etc.
The new facts setup was making '!all' mean no facts at all, since
it can add/exclude at a finer granularity. Since that makes more
sense for the ansible collector, and the set of minimal facts to
collect is really more up to setup.py to decide we do just that.
So if setup.py needs to always collect some gather_subset, even
on !all, setup.py needs to have the that subset added to the
list it passes as minimal_gather_subset.
This should fix some intg tests that assume '!all' means that
some facts are still collected (user info and env for example).
If we want to make setup.py collect a more minimal set, we can do that.
- force facts_dicts.keys() to a list so py3 works
- split fact collector tests to test_collectors.py
- convert Facter(Facts) -> other/facter.py:FacterFactCollector
- add FactCollector.collect_with_namespace()
regular .collect() will return a dict with the key names
using the base names ('ip_address', 'service_mgr' etc)
.collect_with_namespace() will return a dict where the key names
have been transformed with the collectors namespace, if there is
one. For most, this means a namespace that adds 'ansible_' to the
start of the key name.
For 'FacterFactCollector', the namespace transforms the key to
'facter_*'.
- add test cases for collect_with_namespace
- move all the concrete 'which facts does setup.py' stuff to setup.py
The caller of AnsibleFactCollector.from_gather_subset() needs to
pass in the list of collector classes now.
- update system/setup.py to import all of the fact classes and pass
in that list.
- split the Distribution fact class up a bit
extracted the 'distro release' file handling (ie, linux
boxes with /etc/release, /etc/os-release etc) into its
own class.
- extract get_cmdline_facts -> cmdline.py
- extract get_public_ssh_host_keys -> system/ssh_pub_keys.py
- extract get_platform_facts -> system/platform.py
platform.py may be a good candidate for further splitting.
- rm test for plain Facts() base class
- let the base class for Collector unit tests provide collected_facts
some Collectors and/or their migrated Facts() subsclasses need
to look at facts collected by other modules ('ansible_architecture'
the main one...).
Collector.collect() has the collected_facts arg for this, so add
a class variable to BaseFactsTest so we can specify it.
- mv Ohai to other/ohai.py and convert to Collector
- update hardware/*.py to return facts (no side effects)
- mv AnsibleFactCollector to setup.py
- extra collector class gathering to module method in
facts/__init__.py (collector_classes_from_gather_subset)
- add a CollectorMetaDataCollector collector used to provide
the 'gather_setup' fact
- add unit test module for 'setup' module
(test/units/modules/system/setup.py)
- Collector init now doesnt need a module, but collect does
An instance of a FactCollector() isnt tied to a AnsibleModule
instance, but the collect() method can be, so optionally pass
in module to FactCollector.collect() (everywhere)
- add a default_collectors for list of default collectors
import and use it from setup.py module
eventually, would like to replace this with a plugin loader
style class finder/loader
- unit tests for module_utils/facts/__init__.py
- add unit tests for ohai facts collector
- remove self.facts side effect on populate() in hardware/sunos.py
- convert OpenBSDHardware() to rm side effects on self.facts
- try to rm some self.facts side effects in Network()
plumb in collected_facts from populate() where it is needed.
stop passing collected_facts into Network() [via cached_facts=,
where it eventually becomes self.facts]
- nothing provides Fact() cached_facts arg now, rm it
Facts() should be internal only implementation so nothing
should be using it.
Of course, now someone will.
- add a Collector.name attr to build a map of name->_fact_ids
To properly exclude a gather_subset spec like '!hardware', we
need to know that 'hardware' also means 'devices', 'dmi', etc.
Before, '!hardware' would remove the 'hardware' collector name
but not 'devices'. Since both would end up in id_collector_map,
we would still end up with the HardwareCollector in the collector
list. End result being that '!hardware' wouldn't stop hardware
from being collected.
So we need to be able to build that map, so add the Collector.name
attribute that is the primary name (like 'hardware') and let
Collector._fact_ids be the other fact ids that a collector is
responsible for.
Construct the aliases_map of Collector.name -> set of _fact_ids
in fact/__init__.py get_collector_names, and use it when we are
populating the exclude set.
- refactor of distribution.py
make the big OS_FAMILY literal a little easier to read
Also keys can now be any string instead of python literals
99% sure the test for 'KDE Neon' was wrong
I don't see how/where it should or could get 'Neon' instead
of 'KDE Neon' as provided in os-release NAME=
Use 'distribution' string for key to OS_MAP
ie, we dont need to make it a valid python label anymore so dont.
move _has_dist_file to module as _file_exists
easier to mock without mucking with os.path
mv platform.system() calls to within get_distribution_facts() instead
of Distribution() init.
- remove _json compat module
The code in here was to support:
-a 'json' python module that was not the standard one included
with python since 2.6.
- potentially fallback to simplejson if 'json' was not available.
'json' is available for all supported python versions now so
no longer needed.
- mv get_collector_names -> facts.collector
- mv collector_classes_from_gather_subset -> facts.collector
- mv collector tests from test_facts -> test_collector
- Use six's reduce() in sunos/netbsd hardware facts
- rm extraneous get_uname_version in utils
only system/distribution.py uses it
- Remove Facts() subclass metaclass usage
- using fact_id and a platform id for matching collectors
gut most of Facts() subclasses
rm Facts() subclasses with weird metaclass
only add collectors that match the fact_ids and the platform_info
to the list of collectors used.
atm, a collectors platform_id will default to 'Generic', and
any platform matches 'Generic'
goal is to select collector classes including matching the
systems platform in collector.py, instead of relying on
metaclasses in hardware/*. To finish this, the various
Facts() subclasses will need to be replaced entirely with
Collector() subclasses.
use collector classmethod platform_match() to match the platform
This lets the particular class decide if it is compatible with
a given platform_info. platform_info is a dict like obj, so it could be
expanded in the future.
Add a default platform_match to BaseFactCollector that matches
platform_info['system'] == cls._platform
They were needed previously to trigger a module
load on all the collector classes when we import
facts/hardare so that the Hardware() and related
classes that used __new__ and find_all_subclasses()
would work.
Now that is done in collectors based on platform matching
at runtime we dont need to do it py module import/parse
time. So the non empty __init__.pys are no longer needed
and their is a more flexible mechanism for selection
platform specific stuff.
facts/facts.py is no longer used, rm'ed
- if we dont find an implement class for gather spec.. just ignore it.
Would be useful to add a warn to warn about this case.
- Fix SD-UX typo (should be HP-UX)
- Port fix for #21893 (0 sockets) to this branch
This readds the change from 8ad182059d5a085e4f8ecfe8ae63bad14a7dc01c
that got lost in merge/rebase
Fixes #21893
- port sunos fact locale fix for #24542 to this branch
based on e558ec19cd1fd9d00e299cf1938d4ca3cec85cda
Fixes #24542
Solaris fact fix (#24793)
ensure locale for solaris fact gathering
fixes issue with locale interfering with proper reading of decimals
- raise exceptions in the air like we just dont care.
Pretty much ignore any not exit exception in facts
collection. And add some test cases.
- added new selinux fact to clarify python lib
the selinux fact is boolean false when the library is not installed,
a dictionary/hash otherwise, but this is ambigous
added new fact so we can eventually remove the type dichtomy and normalize it as a dict
Re-add of devel commit 85c7a7b844bf429fc9cc0ffce5dd9bf05ed47b5a to
the new code layout, since it got removed in merge/rebase
2017-06-01 17:17:49 +02:00
# "platform.release": 'OmniOS',
2016-06-07 21:12:37 +02:00
" input " : {
2017-02-10 18:33:48 +01:00
" /etc/release " : (
" OmniOS v11 r151012 \n Copyright 2014 OmniTI Computer Consulting, Inc. All rights reserved. \n Use is subject to license terms. \n \n "
)
2016-06-07 21:12:37 +02:00
} ,
" platform.system " : " SunOS "
} ,
{
" name " : " Nexenta 3 " ,
" uname_v " : " NexentaOS_134f " ,
" result " : {
" distribution_release " : " Open Storage Appliance v3.1.6 " ,
" distribution " : " Nexenta " ,
2016-09-17 23:27:35 +02:00
" os_family " : " Solaris " ,
2016-06-07 21:12:37 +02:00
" distribution_version " : " 3.1.6 "
} ,
" platform.dist " : [
" " ,
" " ,
" "
] ,
2019-06-29 01:21:35 +02:00
' distro ' : {
' codename ' : ' ' ,
' id ' : ' ' ,
' name ' : ' ' ,
' version ' : ' ' ,
' version_best ' : ' ' ,
2020-02-11 22:46:48 +01:00
' os_release_info ' : { } ,
' lsb_release_info ' : { } ,
2019-06-29 01:21:35 +02:00
} ,
Facts Refresh (2.4 roadmap) (#23012)
Facts Refresh (2.4 roadmap)
This commit implements most of the 2.4 roadmap 'Facts Refresh'
- move facts.py to facts/__init__.py
- move facts Distribution() to its own class
- add a facts/utils.py
- move get_file_content and get_uname_version to facts/utils.py
- move Facts() class from facts/__init__ to facts/facts.py
- mv get_file_lines to facts/utils.py
- mv Ohai()/Facter() class to facts/ohai.py and facter.py
- Start moving fact Hardware() classes to facts/hardware/*.py
- mv HPUX() hardware class to facts/hardware/hpux.py
- move SunOSHardware() fact class to facts/hardware/sunos.py
- move OpenBSDHardware() class to facts/hardware/openbsd.py
- mv FreeBsdHardware() and DragonFlyHardware() to facts/hardware/
- mv NetBSDHardware() to facts/hardware/netbsd.py
- mv Darwin() hardware class to facts/hardware/darwin.py
- pep8/etc cleanups on facts/hardware/*.py
- Mv network facts classes to facts/network/*.py
- mv Virtual fact classes to facts/virtual
- mv Hardware.get_sysctl to facts/sysctl.py:get_sysctl
- Also mv get_uname_version from facts/utils.py -> distribution.py
since distribution.py is the only thing using it.
- add collector.py with new BaseFactCollector
- add a subclass for AnsibleFactCollector
- hook up dict key munging FactNamespaces
- add some test cases for testing the names of facts
- mv timeout stuff to facts.timeout
- rm ansible_facts()/get_all_facts() etc
- Instead of calling facts.ansible_facts(), fact collection
api used by setup.py is now to create an AnsibleFactCollector()
and call it's collect method.
- replace Facts.get_user_facts with UserFactCollector
- add a 'systems' facts package, mv UserFactCollector there
- mv get_dns_facts to DnsFactCollector
- mv get_env_facts to EnvFactCollector
- include the timeout length in exception message
- modules and module_utils that use AnsibleFactCollector
can now theoretically set the 'valid_subsets'
May be useful for network facts module that currently have
to reimplement a good chunk of facts.py to get gather_subsets
to work.
- get_local_facts -> system/LocalFactCollector
- get_date_time -> system/date_time.py
- get_fips_facts -> system/fips.py
- get_caps_facts() -> system/caps.py
- get_apparmor_facts -> system/apparmor.py
- get_selinux_facts -> system/selinux.py
- get_lsb_facts -> system/lsb.py
- get_service_mgr_facts -> system/service_mgr.py
- Facts.is_systemd_managed -> system/service_mgr.py
- get_pkg_mgr_facts -> system/pkg_mgr.py
- Facts()._get_mount_size_facts() -> facts.utils.get_mount_size()
- add unit test for EnvFactCollector
- add a test case for minimal gather_subsets
- add test case for collect_ids
- Make gather_subset match existing behavior or '!all'
If 'gather_subset' is provided as '!all', the existing behavior
(in 2.2/2.3) is that means 'dont collect any facts except those
from the Facts() class'. So 'skip everything except
'apparmor', 'caps', 'date_time', 'env', 'fips', 'local', 'lsb',
'pkg_mgr', 'python', 'selinux', 'service_mgr', 'user', 'platform', etc.
The new facts setup was making '!all' mean no facts at all, since
it can add/exclude at a finer granularity. Since that makes more
sense for the ansible collector, and the set of minimal facts to
collect is really more up to setup.py to decide we do just that.
So if setup.py needs to always collect some gather_subset, even
on !all, setup.py needs to have the that subset added to the
list it passes as minimal_gather_subset.
This should fix some intg tests that assume '!all' means that
some facts are still collected (user info and env for example).
If we want to make setup.py collect a more minimal set, we can do that.
- force facts_dicts.keys() to a list so py3 works
- split fact collector tests to test_collectors.py
- convert Facter(Facts) -> other/facter.py:FacterFactCollector
- add FactCollector.collect_with_namespace()
regular .collect() will return a dict with the key names
using the base names ('ip_address', 'service_mgr' etc)
.collect_with_namespace() will return a dict where the key names
have been transformed with the collectors namespace, if there is
one. For most, this means a namespace that adds 'ansible_' to the
start of the key name.
For 'FacterFactCollector', the namespace transforms the key to
'facter_*'.
- add test cases for collect_with_namespace
- move all the concrete 'which facts does setup.py' stuff to setup.py
The caller of AnsibleFactCollector.from_gather_subset() needs to
pass in the list of collector classes now.
- update system/setup.py to import all of the fact classes and pass
in that list.
- split the Distribution fact class up a bit
extracted the 'distro release' file handling (ie, linux
boxes with /etc/release, /etc/os-release etc) into its
own class.
- extract get_cmdline_facts -> cmdline.py
- extract get_public_ssh_host_keys -> system/ssh_pub_keys.py
- extract get_platform_facts -> system/platform.py
platform.py may be a good candidate for further splitting.
- rm test for plain Facts() base class
- let the base class for Collector unit tests provide collected_facts
some Collectors and/or their migrated Facts() subsclasses need
to look at facts collected by other modules ('ansible_architecture'
the main one...).
Collector.collect() has the collected_facts arg for this, so add
a class variable to BaseFactsTest so we can specify it.
- mv Ohai to other/ohai.py and convert to Collector
- update hardware/*.py to return facts (no side effects)
- mv AnsibleFactCollector to setup.py
- extra collector class gathering to module method in
facts/__init__.py (collector_classes_from_gather_subset)
- add a CollectorMetaDataCollector collector used to provide
the 'gather_setup' fact
- add unit test module for 'setup' module
(test/units/modules/system/setup.py)
- Collector init now doesnt need a module, but collect does
An instance of a FactCollector() isnt tied to a AnsibleModule
instance, but the collect() method can be, so optionally pass
in module to FactCollector.collect() (everywhere)
- add a default_collectors for list of default collectors
import and use it from setup.py module
eventually, would like to replace this with a plugin loader
style class finder/loader
- unit tests for module_utils/facts/__init__.py
- add unit tests for ohai facts collector
- remove self.facts side effect on populate() in hardware/sunos.py
- convert OpenBSDHardware() to rm side effects on self.facts
- try to rm some self.facts side effects in Network()
plumb in collected_facts from populate() where it is needed.
stop passing collected_facts into Network() [via cached_facts=,
where it eventually becomes self.facts]
- nothing provides Fact() cached_facts arg now, rm it
Facts() should be internal only implementation so nothing
should be using it.
Of course, now someone will.
- add a Collector.name attr to build a map of name->_fact_ids
To properly exclude a gather_subset spec like '!hardware', we
need to know that 'hardware' also means 'devices', 'dmi', etc.
Before, '!hardware' would remove the 'hardware' collector name
but not 'devices'. Since both would end up in id_collector_map,
we would still end up with the HardwareCollector in the collector
list. End result being that '!hardware' wouldn't stop hardware
from being collected.
So we need to be able to build that map, so add the Collector.name
attribute that is the primary name (like 'hardware') and let
Collector._fact_ids be the other fact ids that a collector is
responsible for.
Construct the aliases_map of Collector.name -> set of _fact_ids
in fact/__init__.py get_collector_names, and use it when we are
populating the exclude set.
- refactor of distribution.py
make the big OS_FAMILY literal a little easier to read
Also keys can now be any string instead of python literals
99% sure the test for 'KDE Neon' was wrong
I don't see how/where it should or could get 'Neon' instead
of 'KDE Neon' as provided in os-release NAME=
Use 'distribution' string for key to OS_MAP
ie, we dont need to make it a valid python label anymore so dont.
move _has_dist_file to module as _file_exists
easier to mock without mucking with os.path
mv platform.system() calls to within get_distribution_facts() instead
of Distribution() init.
- remove _json compat module
The code in here was to support:
-a 'json' python module that was not the standard one included
with python since 2.6.
- potentially fallback to simplejson if 'json' was not available.
'json' is available for all supported python versions now so
no longer needed.
- mv get_collector_names -> facts.collector
- mv collector_classes_from_gather_subset -> facts.collector
- mv collector tests from test_facts -> test_collector
- Use six's reduce() in sunos/netbsd hardware facts
- rm extraneous get_uname_version in utils
only system/distribution.py uses it
- Remove Facts() subclass metaclass usage
- using fact_id and a platform id for matching collectors
gut most of Facts() subclasses
rm Facts() subclasses with weird metaclass
only add collectors that match the fact_ids and the platform_info
to the list of collectors used.
atm, a collectors platform_id will default to 'Generic', and
any platform matches 'Generic'
goal is to select collector classes including matching the
systems platform in collector.py, instead of relying on
metaclasses in hardware/*. To finish this, the various
Facts() subclasses will need to be replaced entirely with
Collector() subclasses.
use collector classmethod platform_match() to match the platform
This lets the particular class decide if it is compatible with
a given platform_info. platform_info is a dict like obj, so it could be
expanded in the future.
Add a default platform_match to BaseFactCollector that matches
platform_info['system'] == cls._platform
They were needed previously to trigger a module
load on all the collector classes when we import
facts/hardare so that the Hardware() and related
classes that used __new__ and find_all_subclasses()
would work.
Now that is done in collectors based on platform matching
at runtime we dont need to do it py module import/parse
time. So the non empty __init__.pys are no longer needed
and their is a more flexible mechanism for selection
platform specific stuff.
facts/facts.py is no longer used, rm'ed
- if we dont find an implement class for gather spec.. just ignore it.
Would be useful to add a warn to warn about this case.
- Fix SD-UX typo (should be HP-UX)
- Port fix for #21893 (0 sockets) to this branch
This readds the change from 8ad182059d5a085e4f8ecfe8ae63bad14a7dc01c
that got lost in merge/rebase
Fixes #21893
- port sunos fact locale fix for #24542 to this branch
based on e558ec19cd1fd9d00e299cf1938d4ca3cec85cda
Fixes #24542
Solaris fact fix (#24793)
ensure locale for solaris fact gathering
fixes issue with locale interfering with proper reading of decimals
- raise exceptions in the air like we just dont care.
Pretty much ignore any not exit exception in facts
collection. And add some test cases.
- added new selinux fact to clarify python lib
the selinux fact is boolean false when the library is not installed,
a dictionary/hash otherwise, but this is ambigous
added new fact so we can eventually remove the type dichtomy and normalize it as a dict
Re-add of devel commit 85c7a7b844bf429fc9cc0ffce5dd9bf05ed47b5a to
the new code layout, since it got removed in merge/rebase
2017-06-01 17:17:49 +02:00
" platform.release: " : " " ,
2016-06-07 21:12:37 +02:00
" input " : {
2017-02-10 18:33:48 +01:00
" /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 " )
2016-06-07 21:12:37 +02:00
} ,
" platform.system " : " SunOS "
} ,
{
" name " : " Nexenta 4 " ,
" uname_v " : " NexentaOS_4:cd604cd066 " ,
" result " : {
" distribution_release " : " Open Storage Appliance 4.0.3-FP2 " ,
" distribution " : " Nexenta " ,
2016-09-17 23:27:35 +02:00
" os_family " : " Solaris " ,
2016-06-07 21:12:37 +02:00
" distribution_version " : " 4.0.3-FP2 "
} ,
" platform.dist " : [
" " ,
" " ,
" "
] ,
2019-06-29 01:21:35 +02:00
' distro ' : {
' codename ' : ' ' ,
' id ' : ' ' ,
' name ' : ' ' ,
' version ' : ' ' ,
' version_best ' : ' ' ,
2020-02-11 22:46:48 +01:00
' os_release_info ' : { } ,
' lsb_release_info ' : { } ,
2019-06-29 01:21:35 +02:00
} ,
2016-06-07 21:12:37 +02:00
" input " : {
2017-02-10 18:33:48 +01:00
" /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 " )
2016-06-07 21:12:37 +02:00
} ,
" platform.system " : " SunOS "
} ,
{
" name " : " Solaris 10 " ,
" uname_v " : " Generic_141445-09 " ,
2019-01-24 02:33:32 +01:00
" uname_r " : " 5.10 " ,
2016-06-07 21:12:37 +02:00
" result " : {
" distribution_release " : " Solaris 10 10/09 s10x_u8wos_08a X86 " ,
" distribution " : " Solaris " ,
2016-09-17 23:27:35 +02:00
" os_family " : " Solaris " ,
2019-01-24 02:33:32 +01:00
" distribution_major_version " : " 10 " ,
2016-06-07 21:12:37 +02:00
" distribution_version " : " 10 "
} ,
" platform.dist " : [
" " ,
" " ,
" "
] ,
2019-06-29 01:21:35 +02:00
' distro ' : {
' codename ' : ' ' ,
' id ' : ' ' ,
' name ' : ' ' ,
' version ' : ' ' ,
' version_best ' : ' ' ,
2020-02-11 22:46:48 +01:00
' os_release_info ' : { } ,
' lsb_release_info ' : { } ,
2019-06-29 01:21:35 +02:00
} ,
2016-06-07 21:12:37 +02:00
" input " : {
2017-02-10 18:33:48 +01:00
" /etc/release " : ( " Solaris 10 10/09 s10x_u8wos_08a X86 \n Copyright 2009 Sun Microsystems, Inc. "
" All Rights Reserved. \n Use is subject to license terms. \n "
" Assembled 16 September 2009 \n " )
2016-06-07 21:12:37 +02:00
} ,
" platform.system " : " SunOS "
} ,
{
" name " : " Solaris 11 " ,
" uname_v " : " 11.0 " ,
2019-01-24 02:33:32 +01:00
" uname_r " : " 5.11 " ,
2016-06-07 21:12:37 +02:00
" result " : {
" distribution_release " : " Oracle Solaris 11 11/11 X86 " ,
" distribution " : " Solaris " ,
2016-09-17 23:27:35 +02:00
" os_family " : " Solaris " ,
2019-01-24 02:33:32 +01:00
" distribution_major_version " : " 11 " ,
2016-06-07 21:12:37 +02:00
" distribution_version " : " 11 "
} ,
" platform.dist " : [
" " ,
" " ,
" "
] ,
2019-06-29 01:21:35 +02:00
' distro ' : {
' codename ' : ' ' ,
' id ' : ' ' ,
' name ' : ' ' ,
' version ' : ' ' ,
' version_best ' : ' ' ,
2020-02-11 22:46:48 +01:00
' os_release_info ' : { } ,
' lsb_release_info ' : { } ,
2019-06-29 01:21:35 +02:00
} ,
2016-06-07 21:12:37 +02:00
" input " : {
2017-02-10 18:33:48 +01:00
" /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 " )
2016-06-07 21:12:37 +02:00
} ,
" platform.system " : " SunOS "
2016-07-04 15:57:57 +02:00
} ,
2017-01-29 08:28:53 +01:00
{
" name " : " Solaris 11.3 " ,
2019-01-24 02:33:32 +01:00
" uname_r " : " 5.11 " ,
2017-01-29 08:28:53 +01:00
" platform.dist " : [
" " ,
" " ,
" "
2017-05-30 19:05:19 +02:00
] ,
2019-06-29 01:21:35 +02:00
' distro ' : {
' codename ' : ' ' ,
' id ' : ' ' ,
' name ' : ' ' ,
' version ' : ' ' ,
' version_best ' : ' ' ,
2020-02-11 22:46:48 +01:00
' os_release_info ' : { } ,
' lsb_release_info ' : { } ,
2019-06-29 01:21:35 +02:00
} ,
2017-01-29 08:28:53 +01:00
" input " : {
2017-05-30 19:05:19 +02:00
" /etc/release " : (
2019-01-24 02:33:32 +01:00
" Oracle Solaris 11.3 X86 \n Copyright (c) 1983, 2018, Oracle and/or its affiliates. "
" All rights reserved. \n Assembled 09 May 2018 \n "
2017-05-30 19:05:19 +02:00
)
} ,
2017-01-29 08:28:53 +01:00
" platform.system " : " SunOS " ,
" result " : {
" distribution_release " : " Oracle Solaris 11.3 X86 " ,
" distribution " : " Solaris " ,
" os_family " : " Solaris " ,
2019-01-24 02:33:32 +01:00
" distribution_major_version " : " 11 " ,
2017-01-29 08:28:53 +01:00
" distribution_version " : " 11.3 "
2017-05-30 19:05:19 +02:00
}
} ,
2019-01-24 02:33:32 +01:00
{
" name " : " Solaris 11.4 " ,
" uname_r " : " 5.11 " ,
" platform.dist " : [
" " ,
" " ,
" "
] ,
2019-06-29 01:21:35 +02:00
' distro ' : {
' codename ' : ' ' ,
' id ' : ' ' ,
' name ' : ' ' ,
' version ' : ' ' ,
' version_best ' : ' ' ,
2020-02-11 22:46:48 +01:00
' 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 ' : { } ,
2019-06-29 01:21:35 +02:00
} ,
2019-01-24 02:33:32 +01:00
" 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 "
}
} ,
2017-01-29 08:28:53 +01:00
{
" name " : " Solaris 10 " ,
2019-01-24 02:33:32 +01:00
" uname_r " : " 5.10 " ,
2017-01-29 08:28:53 +01:00
" platform.dist " : [
" " ,
" " ,
" "
2017-05-30 19:05:19 +02:00
] ,
2019-06-29 01:21:35 +02:00
' distro ' : {
' codename ' : ' ' ,
' id ' : ' ' ,
' name ' : ' ' ,
' version ' : ' ' ,
' version_best ' : ' ' ,
2020-02-11 22:46:48 +01:00
' os_release_info ' : { } ,
' lsb_release_info ' : { } ,
2019-06-29 01:21:35 +02:00
} ,
2017-01-29 08:28:53 +01:00
" input " : {
2017-02-10 18:33:48 +01:00
" /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 " )
2017-05-30 19:05:19 +02:00
} ,
2017-01-29 08:28:53 +01:00
" platform.system " : " SunOS " ,
" result " : {
" distribution_release " : " Oracle Solaris 10 1/13 s10x_u11wos_24a X86 " ,
" distribution " : " Solaris " ,
" os_family " : " Solaris " ,
2019-01-24 02:33:32 +01:00
" distribution_major_version " : " 10 " ,
2017-01-29 08:28:53 +01:00
" distribution_version " : " 10 "
2017-05-30 19:05:19 +02:00
}
} ,
2020-02-11 22:46:48 +01:00
{
" 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 \n VERSION= \" 31 (Workstation Edition) \" \n ID=fedora \n VERSION_ID=31 \n VERSION_CODENAME= \" \" \n PLATFORM_ID= \" platform:f31 \" \n PRETTY_NAME= \" Fedora 31 (Workstation Edition) \" \n ANSI_COLOR= \" 0;34 \" \n LOGO=fedora-logo-icon \n CPE_NAME= \" cpe:/o:fedoraproject:fedora:31 \" \n HOME_URL= \" https://fedoraproject.org/ \" \n DOCUMENTATION_URL= \" https://docs.fedoraproject.org/en-US/fedora/f31/system-administrators-guide/ \" \n SUPPORT_URL= \" https://fedoraproject.org/wiki/Communicating_and_getting_help \" \n BUG_REPORT_URL= \" https://bugzilla.redhat.com/ \" \n REDHAT_BUGZILLA_PRODUCT= \" Fedora \" \n REDHAT_BUGZILLA_PRODUCT_VERSION=31 \n REDHAT_SUPPORT_PRODUCT= \" Fedora \" \n REDHAT_SUPPORT_PRODUCT_VERSION=31 \n PRIVACY_POLICY_URL= \" https://fedoraproject.org/wiki/Legal:PrivacyPolicy \" \n VARIANT= \" Workstation Edition \" \n VARIANT_ID=workstation \n " , # noqa
" /usr/lib/os-release " : " NAME=Fedora \n VERSION= \" 31 (Workstation Edition) \" \n ID=fedora \n VERSION_ID=31 \n VERSION_CODENAME= \" \" \n PLATFORM_ID= \" platform:f31 \" \n PRETTY_NAME= \" Fedora 31 (Workstation Edition) \" \n ANSI_COLOR= \" 0;34 \" \n LOGO=fedora-logo-icon \n CPE_NAME= \" cpe:/o:fedoraproject:fedora:31 \" \n HOME_URL= \" https://fedoraproject.org/ \" \n DOCUMENTATION_URL= \" https://docs.fedoraproject.org/en-US/fedora/f31/system-administrators-guide/ \" \n SUPPORT_URL= \" https://fedoraproject.org/wiki/Communicating_and_getting_help \" \n BUG_REPORT_URL= \" https://bugzilla.redhat.com/ \" \n REDHAT_BUGZILLA_PRODUCT= \" Fedora \" \n REDHAT_BUGZILLA_PRODUCT_VERSION=31 \n REDHAT_SUPPORT_PRODUCT= \" Fedora \" \n REDHAT_SUPPORT_PRODUCT_VERSION=31 \n PRIVACY_POLICY_URL= \" https://fedoraproject.org/wiki/Legal:PrivacyPolicy \" \n VARIANT= \" Workstation Edition \" \n VARIANT_ID=workstation \n " # noqa
} ,
" platform.dist " : [
" fedora " ,
" 31 " ,
" "
] ,
" result " : {
" distribution " : " Fedora " ,
" distribution_version " : " 31 " ,
" distribution_release " : " " ,
" distribution_major_version " : " 31 " ,
" os_family " : " RedHat "
}
} ,
2017-01-29 08:28:53 +01:00
{
" name " : " Fedora 22 " ,
" platform.dist " : [
" fedora " ,
" 22 " ,
" Twenty Two "
2017-05-30 19:05:19 +02:00
] ,
2019-06-29 01:21:35 +02:00
' distro ' : {
' codename ' : ' Twenty Two ' ,
' id ' : ' fedora ' ,
' name ' : ' Fedora ' ,
' version ' : ' 22 ' ,
' version_best ' : ' 22 ' ,
2020-02-11 22:46:48 +01:00
' os_release_info ' : { } ,
' lsb_release_info ' : { } ,
2019-06-29 01:21:35 +02:00
} ,
2017-01-29 08:28:53 +01:00
" input " : {
" /etc/redhat-release " : " Fedora release 22 (Twenty Two) \n " ,
2017-05-30 19:05:19 +02:00
" /etc/os-release " : (
" NAME=Fedora \n VERSION= \" 22 (Twenty Two) \" \n ID=fedora \n VERSION_ID=22 \n PRETTY_NAME= \" Fedora 22 (Twenty Two) \" \n "
" ANSI_COLOR= \" 0;34 \" \n CPE_NAME= \" cpe:/o:fedoraproject:fedora:22 \" \n HOME_URL= \" https://fedoraproject.org/ \" \n "
" BUG_REPORT_URL= \" https://bugzilla.redhat.com/ \" \n REDHAT_BUGZILLA_PRODUCT= \" Fedora \" \n REDHAT_BUGZILLA_PRODUCT_VERSION=22 \n "
" REDHAT_SUPPORT_PRODUCT= \" Fedora \" \n REDHAT_SUPPORT_PRODUCT_VERSION=22 \n "
" PRIVACY_POLICY_URL=https://fedoraproject.org/wiki/Legal:PrivacyPolicy \n "
) ,
2017-01-29 08:28:53 +01:00
" /etc/system-release " : " Fedora release 22 (Twenty Two) \n "
2017-05-30 19:05:19 +02:00
} ,
2017-01-29 08:28:53 +01:00
" result " : {
" distribution_release " : " Twenty Two " ,
" distribution " : " Fedora " ,
" distribution_major_version " : " 22 " ,
" os_family " : " RedHat " ,
" distribution_version " : " 22 "
2017-05-30 19:05:19 +02:00
}
} ,
2017-01-29 08:28:53 +01:00
{
" platform.dist " : [
" fedora " ,
" 25 " ,
" Rawhide "
2017-05-30 19:05:19 +02:00
] ,
2019-06-29 01:21:35 +02:00
' distro ' : {
' codename ' : ' Rawhide ' ,
' id ' : ' fedora ' ,
' name ' : ' Fedora ' ,
' version ' : ' 25 ' ,
' version_best ' : ' 25 ' ,
2020-02-11 22:46:48 +01:00
' os_release_info ' : { } ,
' lsb_release_info ' : { } ,
2019-06-29 01:21:35 +02:00
} ,
2017-01-29 08:28:53 +01:00
" input " : {
" /etc/redhat-release " : " Fedora release 25 (Rawhide) \n " ,
2017-05-30 19:05:19 +02:00
" /etc/os-release " : (
" NAME=Fedora \n VERSION= \" 25 (Workstation Edition) \" \n ID=fedora \n VERSION_ID=25 \n "
" PRETTY_NAME= \" Fedora 25 (Workstation Edition) \" \n ANSI_COLOR= \" 0;34 \" \n CPE_NAME= \" cpe:/o:fedoraproject:fedora:25 \" \n "
" HOME_URL= \" https://fedoraproject.org/ \" \n BUG_REPORT_URL= \" https://bugzilla.redhat.com/ \" \n "
" REDHAT_BUGZILLA_PRODUCT= \" Fedora \" \n REDHAT_BUGZILLA_PRODUCT_VERSION=rawhide \n REDHAT_SUPPORT_PRODUCT= \" Fedora \" \n "
" REDHAT_SUPPORT_PRODUCT_VERSION=rawhide \n PRIVACY_POLICY_URL=https://fedoraproject.org/wiki/Legal:PrivacyPolicy \n "
" VARIANT= \" Workstation Edition \" \n VARIANT_ID=workstation \n "
) ,
2017-01-29 08:28:53 +01:00
" /etc/system-release " : " Fedora release 25 (Rawhide) \n "
2017-05-30 19:05:19 +02:00
} ,
2017-01-29 08:28:53 +01:00
" name " : " Fedora 25 " ,
" result " : {
" distribution_release " : " Rawhide " ,
" distribution " : " Fedora " ,
" distribution_major_version " : " 25 " ,
" os_family " : " RedHat " ,
" distribution_version " : " 25 "
2017-05-30 19:05:19 +02:00
}
} ,
2017-01-31 19:25:36 +01:00
{
" platform.dist " : [
" " ,
" " ,
" "
] ,
2019-06-29 01:21:35 +02:00
' distro ' : {
' codename ' : ' ' ,
' id ' : ' smgl ' ,
' name ' : ' Source Mage GNU/Linux ' ,
' version ' : ' ' ,
' version_best ' : ' ' ,
2020-02-11 22:46:48 +01:00
' os_release_info ' : { } ,
' lsb_release_info ' : { } ,
2019-06-29 01:21:35 +02:00
} ,
2017-01-31 19:25:36 +01:00
" input " : {
2017-02-10 18:33:48 +01:00
" /etc/sourcemage-release " : ( " Source Mage GNU/Linux x86_64-pc-linux-gnu \n Installed from tarball using chroot image (Grimoire 0.61-rc) "
" on Thu May 17 17:31:37 UTC 2012 \n " )
2017-01-31 19:25:36 +01:00
} ,
" name " : " SMGL NA " ,
" result " : {
" distribution_release " : " NA " ,
" distribution " : " SMGL " ,
" distribution_major_version " : " NA " ,
" os_family " : " SMGL " ,
" distribution_version " : " NA "
2017-05-30 19:05:19 +02:00
}
} ,
2017-09-25 21:00:31 +02:00
2020-02-11 22:46:48 +01:00
# ArchLinux (container) with `lsb-release` installed. Note that this sets
# /etc/arch-release to "Arch Linux release" and /etc/os-release still does
# not exist.
{
" 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 \n DISTRIB_ID=Arch \n DISTRIB_RELEASE=rolling \n DISTRIB_DESCRIPTION= \" Arch Linux \" \n " ,
" /usr/lib/os-release " : " NAME= \" Arch Linux \" \n PRETTY_NAME= \" Arch Linux \" \n ID=arch \n BUILD_ID=rolling \n ANSI_COLOR= \" 0;36 \" \n HOME_URL= \" https://www.archlinux.org/ \" \n DOCUMENTATION_URL= \" https://wiki.archlinux.org/ \" \n SUPPORT_URL= \" https://bbs.archlinux.org/ \" \n BUG_REPORT_URL= \" https://bugs.archlinux.org/ \" \n LOGO=archlinux \n " # noqa
} ,
" platform.dist " : [
" arch " ,
" rolling " ,
" n/a "
] ,
" result " : {
" distribution " : " Archlinux " ,
" distribution_version " : " rolling " ,
" distribution_release " : " n/a " ,
" distribution_major_version " : " rolling " ,
" os_family " : " Archlinux "
}
} ,
2017-09-25 21:00:31 +02:00
# ArchLinux with an empty /etc/arch-release and a /etc/os-release with "NAME=Arch Linux"
{
" platform.dist " : [
" " ,
" " ,
" "
] ,
2019-06-29 01:21:35 +02:00
' distro ' : {
' codename ' : ' ' ,
' id ' : ' arch ' ,
' name ' : ' Arch Linux ' ,
' version ' : ' ' ,
' version_best ' : ' ' ,
2020-02-11 22:46:48 +01:00
' os_release_info ' : { } ,
' lsb_release_info ' : { } ,
2019-06-29 01:21:35 +02:00
} ,
2017-09-25 21:00:31 +02:00
" input " : {
" /etc/os-release " : " NAME= \" Arch Linux \" \n PRETTY_NAME= \" Arch Linux \" \n ID=arch \n ID_LIKE=archlinux \n ANSI_COLOR= \" 0;36 \" \n HOME_URL= \" https://www.archlinux.org/ \" \n SUPPORT_URL= \" https://bbs.archlinux.org/ \" \n BUG_REPORT_URL= \" https://bugs.archlinux.org/ \" \n \n " , # noqa
" /etc/arch-release " : " " ,
} ,
" name " : " Arch Linux NA " ,
" result " : {
" distribution_release " : " NA " ,
" distribution " : " Archlinux " ,
" distribution_major_version " : " NA " ,
" os_family " : " Archlinux " ,
" distribution_version " : " NA "
}
} ,
2018-01-20 21:05:53 +01:00
# ClearLinux https://github.com/ansible/ansible/issues/31501#issuecomment-340861535
2019-06-29 01:21:35 +02:00
{
" platform.dist " : [
" Clear Linux OS " ,
" 26580 " ,
" clear-linux-os "
] ,
' distro ' : {
' codename ' : ' ' ,
' id ' : ' clear-linux-os ' ,
' name ' : ' Clear Linux OS ' ,
' version ' : ' 26580 ' ,
' version_best ' : ' 26580 ' ,
2020-02-11 22:46:48 +01:00
' os_release_info ' : { } ,
' lsb_release_info ' : { } ,
2019-06-29 01:21:35 +02:00
} ,
" input " : {
" /etc/os-release " : (
' NAME= " Clear Linux OS " \n VERSION=1 \n ID=clear-linux-os \n ID_LIKE=clear-linux-os \n VERSION_ID=26580 \n PRETTY_NAME= " Clear Linux OS " \n '
' ANSI_COLOR= " 1;35 " \n HOME_URL= " https://clearlinux.org " \n SUPPORT_URL= " https://clearlinux.org " \n '
' BUG_REPORT_URL= " mailto:dev@lists.clearlinux.org " \n PRIVACY_POLICY_URL= " http://www.intel.com/privacy " ' ) ,
" /usr/lib/os-release " : (
' NAME= " Clear Linux OS " \n VERSION=1 \n ID=clear-linux-os \n ID_LIKE=clear-linux-os \n VERSION_ID=26580 \n PRETTY_NAME= " Clear Linux OS " \n '
' ANSI_COLOR= " 1;35 " \n HOME_URL= " https://clearlinux.org " \n SUPPORT_URL= " https://clearlinux.org " \n '
' BUG_REPORT_URL= " mailto:dev@lists.clearlinux.org " \n PRIVACY_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 "
}
2018-01-20 21:05:53 +01:00
} ,
2017-09-25 21:00:31 +02:00
# ArchLinux with no /etc/arch-release but with a /etc/os-release with NAME=Arch Linux
# The fact needs to map 'Arch Linux' to 'Archlinux' for compat with 2.3 and earlier facts
{
" platform.dist " : [
" " ,
" " ,
" "
] ,
2019-06-29 01:21:35 +02:00
' distro ' : {
' codename ' : ' ' ,
' id ' : ' arch ' ,
' name ' : ' Arch Linux ' ,
' version ' : ' ' ,
' version_best ' : ' ' ,
2020-02-11 22:46:48 +01:00
' os_release_info ' : { } ,
' lsb_release_info ' : { } ,
2019-06-29 01:21:35 +02:00
} ,
2017-09-25 21:00:31 +02:00
" input " : {
" /etc/os-release " : " NAME= \" Arch Linux \" \n PRETTY_NAME= \" Arch Linux \" \n ID=arch \n ID_LIKE=archlinux \n ANSI_COLOR= \" 0;36 \" \n HOME_URL= \" https://www.archlinux.org/ \" \n SUPPORT_URL= \" https://bbs.archlinux.org/ \" \n BUG_REPORT_URL= \" https://bugs.archlinux.org/ \" \n \n " , # noqa
} ,
" name " : " Arch Linux no arch-release NA " ,
" result " : {
" distribution_release " : " NA " ,
" distribution " : " Archlinux " ,
" distribution_major_version " : " NA " ,
" os_family " : " Archlinux " ,
" distribution_version " : " NA "
}
2019-02-15 18:00:51 +01:00
} ,
{
' name ' : " Cumulus Linux 3.7.3 " ,
' input ' : {
2019-06-29 01:21:35 +02:00
' /etc/os-release ' : (
' NAME= " Cumulus Linux " \n VERSION_ID=3.7.3 \n VERSION= " Cumulus Linux 3.7.3 " \n PRETTY_NAME= " Cumulus Linux " \n ID=cumulus-linux \n '
' ID_LIKE=debian \n CPE_NAME=cpe:/o:cumulusnetworks:cumulus_linux:3.7.3 \n HOME_URL= " http://www.cumulusnetworks.com/ " \n '
' SUPPORT_URL= " http://support.cumulusnetworks.com/ " ' ) ,
2019-02-15 18:00:51 +01:00
} ,
' platform.dist ' : ( ' debian ' , ' 8.11 ' , ' ' ) ,
2019-06-29 01:21:35 +02:00
' distro ' : {
' codename ' : ' ' ,
' id ' : ' cumulus-linux ' ,
' name ' : ' Cumulus Linux ' ,
' version ' : ' 3.7.3 ' ,
' version_best ' : ' 3.7.3 ' ,
2020-02-11 22:46:48 +01:00
' os_release_info ' : { } ,
' lsb_release_info ' : { } ,
2019-06-29 01:21:35 +02:00
} ,
2019-02-15 18:00:51 +01:00
' result ' : {
' distribution ' : ' Cumulus Linux ' ,
' distribution_major_version ' : ' 3 ' ,
' distribution_release ' : ' Cumulus Linux 3.7.3 ' ,
' os_family ' : ' Debian ' ,
' distribution_version ' : ' 3.7.3 ' ,
}
} ,
{
' name ' : " Cumulus Linux 2.5.4 " ,
' input ' : {
2019-06-29 01:21:35 +02:00
' /etc/os-release ' : (
' NAME= " Cumulus Linux " \n VERSION_ID=2.5.4 \n VERSION= " 2.5.4-6dc6e80-201510091936-build " \n PRETTY_NAME= " Cumulus Linux " \n ID=cumulus-linux \n '
' ID_LIKE=debian \n CPE_NAME=cpe:/o:cumulusnetworks:cumulus_linux:2.5.4-6dc6e80-201510091936-build \n HOME_URL= " http://www.cumulusnetworks.com/ " \n '
' SUPPORT_URL= " http://support.cumulusnetworks.com/ " ' ) ,
2019-02-15 18:00:51 +01:00
} ,
' platform.dist ' : ( ' ' , ' ' , ' ' ) ,
2019-06-29 01:21:35 +02:00
' distro ' : {
' codename ' : ' ' ,
' id ' : ' cumulus-linux ' ,
' name ' : ' Cumulus Linux ' ,
' version ' : ' 2.5.4 ' ,
' version_best ' : ' 2.5.4 ' ,
2020-02-11 22:46:48 +01:00
' os_release_info ' : { } ,
' lsb_release_info ' : { } ,
2019-06-29 01:21:35 +02:00
} ,
2019-02-15 18:00:51 +01:00
' result ' : {
' distribution ' : ' Cumulus Linux ' ,
' distribution_major_version ' : ' 2 ' ,
' distribution_release ' : ' 2.5.4-6dc6e80-201510091936-build ' ,
' os_family ' : ' Debian ' ,
' distribution_version ' : ' 2.5.4 ' ,
}
} ,
2019-02-18 03:58:04 +01:00
{
" platform.dist " : [
2019-06-29 01:21:35 +02:00
" linuxmint " ,
" 18.2 " ,
" sonya "
2019-02-18 03:58:04 +01:00
] ,
" input " : {
2019-06-29 01:21:35 +02:00
" /etc/os-release " : (
' NAME= " Linux Mint " \n VERSION= " 18.2 (Sonya) " \n ID=linuxmint \n ID_LIKE=ubuntu \n PRETTY_NAME= " Linux Mint 18.2 " \n '
' VERSION_ID= " 18.2 " \n HOME_URL= " http://www.linuxmint.com/ " \n SUPPORT_URL= " http://forums.linuxmint.com/ " \n '
' BUG_REPORT_URL= " http://bugs.launchpad.net/linuxmint/ " \n VERSION_CODENAME=sonya \n UBUNTU_CODENAME=xenial \n ' ) ,
" /usr/lib/os-release " : (
' NAME= " Linux Mint " \n VERSION= " 18.2 (Sonya) " \n ID=linuxmint \n ID_LIKE=ubuntu \n PRETTY_NAME= " Linux Mint 18.2 " \n '
' VERSION_ID= " 18.2 " \n HOME_URL= " http://www.linuxmint.com/ " \n SUPPORT_URL= " http://forums.linuxmint.com/ " \n '
' BUG_REPORT_URL= " http://bugs.launchpad.net/linuxmint/ " \n VERSION_CODENAME=sonya \n UBUNTU_CODENAME=xenial \n ' ) ,
" /etc/lsb-release " : " DISTRIB_ID=LinuxMint \n DISTRIB_RELEASE=18.2 \n DISTRIB_CODENAME=sonya \n DISTRIB_DESCRIPTION= \" Linux Mint 18.2 Sonya \" \n "
2019-02-18 03:58:04 +01:00
} ,
" result " : {
2019-06-29 01:21:35 +02:00
" distribution_release " : " sonya " ,
2019-02-18 03:58:04 +01:00
" distribution " : " Linux Mint " ,
" distribution_major_version " : " 18 " ,
" os_family " : " Debian " ,
2019-06-29 01:21:35 +02:00
" distribution_version " : " 18.2 "
} ,
" name " : " Linux Mint 18.2 " ,
" distro " : {
" codename " : " sonya " ,
" version " : " 18.2 " ,
" id " : " linuxmint " ,
" version_best " : " 18.2 " ,
2020-02-11 22:46:48 +01:00
" name " : " Linux Mint " ,
" os_release_info " : { } ,
" lsb_release_info " : { } ,
2019-06-29 01:21:35 +02:00
} ,
} ,
2016-04-14 19:44:06 +02:00
]
2016-08-25 16:30:03 +02:00
2018-10-06 01:33:30 +02:00
@pytest.mark.parametrize ( " stdin, testcase " , product ( [ { } ] , TESTSETS ) , ids = lambda x : x . get ( ' name ' ) , indirect = [ ' stdin ' ] )
2017-12-05 21:43:13 +01:00
def test_distribution_version ( am , mocker , testcase ) :
2016-04-14 19:44:06 +02:00
""" 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
2018-12-11 02:04:14 +01:00
* the output of ansible . module_utils . distro . linux_distribution ( ) [ called platform . dist ( ) for historical reasons ]
2016-09-17 23:27:35 +02:00
* results for the ansible variables distribution * and os_family
2016-04-14 18:26:00 +02:00
2016-04-14 19:44:06 +02:00
"""
2017-12-05 21:43:13 +01:00
# prepare some mock functions to get the testdata in
2016-04-14 19:44:06 +02:00
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
2017-05-30 19:05:19 +02:00
print ( ' faked %s for %s ' % ( fname , testcase [ ' name ' ] ) )
2016-04-14 19:44:06 +02:00
data = testcase [ ' input ' ] [ fname ] . strip ( )
if strip and data is not None :
data = data . strip ( )
return data
2019-01-24 02:33:32 +01:00
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
2016-06-07 21:12:37 +02:00
Facts Refresh (2.4 roadmap) (#23012)
Facts Refresh (2.4 roadmap)
This commit implements most of the 2.4 roadmap 'Facts Refresh'
- move facts.py to facts/__init__.py
- move facts Distribution() to its own class
- add a facts/utils.py
- move get_file_content and get_uname_version to facts/utils.py
- move Facts() class from facts/__init__ to facts/facts.py
- mv get_file_lines to facts/utils.py
- mv Ohai()/Facter() class to facts/ohai.py and facter.py
- Start moving fact Hardware() classes to facts/hardware/*.py
- mv HPUX() hardware class to facts/hardware/hpux.py
- move SunOSHardware() fact class to facts/hardware/sunos.py
- move OpenBSDHardware() class to facts/hardware/openbsd.py
- mv FreeBsdHardware() and DragonFlyHardware() to facts/hardware/
- mv NetBSDHardware() to facts/hardware/netbsd.py
- mv Darwin() hardware class to facts/hardware/darwin.py
- pep8/etc cleanups on facts/hardware/*.py
- Mv network facts classes to facts/network/*.py
- mv Virtual fact classes to facts/virtual
- mv Hardware.get_sysctl to facts/sysctl.py:get_sysctl
- Also mv get_uname_version from facts/utils.py -> distribution.py
since distribution.py is the only thing using it.
- add collector.py with new BaseFactCollector
- add a subclass for AnsibleFactCollector
- hook up dict key munging FactNamespaces
- add some test cases for testing the names of facts
- mv timeout stuff to facts.timeout
- rm ansible_facts()/get_all_facts() etc
- Instead of calling facts.ansible_facts(), fact collection
api used by setup.py is now to create an AnsibleFactCollector()
and call it's collect method.
- replace Facts.get_user_facts with UserFactCollector
- add a 'systems' facts package, mv UserFactCollector there
- mv get_dns_facts to DnsFactCollector
- mv get_env_facts to EnvFactCollector
- include the timeout length in exception message
- modules and module_utils that use AnsibleFactCollector
can now theoretically set the 'valid_subsets'
May be useful for network facts module that currently have
to reimplement a good chunk of facts.py to get gather_subsets
to work.
- get_local_facts -> system/LocalFactCollector
- get_date_time -> system/date_time.py
- get_fips_facts -> system/fips.py
- get_caps_facts() -> system/caps.py
- get_apparmor_facts -> system/apparmor.py
- get_selinux_facts -> system/selinux.py
- get_lsb_facts -> system/lsb.py
- get_service_mgr_facts -> system/service_mgr.py
- Facts.is_systemd_managed -> system/service_mgr.py
- get_pkg_mgr_facts -> system/pkg_mgr.py
- Facts()._get_mount_size_facts() -> facts.utils.get_mount_size()
- add unit test for EnvFactCollector
- add a test case for minimal gather_subsets
- add test case for collect_ids
- Make gather_subset match existing behavior or '!all'
If 'gather_subset' is provided as '!all', the existing behavior
(in 2.2/2.3) is that means 'dont collect any facts except those
from the Facts() class'. So 'skip everything except
'apparmor', 'caps', 'date_time', 'env', 'fips', 'local', 'lsb',
'pkg_mgr', 'python', 'selinux', 'service_mgr', 'user', 'platform', etc.
The new facts setup was making '!all' mean no facts at all, since
it can add/exclude at a finer granularity. Since that makes more
sense for the ansible collector, and the set of minimal facts to
collect is really more up to setup.py to decide we do just that.
So if setup.py needs to always collect some gather_subset, even
on !all, setup.py needs to have the that subset added to the
list it passes as minimal_gather_subset.
This should fix some intg tests that assume '!all' means that
some facts are still collected (user info and env for example).
If we want to make setup.py collect a more minimal set, we can do that.
- force facts_dicts.keys() to a list so py3 works
- split fact collector tests to test_collectors.py
- convert Facter(Facts) -> other/facter.py:FacterFactCollector
- add FactCollector.collect_with_namespace()
regular .collect() will return a dict with the key names
using the base names ('ip_address', 'service_mgr' etc)
.collect_with_namespace() will return a dict where the key names
have been transformed with the collectors namespace, if there is
one. For most, this means a namespace that adds 'ansible_' to the
start of the key name.
For 'FacterFactCollector', the namespace transforms the key to
'facter_*'.
- add test cases for collect_with_namespace
- move all the concrete 'which facts does setup.py' stuff to setup.py
The caller of AnsibleFactCollector.from_gather_subset() needs to
pass in the list of collector classes now.
- update system/setup.py to import all of the fact classes and pass
in that list.
- split the Distribution fact class up a bit
extracted the 'distro release' file handling (ie, linux
boxes with /etc/release, /etc/os-release etc) into its
own class.
- extract get_cmdline_facts -> cmdline.py
- extract get_public_ssh_host_keys -> system/ssh_pub_keys.py
- extract get_platform_facts -> system/platform.py
platform.py may be a good candidate for further splitting.
- rm test for plain Facts() base class
- let the base class for Collector unit tests provide collected_facts
some Collectors and/or their migrated Facts() subsclasses need
to look at facts collected by other modules ('ansible_architecture'
the main one...).
Collector.collect() has the collected_facts arg for this, so add
a class variable to BaseFactsTest so we can specify it.
- mv Ohai to other/ohai.py and convert to Collector
- update hardware/*.py to return facts (no side effects)
- mv AnsibleFactCollector to setup.py
- extra collector class gathering to module method in
facts/__init__.py (collector_classes_from_gather_subset)
- add a CollectorMetaDataCollector collector used to provide
the 'gather_setup' fact
- add unit test module for 'setup' module
(test/units/modules/system/setup.py)
- Collector init now doesnt need a module, but collect does
An instance of a FactCollector() isnt tied to a AnsibleModule
instance, but the collect() method can be, so optionally pass
in module to FactCollector.collect() (everywhere)
- add a default_collectors for list of default collectors
import and use it from setup.py module
eventually, would like to replace this with a plugin loader
style class finder/loader
- unit tests for module_utils/facts/__init__.py
- add unit tests for ohai facts collector
- remove self.facts side effect on populate() in hardware/sunos.py
- convert OpenBSDHardware() to rm side effects on self.facts
- try to rm some self.facts side effects in Network()
plumb in collected_facts from populate() where it is needed.
stop passing collected_facts into Network() [via cached_facts=,
where it eventually becomes self.facts]
- nothing provides Fact() cached_facts arg now, rm it
Facts() should be internal only implementation so nothing
should be using it.
Of course, now someone will.
- add a Collector.name attr to build a map of name->_fact_ids
To properly exclude a gather_subset spec like '!hardware', we
need to know that 'hardware' also means 'devices', 'dmi', etc.
Before, '!hardware' would remove the 'hardware' collector name
but not 'devices'. Since both would end up in id_collector_map,
we would still end up with the HardwareCollector in the collector
list. End result being that '!hardware' wouldn't stop hardware
from being collected.
So we need to be able to build that map, so add the Collector.name
attribute that is the primary name (like 'hardware') and let
Collector._fact_ids be the other fact ids that a collector is
responsible for.
Construct the aliases_map of Collector.name -> set of _fact_ids
in fact/__init__.py get_collector_names, and use it when we are
populating the exclude set.
- refactor of distribution.py
make the big OS_FAMILY literal a little easier to read
Also keys can now be any string instead of python literals
99% sure the test for 'KDE Neon' was wrong
I don't see how/where it should or could get 'Neon' instead
of 'KDE Neon' as provided in os-release NAME=
Use 'distribution' string for key to OS_MAP
ie, we dont need to make it a valid python label anymore so dont.
move _has_dist_file to module as _file_exists
easier to mock without mucking with os.path
mv platform.system() calls to within get_distribution_facts() instead
of Distribution() init.
- remove _json compat module
The code in here was to support:
-a 'json' python module that was not the standard one included
with python since 2.6.
- potentially fallback to simplejson if 'json' was not available.
'json' is available for all supported python versions now so
no longer needed.
- mv get_collector_names -> facts.collector
- mv collector_classes_from_gather_subset -> facts.collector
- mv collector tests from test_facts -> test_collector
- Use six's reduce() in sunos/netbsd hardware facts
- rm extraneous get_uname_version in utils
only system/distribution.py uses it
- Remove Facts() subclass metaclass usage
- using fact_id and a platform id for matching collectors
gut most of Facts() subclasses
rm Facts() subclasses with weird metaclass
only add collectors that match the fact_ids and the platform_info
to the list of collectors used.
atm, a collectors platform_id will default to 'Generic', and
any platform matches 'Generic'
goal is to select collector classes including matching the
systems platform in collector.py, instead of relying on
metaclasses in hardware/*. To finish this, the various
Facts() subclasses will need to be replaced entirely with
Collector() subclasses.
use collector classmethod platform_match() to match the platform
This lets the particular class decide if it is compatible with
a given platform_info. platform_info is a dict like obj, so it could be
expanded in the future.
Add a default platform_match to BaseFactCollector that matches
platform_info['system'] == cls._platform
They were needed previously to trigger a module
load on all the collector classes when we import
facts/hardare so that the Hardware() and related
classes that used __new__ and find_all_subclasses()
would work.
Now that is done in collectors based on platform matching
at runtime we dont need to do it py module import/parse
time. So the non empty __init__.pys are no longer needed
and their is a more flexible mechanism for selection
platform specific stuff.
facts/facts.py is no longer used, rm'ed
- if we dont find an implement class for gather spec.. just ignore it.
Would be useful to add a warn to warn about this case.
- Fix SD-UX typo (should be HP-UX)
- Port fix for #21893 (0 sockets) to this branch
This readds the change from 8ad182059d5a085e4f8ecfe8ae63bad14a7dc01c
that got lost in merge/rebase
Fixes #21893
- port sunos fact locale fix for #24542 to this branch
based on e558ec19cd1fd9d00e299cf1938d4ca3cec85cda
Fixes #24542
Solaris fact fix (#24793)
ensure locale for solaris fact gathering
fixes issue with locale interfering with proper reading of decimals
- raise exceptions in the air like we just dont care.
Pretty much ignore any not exit exception in facts
collection. And add some test cases.
- added new selinux fact to clarify python lib
the selinux fact is boolean false when the library is not installed,
a dictionary/hash otherwise, but this is ambigous
added new fact so we can eventually remove the type dichtomy and normalize it as a dict
Re-add of devel commit 85c7a7b844bf429fc9cc0ffce5dd9bf05ed47b5a to
the new code layout, since it got removed in merge/rebase
2017-06-01 17:17:49 +02:00
def mock_file_exists ( fname , allow_empty = False ) :
if fname not in testcase [ ' input ' ] :
return False
2016-04-14 19:44:06 +02:00
Facts Refresh (2.4 roadmap) (#23012)
Facts Refresh (2.4 roadmap)
This commit implements most of the 2.4 roadmap 'Facts Refresh'
- move facts.py to facts/__init__.py
- move facts Distribution() to its own class
- add a facts/utils.py
- move get_file_content and get_uname_version to facts/utils.py
- move Facts() class from facts/__init__ to facts/facts.py
- mv get_file_lines to facts/utils.py
- mv Ohai()/Facter() class to facts/ohai.py and facter.py
- Start moving fact Hardware() classes to facts/hardware/*.py
- mv HPUX() hardware class to facts/hardware/hpux.py
- move SunOSHardware() fact class to facts/hardware/sunos.py
- move OpenBSDHardware() class to facts/hardware/openbsd.py
- mv FreeBsdHardware() and DragonFlyHardware() to facts/hardware/
- mv NetBSDHardware() to facts/hardware/netbsd.py
- mv Darwin() hardware class to facts/hardware/darwin.py
- pep8/etc cleanups on facts/hardware/*.py
- Mv network facts classes to facts/network/*.py
- mv Virtual fact classes to facts/virtual
- mv Hardware.get_sysctl to facts/sysctl.py:get_sysctl
- Also mv get_uname_version from facts/utils.py -> distribution.py
since distribution.py is the only thing using it.
- add collector.py with new BaseFactCollector
- add a subclass for AnsibleFactCollector
- hook up dict key munging FactNamespaces
- add some test cases for testing the names of facts
- mv timeout stuff to facts.timeout
- rm ansible_facts()/get_all_facts() etc
- Instead of calling facts.ansible_facts(), fact collection
api used by setup.py is now to create an AnsibleFactCollector()
and call it's collect method.
- replace Facts.get_user_facts with UserFactCollector
- add a 'systems' facts package, mv UserFactCollector there
- mv get_dns_facts to DnsFactCollector
- mv get_env_facts to EnvFactCollector
- include the timeout length in exception message
- modules and module_utils that use AnsibleFactCollector
can now theoretically set the 'valid_subsets'
May be useful for network facts module that currently have
to reimplement a good chunk of facts.py to get gather_subsets
to work.
- get_local_facts -> system/LocalFactCollector
- get_date_time -> system/date_time.py
- get_fips_facts -> system/fips.py
- get_caps_facts() -> system/caps.py
- get_apparmor_facts -> system/apparmor.py
- get_selinux_facts -> system/selinux.py
- get_lsb_facts -> system/lsb.py
- get_service_mgr_facts -> system/service_mgr.py
- Facts.is_systemd_managed -> system/service_mgr.py
- get_pkg_mgr_facts -> system/pkg_mgr.py
- Facts()._get_mount_size_facts() -> facts.utils.get_mount_size()
- add unit test for EnvFactCollector
- add a test case for minimal gather_subsets
- add test case for collect_ids
- Make gather_subset match existing behavior or '!all'
If 'gather_subset' is provided as '!all', the existing behavior
(in 2.2/2.3) is that means 'dont collect any facts except those
from the Facts() class'. So 'skip everything except
'apparmor', 'caps', 'date_time', 'env', 'fips', 'local', 'lsb',
'pkg_mgr', 'python', 'selinux', 'service_mgr', 'user', 'platform', etc.
The new facts setup was making '!all' mean no facts at all, since
it can add/exclude at a finer granularity. Since that makes more
sense for the ansible collector, and the set of minimal facts to
collect is really more up to setup.py to decide we do just that.
So if setup.py needs to always collect some gather_subset, even
on !all, setup.py needs to have the that subset added to the
list it passes as minimal_gather_subset.
This should fix some intg tests that assume '!all' means that
some facts are still collected (user info and env for example).
If we want to make setup.py collect a more minimal set, we can do that.
- force facts_dicts.keys() to a list so py3 works
- split fact collector tests to test_collectors.py
- convert Facter(Facts) -> other/facter.py:FacterFactCollector
- add FactCollector.collect_with_namespace()
regular .collect() will return a dict with the key names
using the base names ('ip_address', 'service_mgr' etc)
.collect_with_namespace() will return a dict where the key names
have been transformed with the collectors namespace, if there is
one. For most, this means a namespace that adds 'ansible_' to the
start of the key name.
For 'FacterFactCollector', the namespace transforms the key to
'facter_*'.
- add test cases for collect_with_namespace
- move all the concrete 'which facts does setup.py' stuff to setup.py
The caller of AnsibleFactCollector.from_gather_subset() needs to
pass in the list of collector classes now.
- update system/setup.py to import all of the fact classes and pass
in that list.
- split the Distribution fact class up a bit
extracted the 'distro release' file handling (ie, linux
boxes with /etc/release, /etc/os-release etc) into its
own class.
- extract get_cmdline_facts -> cmdline.py
- extract get_public_ssh_host_keys -> system/ssh_pub_keys.py
- extract get_platform_facts -> system/platform.py
platform.py may be a good candidate for further splitting.
- rm test for plain Facts() base class
- let the base class for Collector unit tests provide collected_facts
some Collectors and/or their migrated Facts() subsclasses need
to look at facts collected by other modules ('ansible_architecture'
the main one...).
Collector.collect() has the collected_facts arg for this, so add
a class variable to BaseFactsTest so we can specify it.
- mv Ohai to other/ohai.py and convert to Collector
- update hardware/*.py to return facts (no side effects)
- mv AnsibleFactCollector to setup.py
- extra collector class gathering to module method in
facts/__init__.py (collector_classes_from_gather_subset)
- add a CollectorMetaDataCollector collector used to provide
the 'gather_setup' fact
- add unit test module for 'setup' module
(test/units/modules/system/setup.py)
- Collector init now doesnt need a module, but collect does
An instance of a FactCollector() isnt tied to a AnsibleModule
instance, but the collect() method can be, so optionally pass
in module to FactCollector.collect() (everywhere)
- add a default_collectors for list of default collectors
import and use it from setup.py module
eventually, would like to replace this with a plugin loader
style class finder/loader
- unit tests for module_utils/facts/__init__.py
- add unit tests for ohai facts collector
- remove self.facts side effect on populate() in hardware/sunos.py
- convert OpenBSDHardware() to rm side effects on self.facts
- try to rm some self.facts side effects in Network()
plumb in collected_facts from populate() where it is needed.
stop passing collected_facts into Network() [via cached_facts=,
where it eventually becomes self.facts]
- nothing provides Fact() cached_facts arg now, rm it
Facts() should be internal only implementation so nothing
should be using it.
Of course, now someone will.
- add a Collector.name attr to build a map of name->_fact_ids
To properly exclude a gather_subset spec like '!hardware', we
need to know that 'hardware' also means 'devices', 'dmi', etc.
Before, '!hardware' would remove the 'hardware' collector name
but not 'devices'. Since both would end up in id_collector_map,
we would still end up with the HardwareCollector in the collector
list. End result being that '!hardware' wouldn't stop hardware
from being collected.
So we need to be able to build that map, so add the Collector.name
attribute that is the primary name (like 'hardware') and let
Collector._fact_ids be the other fact ids that a collector is
responsible for.
Construct the aliases_map of Collector.name -> set of _fact_ids
in fact/__init__.py get_collector_names, and use it when we are
populating the exclude set.
- refactor of distribution.py
make the big OS_FAMILY literal a little easier to read
Also keys can now be any string instead of python literals
99% sure the test for 'KDE Neon' was wrong
I don't see how/where it should or could get 'Neon' instead
of 'KDE Neon' as provided in os-release NAME=
Use 'distribution' string for key to OS_MAP
ie, we dont need to make it a valid python label anymore so dont.
move _has_dist_file to module as _file_exists
easier to mock without mucking with os.path
mv platform.system() calls to within get_distribution_facts() instead
of Distribution() init.
- remove _json compat module
The code in here was to support:
-a 'json' python module that was not the standard one included
with python since 2.6.
- potentially fallback to simplejson if 'json' was not available.
'json' is available for all supported python versions now so
no longer needed.
- mv get_collector_names -> facts.collector
- mv collector_classes_from_gather_subset -> facts.collector
- mv collector tests from test_facts -> test_collector
- Use six's reduce() in sunos/netbsd hardware facts
- rm extraneous get_uname_version in utils
only system/distribution.py uses it
- Remove Facts() subclass metaclass usage
- using fact_id and a platform id for matching collectors
gut most of Facts() subclasses
rm Facts() subclasses with weird metaclass
only add collectors that match the fact_ids and the platform_info
to the list of collectors used.
atm, a collectors platform_id will default to 'Generic', and
any platform matches 'Generic'
goal is to select collector classes including matching the
systems platform in collector.py, instead of relying on
metaclasses in hardware/*. To finish this, the various
Facts() subclasses will need to be replaced entirely with
Collector() subclasses.
use collector classmethod platform_match() to match the platform
This lets the particular class decide if it is compatible with
a given platform_info. platform_info is a dict like obj, so it could be
expanded in the future.
Add a default platform_match to BaseFactCollector that matches
platform_info['system'] == cls._platform
They were needed previously to trigger a module
load on all the collector classes when we import
facts/hardare so that the Hardware() and related
classes that used __new__ and find_all_subclasses()
would work.
Now that is done in collectors based on platform matching
at runtime we dont need to do it py module import/parse
time. So the non empty __init__.pys are no longer needed
and their is a more flexible mechanism for selection
platform specific stuff.
facts/facts.py is no longer used, rm'ed
- if we dont find an implement class for gather spec.. just ignore it.
Would be useful to add a warn to warn about this case.
- Fix SD-UX typo (should be HP-UX)
- Port fix for #21893 (0 sockets) to this branch
This readds the change from 8ad182059d5a085e4f8ecfe8ae63bad14a7dc01c
that got lost in merge/rebase
Fixes #21893
- port sunos fact locale fix for #24542 to this branch
based on e558ec19cd1fd9d00e299cf1938d4ca3cec85cda
Fixes #24542
Solaris fact fix (#24793)
ensure locale for solaris fact gathering
fixes issue with locale interfering with proper reading of decimals
- raise exceptions in the air like we just dont care.
Pretty much ignore any not exit exception in facts
collection. And add some test cases.
- added new selinux fact to clarify python lib
the selinux fact is boolean false when the library is not installed,
a dictionary/hash otherwise, but this is ambigous
added new fact so we can eventually remove the type dichtomy and normalize it as a dict
Re-add of devel commit 85c7a7b844bf429fc9cc0ffce5dd9bf05ed47b5a to
the new code layout, since it got removed in merge/rebase
2017-06-01 17:17:49 +02:00
if allow_empty :
return True
return bool ( len ( testcase [ ' input ' ] [ fname ] ) )
2016-04-14 18:26:00 +02:00
2016-06-07 21:12:37 +02:00
def mock_platform_system ( ) :
return testcase . get ( ' platform.system ' , ' Linux ' )
Facts Refresh (2.4 roadmap) (#23012)
Facts Refresh (2.4 roadmap)
This commit implements most of the 2.4 roadmap 'Facts Refresh'
- move facts.py to facts/__init__.py
- move facts Distribution() to its own class
- add a facts/utils.py
- move get_file_content and get_uname_version to facts/utils.py
- move Facts() class from facts/__init__ to facts/facts.py
- mv get_file_lines to facts/utils.py
- mv Ohai()/Facter() class to facts/ohai.py and facter.py
- Start moving fact Hardware() classes to facts/hardware/*.py
- mv HPUX() hardware class to facts/hardware/hpux.py
- move SunOSHardware() fact class to facts/hardware/sunos.py
- move OpenBSDHardware() class to facts/hardware/openbsd.py
- mv FreeBsdHardware() and DragonFlyHardware() to facts/hardware/
- mv NetBSDHardware() to facts/hardware/netbsd.py
- mv Darwin() hardware class to facts/hardware/darwin.py
- pep8/etc cleanups on facts/hardware/*.py
- Mv network facts classes to facts/network/*.py
- mv Virtual fact classes to facts/virtual
- mv Hardware.get_sysctl to facts/sysctl.py:get_sysctl
- Also mv get_uname_version from facts/utils.py -> distribution.py
since distribution.py is the only thing using it.
- add collector.py with new BaseFactCollector
- add a subclass for AnsibleFactCollector
- hook up dict key munging FactNamespaces
- add some test cases for testing the names of facts
- mv timeout stuff to facts.timeout
- rm ansible_facts()/get_all_facts() etc
- Instead of calling facts.ansible_facts(), fact collection
api used by setup.py is now to create an AnsibleFactCollector()
and call it's collect method.
- replace Facts.get_user_facts with UserFactCollector
- add a 'systems' facts package, mv UserFactCollector there
- mv get_dns_facts to DnsFactCollector
- mv get_env_facts to EnvFactCollector
- include the timeout length in exception message
- modules and module_utils that use AnsibleFactCollector
can now theoretically set the 'valid_subsets'
May be useful for network facts module that currently have
to reimplement a good chunk of facts.py to get gather_subsets
to work.
- get_local_facts -> system/LocalFactCollector
- get_date_time -> system/date_time.py
- get_fips_facts -> system/fips.py
- get_caps_facts() -> system/caps.py
- get_apparmor_facts -> system/apparmor.py
- get_selinux_facts -> system/selinux.py
- get_lsb_facts -> system/lsb.py
- get_service_mgr_facts -> system/service_mgr.py
- Facts.is_systemd_managed -> system/service_mgr.py
- get_pkg_mgr_facts -> system/pkg_mgr.py
- Facts()._get_mount_size_facts() -> facts.utils.get_mount_size()
- add unit test for EnvFactCollector
- add a test case for minimal gather_subsets
- add test case for collect_ids
- Make gather_subset match existing behavior or '!all'
If 'gather_subset' is provided as '!all', the existing behavior
(in 2.2/2.3) is that means 'dont collect any facts except those
from the Facts() class'. So 'skip everything except
'apparmor', 'caps', 'date_time', 'env', 'fips', 'local', 'lsb',
'pkg_mgr', 'python', 'selinux', 'service_mgr', 'user', 'platform', etc.
The new facts setup was making '!all' mean no facts at all, since
it can add/exclude at a finer granularity. Since that makes more
sense for the ansible collector, and the set of minimal facts to
collect is really more up to setup.py to decide we do just that.
So if setup.py needs to always collect some gather_subset, even
on !all, setup.py needs to have the that subset added to the
list it passes as minimal_gather_subset.
This should fix some intg tests that assume '!all' means that
some facts are still collected (user info and env for example).
If we want to make setup.py collect a more minimal set, we can do that.
- force facts_dicts.keys() to a list so py3 works
- split fact collector tests to test_collectors.py
- convert Facter(Facts) -> other/facter.py:FacterFactCollector
- add FactCollector.collect_with_namespace()
regular .collect() will return a dict with the key names
using the base names ('ip_address', 'service_mgr' etc)
.collect_with_namespace() will return a dict where the key names
have been transformed with the collectors namespace, if there is
one. For most, this means a namespace that adds 'ansible_' to the
start of the key name.
For 'FacterFactCollector', the namespace transforms the key to
'facter_*'.
- add test cases for collect_with_namespace
- move all the concrete 'which facts does setup.py' stuff to setup.py
The caller of AnsibleFactCollector.from_gather_subset() needs to
pass in the list of collector classes now.
- update system/setup.py to import all of the fact classes and pass
in that list.
- split the Distribution fact class up a bit
extracted the 'distro release' file handling (ie, linux
boxes with /etc/release, /etc/os-release etc) into its
own class.
- extract get_cmdline_facts -> cmdline.py
- extract get_public_ssh_host_keys -> system/ssh_pub_keys.py
- extract get_platform_facts -> system/platform.py
platform.py may be a good candidate for further splitting.
- rm test for plain Facts() base class
- let the base class for Collector unit tests provide collected_facts
some Collectors and/or their migrated Facts() subsclasses need
to look at facts collected by other modules ('ansible_architecture'
the main one...).
Collector.collect() has the collected_facts arg for this, so add
a class variable to BaseFactsTest so we can specify it.
- mv Ohai to other/ohai.py and convert to Collector
- update hardware/*.py to return facts (no side effects)
- mv AnsibleFactCollector to setup.py
- extra collector class gathering to module method in
facts/__init__.py (collector_classes_from_gather_subset)
- add a CollectorMetaDataCollector collector used to provide
the 'gather_setup' fact
- add unit test module for 'setup' module
(test/units/modules/system/setup.py)
- Collector init now doesnt need a module, but collect does
An instance of a FactCollector() isnt tied to a AnsibleModule
instance, but the collect() method can be, so optionally pass
in module to FactCollector.collect() (everywhere)
- add a default_collectors for list of default collectors
import and use it from setup.py module
eventually, would like to replace this with a plugin loader
style class finder/loader
- unit tests for module_utils/facts/__init__.py
- add unit tests for ohai facts collector
- remove self.facts side effect on populate() in hardware/sunos.py
- convert OpenBSDHardware() to rm side effects on self.facts
- try to rm some self.facts side effects in Network()
plumb in collected_facts from populate() where it is needed.
stop passing collected_facts into Network() [via cached_facts=,
where it eventually becomes self.facts]
- nothing provides Fact() cached_facts arg now, rm it
Facts() should be internal only implementation so nothing
should be using it.
Of course, now someone will.
- add a Collector.name attr to build a map of name->_fact_ids
To properly exclude a gather_subset spec like '!hardware', we
need to know that 'hardware' also means 'devices', 'dmi', etc.
Before, '!hardware' would remove the 'hardware' collector name
but not 'devices'. Since both would end up in id_collector_map,
we would still end up with the HardwareCollector in the collector
list. End result being that '!hardware' wouldn't stop hardware
from being collected.
So we need to be able to build that map, so add the Collector.name
attribute that is the primary name (like 'hardware') and let
Collector._fact_ids be the other fact ids that a collector is
responsible for.
Construct the aliases_map of Collector.name -> set of _fact_ids
in fact/__init__.py get_collector_names, and use it when we are
populating the exclude set.
- refactor of distribution.py
make the big OS_FAMILY literal a little easier to read
Also keys can now be any string instead of python literals
99% sure the test for 'KDE Neon' was wrong
I don't see how/where it should or could get 'Neon' instead
of 'KDE Neon' as provided in os-release NAME=
Use 'distribution' string for key to OS_MAP
ie, we dont need to make it a valid python label anymore so dont.
move _has_dist_file to module as _file_exists
easier to mock without mucking with os.path
mv platform.system() calls to within get_distribution_facts() instead
of Distribution() init.
- remove _json compat module
The code in here was to support:
-a 'json' python module that was not the standard one included
with python since 2.6.
- potentially fallback to simplejson if 'json' was not available.
'json' is available for all supported python versions now so
no longer needed.
- mv get_collector_names -> facts.collector
- mv collector_classes_from_gather_subset -> facts.collector
- mv collector tests from test_facts -> test_collector
- Use six's reduce() in sunos/netbsd hardware facts
- rm extraneous get_uname_version in utils
only system/distribution.py uses it
- Remove Facts() subclass metaclass usage
- using fact_id and a platform id for matching collectors
gut most of Facts() subclasses
rm Facts() subclasses with weird metaclass
only add collectors that match the fact_ids and the platform_info
to the list of collectors used.
atm, a collectors platform_id will default to 'Generic', and
any platform matches 'Generic'
goal is to select collector classes including matching the
systems platform in collector.py, instead of relying on
metaclasses in hardware/*. To finish this, the various
Facts() subclasses will need to be replaced entirely with
Collector() subclasses.
use collector classmethod platform_match() to match the platform
This lets the particular class decide if it is compatible with
a given platform_info. platform_info is a dict like obj, so it could be
expanded in the future.
Add a default platform_match to BaseFactCollector that matches
platform_info['system'] == cls._platform
They were needed previously to trigger a module
load on all the collector classes when we import
facts/hardare so that the Hardware() and related
classes that used __new__ and find_all_subclasses()
would work.
Now that is done in collectors based on platform matching
at runtime we dont need to do it py module import/parse
time. So the non empty __init__.pys are no longer needed
and their is a more flexible mechanism for selection
platform specific stuff.
facts/facts.py is no longer used, rm'ed
- if we dont find an implement class for gather spec.. just ignore it.
Would be useful to add a warn to warn about this case.
- Fix SD-UX typo (should be HP-UX)
- Port fix for #21893 (0 sockets) to this branch
This readds the change from 8ad182059d5a085e4f8ecfe8ae63bad14a7dc01c
that got lost in merge/rebase
Fixes #21893
- port sunos fact locale fix for #24542 to this branch
based on e558ec19cd1fd9d00e299cf1938d4ca3cec85cda
Fixes #24542
Solaris fact fix (#24793)
ensure locale for solaris fact gathering
fixes issue with locale interfering with proper reading of decimals
- raise exceptions in the air like we just dont care.
Pretty much ignore any not exit exception in facts
collection. And add some test cases.
- added new selinux fact to clarify python lib
the selinux fact is boolean false when the library is not installed,
a dictionary/hash otherwise, but this is ambigous
added new fact so we can eventually remove the type dichtomy and normalize it as a dict
Re-add of devel commit 85c7a7b844bf429fc9cc0ffce5dd9bf05ed47b5a to
the new code layout, since it got removed in merge/rebase
2017-06-01 17:17:49 +02:00
def mock_platform_release ( ) :
return testcase . get ( ' platform.release ' , ' ' )
def mock_platform_version ( ) :
return testcase . get ( ' platform.version ' , ' ' )
2018-12-11 02:04:14 +01:00
def mock_distro_name ( ) :
2019-06-29 01:21:35 +02:00
return testcase [ ' distro ' ] [ ' name ' ]
def mock_distro_id ( ) :
return testcase [ ' distro ' ] [ ' id ' ]
2018-12-11 02:04:14 +01:00
2019-06-29 01:21:35 +02:00
def mock_distro_version ( best = False ) :
if best :
return testcase [ ' distro ' ] [ ' version_best ' ]
return testcase [ ' distro ' ] [ ' version ' ]
2018-12-11 02:04:14 +01:00
def mock_distro_codename ( ) :
2019-06-29 01:21:35 +02:00
return testcase [ ' distro ' ] [ ' codename ' ]
2018-12-11 02:04:14 +01:00
2020-02-11 22:46:48 +01:00
def mock_distro_os_release_info ( ) :
return testcase [ ' distro ' ] [ ' os_release_info ' ]
def mock_distro_lsb_release_info ( ) :
return testcase [ ' distro ' ] [ ' lsb_release_info ' ]
2018-12-11 02:04:14 +01:00
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
2017-12-05 21:43:13 +01:00
mocker . patch ( ' ansible.module_utils.facts.system.distribution.get_file_content ' , mock_get_file_content )
2019-01-24 02:33:32 +01:00
mocker . patch ( ' ansible.module_utils.facts.system.distribution.get_uname ' , mock_get_uname )
2017-12-05 21:43:13 +01:00
mocker . patch ( ' ansible.module_utils.facts.system.distribution._file_exists ' , mock_file_exists )
2018-12-11 02:04:14 +01:00
mocker . patch ( ' ansible.module_utils.distro.name ' , mock_distro_name )
2019-06-29 01:21:35 +02:00
mocker . patch ( ' ansible.module_utils.distro.id ' , mock_distro_id )
2018-12-11 02:04:14 +01:00
mocker . patch ( ' ansible.module_utils.distro.version ' , mock_distro_version )
mocker . patch ( ' ansible.module_utils.distro.codename ' , mock_distro_codename )
2020-02-11 22:46:48 +01:00
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 )
2018-12-11 02:04:14 +01:00
mocker . patch ( ' os.path.isfile ' , mock_os_path_is_file )
2017-12-05 21:43:13 +01:00
mocker . patch ( ' platform.system ' , mock_platform_system )
mocker . patch ( ' platform.release ' , mock_platform_release )
mocker . patch ( ' platform.version ' , mock_platform_version )
2018-12-11 02:04:14 +01:00
real_open = builtins . open
mocker . patch . object ( builtins , ' open ' , new = mock_open )
2017-12-05 21:43:13 +01:00
# run Facts()
distro_collector = DistributionFactCollector ( )
generated_facts = distro_collector . collect ( am )
2016-04-29 22:18:50 +02:00
2017-12-05 21:43:13 +01:00
# compare with the expected output
2016-04-14 18:26:00 +02:00
2016-04-14 19:44:06 +02:00
# testcase['result'] has a list of variables and values it expects Facts() to set
for key , val in testcase [ ' result ' ] . items ( ) :
2016-04-15 19:30:49 +02:00
assert key in generated_facts
2016-04-14 19:44:06 +02:00
msg = ' Comparing value of %s on %s , should: %s , is: %s ' % \
( key , testcase [ ' name ' ] , val , generated_facts [ key ] )
2016-04-15 19:40:08 +02:00
assert generated_facts [ key ] == val , msg