From 2ed74a3f294a3c293aae092ac7a00900eac67d66 Mon Sep 17 00:00:00 2001 From: Gabriel Nagy Date: Thu, 10 Sep 2020 15:45:04 +0300 Subject: [PATCH] (PUP-10653) Remove win32/dir constant usage For Puppet 7 we are dropping the `win32/dir` dependency as we only used constants from it, which we replaced with environment variables (see: https://github.com/puppetlabs/puppet/pull/8314). This would become breaking when using the stdlib module with Puppet 7, as the win32 dependencies are no longer provided in the puppet gem. Replace the usage of the `Dir::COMMON_APPDATA` with the `ALLUSERSPROFILE` environment variable. --- lib/facter/facter_dot_d.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/facter/facter_dot_d.rb b/lib/facter/facter_dot_d.rb index b3b161201..0da7a5803 100644 --- a/lib/facter/facter_dot_d.rb +++ b/lib/facter/facter_dot_d.rb @@ -207,10 +207,8 @@ def create # Windows has a different configuration directory that defaults to a vendor # specific sub directory of the %COMMON_APPDATA% directory. - if Dir.const_defined? 'COMMON_APPDATA' # rubocop:disable Metrics/BlockNesting : Any attempt to alter this breaks it - windows_facts_dot_d = File.join(Dir::COMMON_APPDATA, 'PuppetLabs', 'facter', 'facts.d') - Facter::Util::DotD.new(windows_facts_dot_d).create - end + windows_facts_dot_d = File.join(ENV['ALLUSERSPROFILE'], 'PuppetLabs', 'facter', 'facts.d') + Facter::Util::DotD.new(windows_facts_dot_d).create end end end