Skip to content

Commit 3d7e939

Browse files
committed
(Bugfix) Fix failing legacy fact autocorrector
Prior to this commit, attempting to autocorrect a legacy fact would output the wrong result. This happened due to a conflict between the actions of the legacy fact plugin and the interference of the top scope fact plugin. This commit aims to prevent the top scope fact plugin from attempting to correct any legacy fact by whitelisting all legacy keywords. Legacy fact plugin already performs the work of the top scope fact plugin so no functionality should be lost.
1 parent 751d30e commit 3d7e939

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

lib/puppet-lint/plugins/top_scope_facts/top_scope_facts.rb

100644100755
Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,17 @@
1717

1818
PuppetLint.new_check(:top_scope_facts) do
1919
def check
20-
whitelist = ['trusted', 'facts'] + (PuppetLint.configuration.top_scope_variables || [])
20+
whitelist = ['trusted', 'facts', 'architecture', 'augeasversion', 'bios_release_date', 'bios_vendor', 'bios_version',
21+
'boardassettag', 'boardmanufacturer', 'boardproductname', 'boardserialnumber', 'chassisassettag', 'chassistype', 'domain',
22+
'fqdn', 'gid', 'hardwareisa', 'hardwaremodel', 'hostname', 'id', 'ipaddress', 'ipaddress6', 'lsbdistcodename',
23+
'lsbdistdescription', 'lsbdistid', 'lsbdistrelease', 'lsbmajdistrelease', 'lsbminordistrelease', 'lsbrelease',
24+
'macaddress', 'macosx_buildversion', 'macosx_productname', 'macosx_productversion', 'macosx_productversion_major',
25+
'macosx_productversion_minor', 'manufacturer', 'memoryfree', 'memorysize', 'netmask', 'netmask6', 'network', 'network6',
26+
'operatingsystem', 'operatingsystemmajrelease', 'operatingsystemrelease', 'osfamily', 'physicalprocessorcount',
27+
'processorcount', 'productname', 'rubyplatform', 'rubysitedir', 'rubyversion', 'selinux', 'selinux_config_mode',
28+
'selinux_config_policy', 'selinux_current_mode', 'selinux_enforced', 'selinux_policyversion', 'serialnumber',
29+
'swapencrypted', 'swapfree', 'swapsize', 'system32', 'uptime', 'uptime_days', 'uptime_hours', 'uptime_seconds',
30+
'uuid', 'xendomains', 'zonename'] + (PuppetLint.configuration.top_scope_variables || [])
2131
whitelist = whitelist.join('|')
2232
tokens.select { |x| TOP_SCOPE_FACTS_VAR_TYPES.include?(x.type) }.each do |token|
2333
next unless %r{^::}.match?(token.value)

0 commit comments

Comments
 (0)