lib/pdk/validate/puppet/puppet_syntax.rb in pdk-akerl-1.9.1.1 vs lib/pdk/validate/puppet/puppet_syntax.rb in pdk-akerl-1.14.0.1
- 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 PuppetSyntax < BaseValidator
# In Puppet >= 5.3.4, the error context formatting was changed to facilitate localization
@@ -34,11 +30,11 @@
def self.cmd
'puppet'
end
def self.pattern
- '**/**.pp'
+ '**/*.pp'
end
def self.pattern_ignore
'/plans/**/*.pp'
end
@@ -61,15 +57,19 @@
ensure
remove_validate_tmpdir
end
def self.validate_tmpdir
+ require 'tmpdir'
+
@validate_tmpdir ||= Dir.mktmpdir('puppet-parser-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