Skip to content

Commit c375c5a

Browse files
GabrielNagyb4ldr
authored andcommitted
(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: puppetlabs/puppet#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.
1 parent 9f66243 commit c375c5a

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

lib/facter/facter_dot_d.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,10 +207,8 @@ def create
207207

208208
# Windows has a different configuration directory that defaults to a vendor
209209
# specific sub directory of the %COMMON_APPDATA% directory.
210-
if Dir.const_defined? 'COMMON_APPDATA' # rubocop:disable Metrics/BlockNesting : Any attempt to alter this breaks it
211-
windows_facts_dot_d = File.join(Dir::COMMON_APPDATA, 'PuppetLabs', 'facter', 'facts.d')
212-
Facter::Util::DotD.new(windows_facts_dot_d).create
213-
end
210+
windows_facts_dot_d = File.join(ENV['ALLUSERSPROFILE'], 'PuppetLabs', 'facter', 'facts.d')
211+
Facter::Util::DotD.new(windows_facts_dot_d).create
214212
end
215213
end
216214
end

0 commit comments

Comments
 (0)