lib/pdk/validate/puppet/puppet_epp.rb in pdk-1.13.0 vs lib/pdk/validate/puppet/puppet_epp.rb in pdk-1.14.0
- old
+ new
@@ -1,10 +1,6 @@
-require 'pdk'
-require 'pdk/cli/exec'
require 'pdk/validate/base_validator'
-require 'fileutils'
-require 'tmpdir'
module PDK
module Validate
class PuppetEPP < BaseValidator
# In Puppet >= 5.3.4, the error context formatting was changed to facilitate localization
@@ -61,15 +57,19 @@
ensure
remove_validate_tmpdir
end
def self.validate_tmpdir
+ require 'tmpdir'
+
@validate_tmpdir ||= Dir.mktmpdir('puppet-epp-validate')
end
def self.remove_validate_tmpdir
return unless @validate_tmpdir
return unless File.directory?(@validate_tmpdir)
+
+ require 'fileutils'
FileUtils.remove_entry_secure(@validate_tmpdir)
@validate_tmpdir = nil
end