From 50e9db7a5bb5b5ced7b63eaf1f030d5ac9288fea Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 12 Jun 2024 15:38:39 +0200 Subject: [PATCH] Purge custom facts --- .rubocop_todo.yml | 12 +-- facts/4.0/oraclelinux-7-x86_64.facts | 109 +--------------------- facts/4.0/scientific-7-x86_64.facts | 110 +---------------------- facts/4.0/solaris-11-sun4v.facts | 40 --------- facts/4.2/windows-2012-x86_64.facts | 45 ---------- facts/4.2/windows-2016-core-x86_64.facts | 45 ---------- facts/4.2/windows-2016-x86_64.facts | 45 ---------- spec/facts_spec.rb | 41 +++++++++ 8 files changed, 49 insertions(+), 398 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index bf571f70..a9efb585 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2024-06-10 08:58:13 UTC using RuboCop version 1.63.5. +# on 2024-06-12 14:45:50 UTC using RuboCop version 1.63.5. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -71,14 +71,14 @@ RSpec/DescribedClass: Exclude: - 'spec/facter_db_spec.rb' -# Offense count: 3 +# Offense count: 5 # Configuration parameters: CountAsOne. RSpec/ExampleLength: - Max: 9 + Max: 13 -# Offense count: 4 +# Offense count: 8 RSpec/MultipleExpectations: - Max: 7 + Max: 13 # Offense count: 11 # Configuration parameters: AllowSubject. @@ -186,7 +186,7 @@ Style/SymbolProc: Exclude: - 'Rakefile' -# Offense count: 4 +# Offense count: 5 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns. # URISchemes: http, https diff --git a/facts/4.0/oraclelinux-7-x86_64.facts b/facts/4.0/oraclelinux-7-x86_64.facts index 54589e6b..eabf4b08 100644 --- a/facts/4.0/oraclelinux-7-x86_64.facts +++ b/facts/4.0/oraclelinux-7-x86_64.facts @@ -454,7 +454,6 @@ "puppetversion": "7.5.0", "whereami": "pdx", "function": "", - "env_temp_variable": "/tmp", "haszfs": false, "ip6tables_version": "1.4.21", "mongodb_is_master": "not_installed", @@ -570,12 +569,6 @@ "platform_symlink_writable": true, "platform_tag": "el-7-x86_64", "jenkins_plugins": "", - "python_release": "2.7", - "python2_release": "2.7", - "puppet_ssldir": "/etc/puppetlabs/puppet/ssl", - "puppet_digest_algorithm": "sha256", - "puppet_config": "/etc/puppetlabs/puppet/puppet.conf", - "puppet_stringify_facts": false, "mco_confdir": "/etc/mcollective/etc", "os_maj_version": "7", "pper_installed": false, @@ -594,105 +587,5 @@ "lvm_vg_centos_pvs": "/dev/sda2", "lvm_pvs": 1, "lvm_pv_0": "/dev/sda2", - "puppet_agent_pid": 2569, - "python_version": "2.7.5", - "python2_version": "2.7.5", - "aio_agent_build": "7.4.1.59.g5d5199a8a", - "aio_agent_version": "7.4.1.59", - "docker_home_dirs": { - "root": "/root", - "bin": "/bin", - "daemon": "/sbin", - "adm": "/var/adm", - "lp": "/var/spool/lpd", - "sync": "/sbin", - "shutdown": "/sbin", - "halt": "/sbin", - "mail": "/var/spool/mail", - "operator": "/root", - "games": "/usr/games", - "ftp": "/var/ftp", - "nobody": "/", - "avahi-autoipd": "/var/lib/avahi-autoipd", - "systemd-bus-proxy": "/", - "systemd-network": "/", - "dbus": "/", - "polkitd": "/", - "rpc": "/var/lib/rpcbind", - "tss": "/dev/null", - "rpcuser": "/var/lib/nfs", - "nfsnobody": "/var/lib/nfs", - "postfix": "/var/spool/postfix", - "sshd": "/var/empty/sshd" - }, - "prometheus_alert_manager_running": false, - "who2bug": [ - - ], - "classification": { - "hostname": "live-pulp", - "parts": [ - "live", - "", - "", - "", - "pulp", - "" - ], - "version": 0, - "group": "live", - "function": "", - "number": "", - "number_string": "", - "context": "", - "stage": "pulp", - "id": "" - }, - "group": "live", - "puppet_inventory_metadata": { - "packages": { - "collection_enabled": false, - "last_collection_time": "0.0s" - } - }, - "function_number": "", - "virt_libvirt": false, - "stage": "pulp", - "mysql_server_id": 23179131, - "selinux_python_command": "python", - "is_pe": false, - "pe_patch": { - "package_updates": [ - - ], - "package_update_count": 0, - "missing_update_kbs": [ - - ], - "security_package_updates": [ - - ], - "security_package_update_count": 0, - "blackouts": { - }, - "pinned_packages": [ - - ], - "last_run": { - }, - "patch_group": "", - "reboot_override": "default", - "reboots": { - "reboot_required": "unknown" - }, - "block_patching_on_warnings": "false", - "warnings": { - "update_file": "Update file not found, update information invalid", - "security_update_file": "Security update file not found, update information invalid" - }, - "blocked": false, - "blocked_reasons": [ - - ] - } + "aio_agent_version": "7.4.1.59" } diff --git a/facts/4.0/scientific-7-x86_64.facts b/facts/4.0/scientific-7-x86_64.facts index 224a9737..9b4df30c 100644 --- a/facts/4.0/scientific-7-x86_64.facts +++ b/facts/4.0/scientific-7-x86_64.facts @@ -454,7 +454,6 @@ "puppetversion": "7.5.0", "whereami": "pdx", "function": "", - "env_temp_variable": "/tmp", "haszfs": false, "ip6tables_version": "1.4.21", "mongodb_is_master": "not_installed", @@ -570,12 +569,6 @@ "platform_symlink_writable": true, "platform_tag": "el-7-x86_64", "jenkins_plugins": "", - "python_release": "2.7", - "python2_release": "2.7", - "puppet_ssldir": "/etc/puppetlabs/puppet/ssl", - "puppet_digest_algorithm": "sha256", - "puppet_config": "/etc/puppetlabs/puppet/puppet.conf", - "puppet_stringify_facts": false, "mco_confdir": "/etc/mcollective/etc", "os_maj_version": "7", "pper_installed": false, @@ -593,106 +586,5 @@ "lvm_vg_0": "centos", "lvm_vg_centos_pvs": "/dev/sda2", "lvm_pvs": 1, - "lvm_pv_0": "/dev/sda2", - "puppet_agent_pid": 2569, - "python_version": "2.7.5", - "python2_version": "2.7.5", - "aio_agent_build": "7.4.1.59.g5d5199a8a", - "aio_agent_version": "7.4.1.59", - "docker_home_dirs": { - "root": "/root", - "bin": "/bin", - "daemon": "/sbin", - "adm": "/var/adm", - "lp": "/var/spool/lpd", - "sync": "/sbin", - "shutdown": "/sbin", - "halt": "/sbin", - "mail": "/var/spool/mail", - "operator": "/root", - "games": "/usr/games", - "ftp": "/var/ftp", - "nobody": "/", - "avahi-autoipd": "/var/lib/avahi-autoipd", - "systemd-bus-proxy": "/", - "systemd-network": "/", - "dbus": "/", - "polkitd": "/", - "rpc": "/var/lib/rpcbind", - "tss": "/dev/null", - "rpcuser": "/var/lib/nfs", - "nfsnobody": "/var/lib/nfs", - "postfix": "/var/spool/postfix", - "sshd": "/var/empty/sshd" - }, - "prometheus_alert_manager_running": false, - "who2bug": [ - - ], - "classification": { - "hostname": "live-pulp", - "parts": [ - "live", - "", - "", - "", - "pulp", - "" - ], - "version": 0, - "group": "live", - "function": "", - "number": "", - "number_string": "", - "context": "", - "stage": "pulp", - "id": "" - }, - "group": "live", - "puppet_inventory_metadata": { - "packages": { - "collection_enabled": false, - "last_collection_time": "0.0s" - } - }, - "function_number": "", - "virt_libvirt": false, - "stage": "pulp", - "mysql_server_id": 23179131, - "selinux_python_command": "python", - "is_pe": false, - "pe_patch": { - "package_updates": [ - - ], - "package_update_count": 0, - "missing_update_kbs": [ - - ], - "security_package_updates": [ - - ], - "security_package_update_count": 0, - "blackouts": { - }, - "pinned_packages": [ - - ], - "last_run": { - }, - "patch_group": "", - "reboot_override": "default", - "reboots": { - "reboot_required": "unknown" - }, - "block_patching_on_warnings": "false", - "warnings": { - "update_file": "Update file not found, update information invalid", - "security_update_file": "Security update file not found, update information invalid" - }, - "blocked": false, - "blocked_reasons": [ - - ] - } + "lvm_pv_0": "/dev/sda2" } diff --git a/facts/4.0/solaris-11-sun4v.facts b/facts/4.0/solaris-11-sun4v.facts index 71680473..bb2e7b37 100644 --- a/facts/4.0/solaris-11-sun4v.facts +++ b/facts/4.0/solaris-11-sun4v.facts @@ -496,47 +496,17 @@ } }, "puppetversion": "7.5.0", - "mysql_server_id": 21745941, - "prometheus_alert_manager_running": false, "java_patch_level": "60", - "env_temp_variable": "/tmp", "mongodb_is_master": "not_installed", - "puppet_ssldir": "/etc/puppetlabs/puppet/ssl", - "puppet_digest_algorithm": "sha256", - "puppet_config": "/etc/puppetlabs/puppet/puppet.conf", - "puppet_stringify_facts": false, "mco_confdir": "/etc/mcollective/etc", - "stage": "1", "platform_symlink_writable": true, - "aio_agent_build": "7.4.1.59.g5d5199a8a", "platform_tag": "solaris-11-sparc", "java_version": "1.8.0_60", "staging_http_get": "curl", "current_environment": "production", - "classification": { - "hostname": "sol11-1", - "parts": [ - "sol", - "", - "", - "", - "1", - "" - ], - "version": 0, - "group": "sol", - "function": "", - "number": "", - "number_string": "", - "context": "", - "stage": "1", - "id": "" - }, "puppet_files_dir_present": false, - "function_number": "", "primary_iface": "eth0", "whereami": "opdx", - "virt_libvirt": false, "java_major_version": "8", "haszfs": true, "vcsrepo_svn_ver": "", @@ -544,8 +514,6 @@ "function": "", "os_maj_version": "11", "group": "sol", - "python_version": "2.7.9", - "python2_version": "2.7.9", "windows_java_temp": "\\tmp", "puppet_cert_paths": { "confdir": "/etc/puppetlabs/puppet", @@ -559,15 +527,7 @@ "python_release": "2.7", "python2_release": "2.7", "primary_ip": "10.32.115.206", - "is_pe": false, "is_valid_hostname": false, - "puppet_inventory_metadata": { - "packages": { - "collection_enabled": false, - "last_collection_time": "0.0s" - } - }, - "puppet_agent_pid": 2288, "puppetserver_installed": false, "context": "", "pip_version": "6.0.8", diff --git a/facts/4.2/windows-2012-x86_64.facts b/facts/4.2/windows-2012-x86_64.facts index 6c68c2c4..74dcb456 100644 --- a/facts/4.2/windows-2012-x86_64.facts +++ b/facts/4.2/windows-2012-x86_64.facts @@ -1,5 +1,4 @@ { - "aio_agent_build": "7.18.0", "aio_agent_version": "7.18.0", "archive_windir": "C:\\ProgramData\\staging", "common_appdata": "C:\\ProgramData", @@ -22,7 +21,6 @@ "privileged": true, "user": "foo\\windows" }, - "is_pe": false, "is_virtual": true, "kernel": "windows", "kernelmajversion": "6.2", @@ -101,43 +99,6 @@ } }, "path": "C:\\Program Files\\Puppet Labs\\Puppet\\puppet\\bin;C:\\Program Files\\Puppet Labs\\Puppet\\bin;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files\\Puppet Labs\\Puppet\\bin", - "pe_patch": { - "blackouts": { - }, - "block_patching_on_warnings": "false", - "blocked": false, - "blocked_reasons": [ - - ], - "last_run": { - }, - "missing_security_kbs": [ - - ], - "missing_update_kbs": [ - - ], - "package_update_count": 0, - "package_updates": [ - - ], - "patch_group": "", - "pinned_packages": [ - - ], - "reboot_override": "default", - "reboots": { - "reboot_required": "unknown" - }, - "security_package_update_count": 0, - "security_package_updates": [ - - ], - "warnings": { - "security_update_file": "Security update file not found, update information invalid", - "update_file": "Update file not found, update information invalid" - } - }, "platform_symlink_writable": false, "processors": { "cores": 2, @@ -150,12 +111,6 @@ "threads": 2 }, "puppet_files_dir_present": false, - "puppet_inventory_metadata": { - "packages": { - "collection_enabled": false, - "last_collection_time": "0.0s" - } - }, "puppetversion": "7.18.0", "ruby": { "platform": "x64-mingw32", diff --git a/facts/4.2/windows-2016-core-x86_64.facts b/facts/4.2/windows-2016-core-x86_64.facts index eb5ce55c..d98f2cdc 100644 --- a/facts/4.2/windows-2016-core-x86_64.facts +++ b/facts/4.2/windows-2016-core-x86_64.facts @@ -1,5 +1,4 @@ { - "aio_agent_build": "7.18.0", "aio_agent_version": "7.18.0", "archive_windir": "C:\\ProgramData\\staging", "common_appdata": "C:\\ProgramData", @@ -22,7 +21,6 @@ "privileged": true, "user": "foo\\windows" }, - "is_pe": false, "is_virtual": true, "kernel": "windows", "kernelmajversion": "10.0", @@ -102,43 +100,6 @@ } }, "path": "C:\\Program Files\\Puppet Labs\\Puppet\\puppet\\bin;C:\\Program Files\\Puppet Labs\\Puppet\\bin;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files\\Puppet Labs\\Puppet\\bin;C:\\Users\\windows\\AppData\\Local\\Microsoft\\WindowsApps", - "pe_patch": { - "blackouts": { - }, - "block_patching_on_warnings": "false", - "blocked": false, - "blocked_reasons": [ - - ], - "last_run": { - }, - "missing_security_kbs": [ - - ], - "missing_update_kbs": [ - - ], - "package_update_count": 0, - "package_updates": [ - - ], - "patch_group": "", - "pinned_packages": [ - - ], - "reboot_override": "default", - "reboots": { - "reboot_required": "unknown" - }, - "security_package_update_count": 0, - "security_package_updates": [ - - ], - "warnings": { - "security_update_file": "Security update file not found, update information invalid", - "update_file": "Update file not found, update information invalid" - } - }, "platform_symlink_writable": false, "processors": { "cores": 2, @@ -151,12 +112,6 @@ "threads": 2 }, "puppet_files_dir_present": false, - "puppet_inventory_metadata": { - "packages": { - "collection_enabled": false, - "last_collection_time": "0.0s" - } - }, "puppetversion": "7.18.0", "ruby": { "platform": "x64-mingw32", diff --git a/facts/4.2/windows-2016-x86_64.facts b/facts/4.2/windows-2016-x86_64.facts index 1e3a9c1c..945bc020 100644 --- a/facts/4.2/windows-2016-x86_64.facts +++ b/facts/4.2/windows-2016-x86_64.facts @@ -1,5 +1,4 @@ { - "aio_agent_build": "7.18.0", "aio_agent_version": "7.18.0", "archive_windir": "C:\\ProgramData\\staging", "common_appdata": "C:\\ProgramData", @@ -22,7 +21,6 @@ "privileged": true, "user": "foo\\windows" }, - "is_pe": false, "is_virtual": true, "kernel": "windows", "kernelmajversion": "10.0", @@ -102,43 +100,6 @@ } }, "path": "C:\\Program Files\\Puppet Labs\\Puppet\\puppet\\bin;C:\\Program Files\\Puppet Labs\\Puppet\\bin;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files\\Puppet Labs\\Puppet\\bin;C:\\Users\\windows\\AppData\\Local\\Microsoft\\WindowsApps", - "pe_patch": { - "blackouts": { - }, - "block_patching_on_warnings": "false", - "blocked": false, - "blocked_reasons": [ - - ], - "last_run": { - }, - "missing_security_kbs": [ - - ], - "missing_update_kbs": [ - - ], - "package_update_count": 0, - "package_updates": [ - - ], - "patch_group": "", - "pinned_packages": [ - - ], - "reboot_override": "default", - "reboots": { - "reboot_required": "unknown" - }, - "security_package_update_count": 0, - "security_package_updates": [ - - ], - "warnings": { - "security_update_file": "Security update file not found, update information invalid", - "update_file": "Update file not found, update information invalid" - } - }, "platform_symlink_writable": false, "processors": { "cores": 2, @@ -151,12 +112,6 @@ "threads": 2 }, "puppet_files_dir_present": false, - "puppet_inventory_metadata": { - "packages": { - "collection_enabled": false, - "last_collection_time": "0.0s" - } - }, "puppetversion": "7.18.0", "ruby": { "platform": "x64-mingw32", diff --git a/spec/facts_spec.rb b/spec/facts_spec.rb index 7c97e10d..652a0f0c 100644 --- a/spec/facts_spec.rb +++ b/spec/facts_spec.rb @@ -110,6 +110,25 @@ expect(content['puppet_server']).to be_nil expect(content['pe_version']).to be_nil expect(content['package_provider']).to be_nil + expect(content['is_pe']).to be_nil + expect(content['pe_major_version']).to be_nil + expect(content['pe_minor_version']).to be_nil + expect(content['pe_patch_version']).to be_nil + end + + it 'contains no facts from puppetlabs/puppet_agent' do + expect(content['env_temp_variable']).to be_nil + expect(content['puppet_agent_appdata']).to be_nil + expect(content['puppet_agent_pid']).to be_nil + expect(content['puppet_runmode']).to be_nil + expect(content['puppet_ssldir']).to be_nil + expect(content['puppet_digest_algorithm']).to be_nil + expect(content['puppet_config']).to be_nil + expect(content['puppet_stringify_facts']).to be_nil + expect(content['puppet_sslpaths']).to be_nil + expect(content['puppet_master_server']).to be_nil + expect(content['puppet_confdir']).to be_nil + expect(content['puppet_client_datadir']).to be_nil end it 'contains no facts from puppet/systemd' do @@ -139,6 +158,28 @@ it 'does not contain the legacy operatingsystem fact' do expect(content['operatingsystem']).to be_nil end + + # those facts aren't default in Open Source Puppet/Facter core + it 'does not contain the PE facts' do + expect(content['pe_patch']).to be_nil + expect(content['puppet_inventory_metadata']).to be_nil + end + + it 'does not contain random facts from known modules' do + expect(content['selinux_python_command']).to be_nil + expect(content['mysql_server_id']).to be_nil + expect(content['stage']).to be_nil + expect(content['virt_libvirt']).to be_nil + expect(content['function_number']).to be_nil + expect(content['classification']).to be_nil + expect(content['who2bug']).to be_nil + expect(content['prometheus_alert_manager_running']).to be_nil + expect(content['docker_home_dirs']).to be_nil + expect(content['aio_agent_build']).to be_nil + expect(content['python2_version']).to be_nil + expect(content['python_version']).to be_nil + expect(content['puppet_agent_pid']).to be_nil + end end end end