community.general/lib/ansible/module_utils/facts/system
Anatoly Pugachev fe8412128b facts: solaris: introduce distribution_major version detection for Solaris (#43978)
* facts: solaris: introduce distribution_major version detection for Solaris

Currently, there's no distribution_major in facts module on Solaris OS.
Use "uname -r" output to report major version.

Before the patch we get this on Solaris 11.3 :

$ ansible -o solaris11 -m setup -a filter=ansible_distribution_major_version
solaris11 | SUCCESS => {"ansible_facts": {}, "changed": false}

and after this patch, output is the following:

$ ansible -o solaris11 -m setup -a filter=ansible_distribution_major_version
solaris11 | SUCCESS => {"ansible_facts": {"ansible_distribution_major_version": "11"}, "changed": false}

Tested with Solaris 11.3 and Solaris 10 (both are x86_64 VMs)

Includes patch for test/units.

Fixes #18197

* Try to fix test unit

* should work now...

* fixes for W291 (trailing whitespace) and E265 (block comment)

* mock uname_release for solaris 10 and solaris 11

* facts: solaris: introduce distribution_major version detection for Solaris

Currently, there's no distribution_major in facts module on Solaris OS.
Use "uname -r" output to report major version.

Before the patch we get this on Solaris 11.3 :

$ ansible -o solaris11 -m setup -a filter=ansible_distribution_major_version
solaris11 | SUCCESS => {"ansible_facts": {}, "changed": false}

and after this patch, output is the following:

$ ansible -o solaris11 -m setup -a filter=ansible_distribution_major_version
solaris11 | SUCCESS => {"ansible_facts": {"ansible_distribution_major_version": "11"}, "changed": false}

Tested with Solaris 11.3 and Solaris 10 (both are x86_64 VMs)

Includes patch for test/units.

Fixes #18197

* Try to fix test unit

* should work now...

* fixes for W291 (trailing whitespace) and E265 (block comment)

* mock uname_release for solaris 10 and solaris 11

* typo uname_v -> uname_r

* rebase

* fix pep8 E302: 2 blank lines

* remove int() cast to match test case

* use single function for uname_r and uname_v

* add solaris 11.4 OS to distribution test unit

* fix pep8 sanity - E231 missing whitespace

* distribution_major_version variable strip newline

* mocker test function for mock_get_uname with parameters instead of two different functions

* failed to make one fuction with test unit, revert to use 2 different functions

* try to use single get_uname function

* fix pep8: E703
2019-01-23 20:33:32 -05:00
..
__init__.py Facts Refresh (2.4 roadmap) (#23012) 2017-06-01 11:17:49 -04:00
apparmor.py Facts Refresh (2.4 roadmap) (#23012) 2017-06-01 11:17:49 -04:00
caps.py Facts Refresh (2.4 roadmap) (#23012) 2017-06-01 11:17:49 -04:00
chroot.py made missing cli tools non fatal (#37194) 2018-04-10 17:23:29 -04:00
cmdline.py Cmdline fact uefi 23647 (#25446) 2017-06-08 16:03:29 -04:00
date_time.py Facts Refresh (2.4 roadmap) (#23012) 2017-06-01 11:17:49 -04:00
distribution.py facts: solaris: introduce distribution_major version detection for Solaris (#43978) 2019-01-23 20:33:32 -05:00
dns.py Facts Refresh (2.4 roadmap) (#23012) 2017-06-01 11:17:49 -04:00
env.py Facts Refresh (2.4 roadmap) (#23012) 2017-06-01 11:17:49 -04:00
fips.py Facts Refresh (2.4 roadmap) (#23012) 2017-06-01 11:17:49 -04:00
local.py Facts Refresh (2.4 roadmap) (#23012) 2017-06-01 11:17:49 -04:00
lsb.py Fixes #25725: strip quotes from lsb_release and distribution description. (#31143) 2019-01-11 12:07:26 -05:00
pkg_mgr.py Ensure that apt is always chosen on debian/ubuntu (#44413) 2018-08-20 15:59:56 -04:00
platform.py Fact collector ordering deps (#31362) 2018-01-22 18:23:40 -05:00
python.py Facts Refresh (2.4 roadmap) (#23012) 2017-06-01 11:17:49 -04:00
selinux.py Make ansible_selinux facts a consistent type (#31065) 2017-10-05 09:19:08 -04:00
service_mgr.py Fact collector ordering deps (#31362) 2018-01-22 18:23:40 -05:00
ssh_pub_keys.py Facts Refresh (2.4 roadmap) (#23012) 2017-06-01 11:17:49 -04:00
user.py Facts Refresh (2.4 roadmap) (#23012) 2017-06-01 11:17:49 -04:00