pdk 1.6.0 → 1.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 27c6740e4512862534ffb7115a59480b99262894
4
- data.tar.gz: 65fc2bd610787535d368cb6c2b36fefcf3aef761
3
+ metadata.gz: c70ec79ec06dd3379aa08d51a34733b3794e5b41
4
+ data.tar.gz: f8c3a460c65a788e9ec44332530fc2a815060bee
5
5
  SHA512:
6
- metadata.gz: 9b9849bee4bf285549e04176801b38a9aa3495b3caa9a70c39117fd62f31b831776b9c246e978aa58b6a576756360c8e7f414d803aa88dfd61f47dec501b0c3a
7
- data.tar.gz: 5563dca3dc8a84721c04430cd337d3b221874e2cf7d007e25285a068b79419f143458d97e7d10ccb257c750daa0a119b474d7997c32adb3bf70203875dc14bcb
6
+ metadata.gz: 6e7376cf631ca56e6058619b772bd3a0f08b31aa356842cce3d90c56570fb8d65357217913cf63c6c5d873d0f153bc8f149449a19333570ca77ec8295e79821a
7
+ data.tar.gz: 56afeb93fa8928de3e9a2305f9b29937ecdc0c17323d7b1a8a55fdb64838c302f6ab24cad0be3bf5c5932ddf6c5618924b9238bb102c3d39fc424341fb18cddc
data/CHANGELOG.md CHANGED
@@ -4,6 +4,43 @@ All changes to this repo will be documented in this file.
4
4
  See the [release notes](https://puppet.com/docs/pdk/latest/release_notes.html) for a high-level summary.
5
5
 
6
6
 
7
+ ## [v1.6.1](https://github.com/puppetlabs/pdk/tree/v1.6.1) (2018-07-25)
8
+ [Full Changelog](https://github.com/puppetlabs/pdk/compare/v1.6.0...v1.6.1)
9
+
10
+ **Implemented enhancements:**
11
+
12
+ - PDK `test unit` should cache downloaded modules [\#339](https://github.com/puppetlabs/pdk/issues/339)
13
+
14
+ **Fixed bugs:**
15
+
16
+ - acceptance tests message bundler: command not found: rspec [\#535](https://github.com/puppetlabs/pdk/issues/535)
17
+ - PDK 1.6.0: parallel\_spec causes Puppet coverage reports to change badly [\#531](https://github.com/puppetlabs/pdk/issues/531)
18
+ - Support for deep directory structure in templates [\#445](https://github.com/puppetlabs/pdk/issues/445)
19
+ - \(PDK-1046\) Improve handling of unexpected errors from puppet parser. [\#541](https://github.com/puppetlabs/pdk/pull/541) ([bmjen](https://github.com/bmjen))
20
+ - Correct template path filter logic to only include regular files [\#524](https://github.com/puppetlabs/pdk/pull/524) ([nabertrand](https://github.com/nabertrand))
21
+
22
+ **Closed issues:**
23
+
24
+ - r10k puppetfile install return r10k/cli \(LoadError\) [\#534](https://github.com/puppetlabs/pdk/issues/534)
25
+ - PDK 1.6.0: c.hiera\_config double quotes creates rubocop warning [\#530](https://github.com/puppetlabs/pdk/issues/530)
26
+ - PDK should support integration testing [\#481](https://github.com/puppetlabs/pdk/issues/481)
27
+
28
+ **Merged pull requests:**
29
+
30
+ - \(PDK-1088\) Remove unnecessary file enumeration loop during PDK build [\#553](https://github.com/puppetlabs/pdk/pull/553) ([scotje](https://github.com/scotje))
31
+ - \(PDK-1076\) Change version to 1.6.1.pre [\#552](https://github.com/puppetlabs/pdk/pull/552) ([rodjek](https://github.com/rodjek))
32
+ - \(PDK-1073\) Fix gem bin paths for CLI::Exec managed subprocesses [\#551](https://github.com/puppetlabs/pdk/pull/551) ([scotje](https://github.com/scotje))
33
+ - Set up issues templates for bug reports and feature requests [\#550](https://github.com/puppetlabs/pdk/pull/550) ([scotje](https://github.com/scotje))
34
+ - \(PDK-1045\) Send validation targets as relative file paths [\#549](https://github.com/puppetlabs/pdk/pull/549) ([bmjen](https://github.com/bmjen))
35
+ - \(PDK-1067\) Ensure rspec-core binstubs are created for `pdk test unit` [\#546](https://github.com/puppetlabs/pdk/pull/546) ([scotje](https://github.com/scotje))
36
+ - \(PDK-1041\) Improve handling of errors from PDK::Module::TemplateDir [\#545](https://github.com/puppetlabs/pdk/pull/545) ([rodjek](https://github.com/rodjek))
37
+ - \(PDK-1053\) Print validator output on parse\_output failure [\#543](https://github.com/puppetlabs/pdk/pull/543) ([rodjek](https://github.com/rodjek))
38
+ - \(PDK-1051\) Expose rspec-puppet coverage results to PDK [\#539](https://github.com/puppetlabs/pdk/pull/539) ([rodjek](https://github.com/rodjek))
39
+ - \(PDK-1048\) Improve docs for `pdk test unit --verbose` [\#537](https://github.com/puppetlabs/pdk/pull/537) ([rodjek](https://github.com/rodjek))
40
+ - \(PDK-1061\) Ensure rake binstub when building module [\#536](https://github.com/puppetlabs/pdk/pull/536) ([rodjek](https://github.com/rodjek))
41
+ - \(PDK-925\) Exclude files in spec/fixtures from globbed validation targets [\#532](https://github.com/puppetlabs/pdk/pull/532) ([rodjek](https://github.com/rodjek))
42
+ - \(maint\) Bump version for next dev cycle [\#529](https://github.com/puppetlabs/pdk/pull/529) ([bmjen](https://github.com/bmjen))
43
+
7
44
  ## [v1.6.0](https://github.com/puppetlabs/pdk/tree/v1.6.0) (2018-06-20)
8
45
  [Full Changelog](https://github.com/puppetlabs/pdk/compare/v1.5.0...v1.6.0)
9
46
 
@@ -33,6 +70,8 @@ See the [release notes](https://puppet.com/docs/pdk/latest/release_notes.html) f
33
70
 
34
71
  **Merged pull requests:**
35
72
 
73
+ - \(maint\) Handle tagged template-refs [\#527](https://github.com/puppetlabs/pdk/pull/527) ([rodjek](https://github.com/rodjek))
74
+ - Release 1.6.0 [\#526](https://github.com/puppetlabs/pdk/pull/526) ([bmjen](https://github.com/bmjen))
36
75
  - \(maint\) Switch package-testing to install from build\_data\_url. [\#522](https://github.com/puppetlabs/pdk/pull/522) ([bmjen](https://github.com/bmjen))
37
76
  - CI cleanups [\#507](https://github.com/puppetlabs/pdk/pull/507) ([DavidS](https://github.com/DavidS))
38
77
  - Ensure that the report.txt ends with a newline [\#501](https://github.com/puppetlabs/pdk/pull/501) ([DavidS](https://github.com/DavidS))
@@ -708,4 +747,4 @@ See the [release notes](https://puppet.com/docs/pdk/latest/release_notes.html) f
708
747
 
709
748
 
710
749
 
711
- \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
750
+ \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
data/lib/pdk/cli/exec.rb CHANGED
@@ -141,7 +141,7 @@ module PDK
141
141
  @process.environment['PATH'] = [
142
142
  PDK::Util::RubyVersion.bin_path,
143
143
  File.join(@process.environment['GEM_HOME'], 'bin'),
144
- File.join(@process.environment['GEM_PATH'], 'bin'),
144
+ PDK::Util::RubyVersion.gem_paths_raw.map { |gem_path| File.join(gem_path, 'bin') },
145
145
  package_binpath,
146
146
  ENV['PATH'],
147
147
  PDK::Util.package_install? ? PDK::Util::Git.git_paths : nil,
@@ -10,7 +10,7 @@ module PDK::CLI
10
10
  PDK::CLI.puppet_version_options(self)
11
11
  flag nil, :list, _('List all available unit test files.')
12
12
  flag nil, :parallel, _('Run unit tests in parallel.')
13
- flag :v, :verbose, _('More verbose output. Displays examples in each unit test file.')
13
+ flag :v, :verbose, _('More verbose --list output. Displays a list of examples in each unit test file.')
14
14
  flag :c, 'clean-fixtures', _('Clean up downloaded fixtures after the test run.')
15
15
 
16
16
  option nil, :tests, _('Specify a comma-separated list of unit test files to run.'), argument: :required, default: '' do |values|
@@ -53,6 +53,8 @@ module PDK::CLI
53
53
  end
54
54
  end
55
55
  else
56
+ PDK.logger.info _('--verbose has no effect when not used with --list') if opts[:verbose]
57
+
56
58
  report = PDK::Report.new
57
59
  report_formats = if opts[:format]
58
60
  PDK::CLI::Util::OptionNormalizer.report_formats(opts[:format])
@@ -54,18 +54,22 @@ module PDK
54
54
 
55
55
  template_url = opts.fetch(:'template-url', PDK::Util.default_template_url)
56
56
 
57
- PDK::Module::TemplateDir.new(template_url, metadata.data, true) do |templates|
58
- templates.render do |file_path, file_content|
59
- file = Pathname.new(temp_target_dir) + file_path
60
- file.dirname.mkpath
61
- file.write(file_content)
62
- end
57
+ begin
58
+ PDK::Module::TemplateDir.new(template_url, metadata.data, true) do |templates|
59
+ templates.render do |file_path, file_content|
60
+ file = Pathname.new(temp_target_dir) + file_path
61
+ file.dirname.mkpath
62
+ file.write(file_content)
63
+ end
63
64
 
64
- # Add information about the template used to generate the module to the
65
- # metadata (for a future update command).
66
- metadata.update!(templates.metadata)
65
+ # Add information about the template used to generate the module to the
66
+ # metadata (for a future update command).
67
+ metadata.update!(templates.metadata)
67
68
 
68
- metadata.write!(File.join(temp_target_dir, 'metadata.json'))
69
+ metadata.write!(File.join(temp_target_dir, 'metadata.json'))
70
+ end
71
+ rescue ArgumentError => e
72
+ raise PDK::CLI::ExitWithError, e
69
73
  end
70
74
 
71
75
  if template_url == PDK::Util.puppetlabs_template_url
@@ -224,6 +224,8 @@ module PDK
224
224
  end
225
225
  end
226
226
  end
227
+ rescue ArgumentError => e
228
+ raise PDK::CLI::ExitWithError, e
227
229
  end
228
230
 
229
231
  # Provides the possible template directory locations in the order in
@@ -88,6 +88,9 @@ module PDK
88
88
  #
89
89
  # @return nil
90
90
  def cleanup_module
91
+ PDK::Util::Bundler.ensure_bundle!
92
+ PDK::Util::Bundler.ensure_binstubs!('rake')
93
+
91
94
  PDK::Test::Unit.tear_down
92
95
  end
93
96
 
@@ -196,22 +199,24 @@ module PDK
196
199
  #
197
200
  # @return [PathSpec] The populated ignore path matcher.
198
201
  def ignored_files
199
- @ignored_files ||= if ignore_file.nil?
200
- PathSpec.new
201
- else
202
- fd = File.open(ignore_file, 'rb:UTF-8')
203
- data = fd.read
204
- fd.close
205
-
206
- PathSpec.new(data)
207
- end
208
-
209
- # Also ignore the target directory if it is in the module dir and not already ignored
210
- if Find.find(@module_dir).include?(target_dir) && !@ignored_files.match(File.basename(target_dir) + '/')
211
- @ignored_files = @ignored_files.add("\/#{File.basename(target_dir)}\/")
212
- end
213
-
214
- @ignored_files
202
+ @ignored_files ||=
203
+ begin
204
+ ignored = if ignore_file.nil?
205
+ PathSpec.new
206
+ else
207
+ fd = File.open(ignore_file, 'rb:UTF-8')
208
+ data = fd.read
209
+ fd.close
210
+
211
+ PathSpec.new(data)
212
+ end
213
+
214
+ if File.realdirpath(target_dir).start_with?(File.realdirpath(module_dir))
215
+ ignored = ignored.add("\/#{File.basename(target_dir)}\/")
216
+ end
217
+
218
+ ignored
219
+ end
215
220
  end
216
221
  end
217
222
  end
@@ -94,6 +94,8 @@ module PDK
94
94
  end
95
95
  end
96
96
  end
97
+ rescue ArgumentError => e
98
+ raise PDK::CLI::ExitWithError, e
97
99
  end
98
100
 
99
101
  def update_manager
@@ -185,18 +185,23 @@ module PDK
185
185
  #
186
186
  # @api private
187
187
  def validate_module_template!
188
+ # rubocop:disable Style/GuardClause
188
189
  unless File.directory?(@path)
189
- raise ArgumentError, _("The specified template '%{path}' is not a directory.") % { path: @path }
190
+ if PDK::Util.package_install? && File.fnmatch?(File.join(PDK::Util.package_cachedir, '*'), @path)
191
+ raise ArgumentError, _('The built-in template has substantially changed. Please run "pdk convert" on your module to continue.')
192
+ else
193
+ raise ArgumentError, _("The specified template '%{path}' is not a directory.") % { path: @path }
194
+ end
190
195
  end
191
196
 
192
197
  unless File.directory?(@moduleroot_dir)
193
198
  raise ArgumentError, _("The template at '%{path}' does not contain a 'moduleroot/' directory.") % { path: @path }
194
199
  end
195
200
 
196
- unless File.directory?(@moduleroot_init) # rubocop:disable Style/GuardClause
201
+ unless File.directory?(@moduleroot_init)
197
202
  # rubocop:disable Metrics/LineLength
198
203
  raise ArgumentError, _("The template at '%{path}' does not contain a 'moduleroot_init/' directory, which indicates you are using an older style of template. Before continuing please use the --template-url flag when running the pdk new commands to pass a new style template.") % { path: @path }
199
- # rubocop:enable Metrics/LineLength
204
+ # rubocop:enable Metrics/LineLength Style/GuardClause
200
205
  end
201
206
  end
202
207
 
@@ -212,18 +217,15 @@ module PDK
212
217
  dirs.each do |dir|
213
218
  raise ArgumentError, _("The directory '%{dir}' doesn't exist") % { dir: dir } unless Dir.exist?(dir)
214
219
  temp_paths += Dir.glob(File.join(dir, '**', '*'), File::FNM_DOTMATCH).select do |template_path|
215
- File.file?(template_path) && !File.symlink?(template_path)
216
- dirlocs << dir
220
+ if File.file?(template_path) && !File.symlink?(template_path)
221
+ dirlocs << dir
222
+ end
217
223
  end
218
224
  temp_paths.map do |template_path|
219
225
  template_path.sub!(%r{\A#{Regexp.escape(dir)}#{Regexp.escape(File::SEPARATOR)}}, '')
220
226
  end
221
227
  end
222
- template_paths = Hash[temp_paths.zip dirlocs]
223
- template_paths.delete('.')
224
- template_paths.delete('spec')
225
- template_paths.delete('spec/.')
226
- template_paths
228
+ Hash[temp_paths.zip dirlocs]
227
229
  end
228
230
 
229
231
  # Generate a hash of data to be used when rendering the specified
data/lib/pdk/report.rb CHANGED
@@ -93,13 +93,19 @@ module PDK
93
93
  def write_text(target = self.class.default_target)
94
94
  # Open a File Object for IO if target is a string containing a filename or path
95
95
  target = File.open(target, 'w') if target.is_a? String
96
+ coverage_report = nil
96
97
 
97
98
  events.each do |_tool, tool_events|
98
99
  tool_events.each do |event|
99
- target.puts(event.to_text) unless event.pass?
100
+ if event.rspec_puppet_coverage?
101
+ coverage_report = event.to_text
102
+ else
103
+ target.puts(event.to_text) unless event.pass?
104
+ end
100
105
  end
101
106
  end
102
107
  ensure
108
+ target.puts "\n#{coverage_report}" if coverage_report
103
109
  target.close if target.is_a? File
104
110
  end
105
111
  end
@@ -88,10 +88,26 @@ module PDK
88
88
  state == :skipped
89
89
  end
90
90
 
91
+ # Checks if the event stores the result of an rspec-puppet coverage
92
+ # check.
93
+ #
94
+ # Due to the implementation details of this check, the `file` value for
95
+ # this event will always point to the coverage.rb file in rspec-puppet,
96
+ # making it easy to filter out.
97
+ #
98
+ # @return [Boolean] true if the event contains rspec-puppet coverage
99
+ # results.
100
+ def rspec_puppet_coverage?
101
+ @rspec_puppet_coverage_pattern ||= File.join('**', 'lib', 'rspec-puppet', 'coverage.rb')
102
+ source == 'rspec' && File.fnmatch?(@rspec_puppet_coverage_pattern, File.expand_path(file))
103
+ end
104
+
91
105
  # Renders the event in a clang style text format.
92
106
  #
93
107
  # @return [String] The rendered event.
94
108
  def to_text
109
+ return message if rspec_puppet_coverage?
110
+
95
111
  location = [file, line, column].compact.join(':')
96
112
  location = nil if location.empty?
97
113
 
@@ -64,7 +64,7 @@ module PDK
64
64
  end
65
65
 
66
66
  def self.invoke(report, options = {})
67
- PDK::Util::Bundler.ensure_binstubs!('rake')
67
+ PDK::Util::Bundler.ensure_binstubs!('rake', 'rspec-core')
68
68
 
69
69
  setup
70
70
 
@@ -6,7 +6,7 @@ module PDK
6
6
  class << self
7
7
  extend Forwardable
8
8
 
9
- def_delegators :instance, :gem_path, :gem_home, :available_puppet_versions, :bin_path
9
+ def_delegators :instance, :gem_path, :gem_paths_raw, :gem_home, :available_puppet_versions, :bin_path
10
10
 
11
11
  attr_reader :instance
12
12
 
@@ -72,7 +72,7 @@ module PDK
72
72
  end
73
73
  end
74
74
 
75
- def gem_path
75
+ def gem_paths_raw
76
76
  if PDK::Util.package_install?
77
77
  # Subprocesses use their own set of gems which are managed by pdk or
78
78
  # installed with the package. We also include the separate gem path
@@ -81,16 +81,20 @@ module PDK
81
81
  File.join(PDK::Util.pdk_package_basedir, 'private', 'ruby', ruby_version, 'lib', 'ruby', 'gems', versions[ruby_version]),
82
82
  File.join(PDK::Util.package_cachedir, 'ruby', versions[ruby_version]),
83
83
  File.join(PDK::Util.pdk_package_basedir, 'private', 'puppet', 'ruby', versions[ruby_version]),
84
- ].join(File::PATH_SEPARATOR)
84
+ ]
85
85
  else
86
86
  # This allows the subprocess to find the 'bundler' gem, which isn't
87
87
  # in GEM_HOME for gem installs.
88
88
  # TODO: There must be a better way to do this than shelling out to
89
89
  # gem... Perhaps can be replaced with "Gem.path"?
90
- File.absolute_path(File.join(`gem which bundler`, '..', '..', '..', '..'))
90
+ [File.absolute_path(File.join(`gem which bundler`, '..', '..', '..', '..'))]
91
91
  end
92
92
  end
93
93
 
94
+ def gem_path
95
+ gem_paths_raw.join(File::PATH_SEPARATOR)
96
+ end
97
+
94
98
  def gem_home
95
99
  # `bundle install --path` ignores all "system" installed gems and
96
100
  # causes unnecessary package installs. `bundle install` (without
data/lib/pdk/validate.rb CHANGED
@@ -7,5 +7,7 @@ module PDK
7
7
  def self.validators
8
8
  @validators ||= [MetadataValidator, PuppetValidator, RubyValidator].freeze
9
9
  end
10
+
11
+ class ParseOutputError < StandardError; end
10
12
  end
11
13
  end
@@ -36,14 +36,23 @@ module PDK
36
36
  options[:targets]
37
37
  end
38
38
 
39
+ fixtures_pattern = File.join('**', 'spec', 'fixtures', '**', '*')
39
40
  targets.map! { |r| r.gsub(File::ALT_SEPARATOR, File::SEPARATOR) } if File::ALT_SEPARATOR
40
41
  skipped = []
41
42
  invalid = []
42
43
  matched = targets.map { |target|
43
44
  if respond_to?(:pattern)
44
45
  if File.directory?(target)
45
- pattern_glob = Array(pattern).map { |p| Dir.glob(File.join(PDK::Util.module_root, p)) }
46
- target_list = pattern_glob.flatten.select { |file| File.fnmatch(File.join(File.expand_path(target), '*'), file) }
46
+ target_root = PDK::Util.module_root
47
+ pattern_glob = Array(pattern).map { |p| Dir.glob(File.join(target_root, p)) }
48
+ pattern_glob = pattern_glob.flatten.reject { |file| File.fnmatch(fixtures_pattern, file) }
49
+
50
+ target_list = pattern_glob.map do |file|
51
+ if File.fnmatch(File.join(File.expand_path(target), '*'), file)
52
+ Pathname.new(file).relative_path_from(Pathname.new(PDK::Util.module_root)).to_s
53
+ end
54
+ end
55
+
47
56
  skipped << target if target_list.flatten.empty?
48
57
  target_list
49
58
  elsif File.file?(target)
@@ -126,7 +135,7 @@ module PDK
126
135
  exit_codes = []
127
136
 
128
137
  targets.each do |invokation_targets|
129
- cmd_argv = parse_options(options, invokation_targets).unshift(cmd_path)
138
+ cmd_argv = parse_options(options, invokation_targets).unshift(cmd_path).compact
130
139
  cmd_argv.unshift(File.join(PDK::Util::RubyVersion.bin_path, 'ruby.exe'), '-W0') if Gem.win_platform?
131
140
 
132
141
  command = PDK::CLI::Exec::Command.new(*cmd_argv).tap do |c|
@@ -145,14 +154,23 @@ module PDK
145
154
  if options[:split_exec]
146
155
  options[:split_exec].register do
147
156
  result = command.execute!
148
- parse_output(report, result, invokation_targets)
157
+
158
+ begin
159
+ parse_output(report, result, invokation_targets.compact)
160
+ rescue PDK::Validate::ParseOutputError => e
161
+ $stderr.puts e.message
162
+ end
149
163
  result[:exit_code]
150
164
  end
151
165
  else
152
166
  result = command.execute!
153
167
  exit_codes << result[:exit_code]
154
168
 
155
- parse_output(report, result, invokation_targets)
169
+ begin
170
+ parse_output(report, result, invokation_targets.compact)
171
+ rescue PDK::Validate::ParseOutputError => e
172
+ $stderr.puts e.message
173
+ end
156
174
  end
157
175
  end
158
176
 
@@ -49,14 +49,7 @@ module PDK
49
49
  begin
50
50
  json_data = JSON.parse(result[:stdout])
51
51
  rescue JSON::ParserError
52
- report.add_event(
53
- file: targets.first,
54
- source: name,
55
- state: :error,
56
- severity: :error,
57
- message: result[:stdout],
58
- )
59
- return
52
+ raise PDK::Validate::ParseOutputError, result[:stdout]
60
53
  end
61
54
  end
62
55
 
@@ -34,7 +34,7 @@ module PDK
34
34
  begin
35
35
  json_data = JSON.parse(result[:stdout]).flatten
36
36
  rescue JSON::ParserError
37
- json_data = []
37
+ raise PDK::Validate::ParseOutputError, result[:stdout]
38
38
  end
39
39
 
40
40
  # puppet-lint does not include files without problems in its JSON
@@ -14,6 +14,7 @@ module PDK
14
14
  # - "in file_path"
15
15
  ERROR_CONTEXT_LEGACY = %r{(?:at\sline\s(?<line>\d+)|at\s(?<file>.+?):(?<line>\d+):(?<column>\d+)|at\s(?<file>.+?):(?<line>\d+)|in\s(?<file>.+?))}
16
16
 
17
+ PUPPET_LOGGER_PREFIX = %r{^(debug|info|notice|warning|error|alert|critical):\s.+?$}i
17
18
  PUPPET_SYNTAX_PATTERN = %r{^
18
19
  (?<severity>.+?):\s
19
20
  (?<message>.+?)
@@ -62,7 +63,7 @@ module PDK
62
63
  # puppet parser validate does not include files without problems in its
63
64
  # output, so we need to go through the list of targets and add passing
64
65
  # events to the report for any target not listed in the output.
65
- targets.reject { |target| results_data.any? { |j| j[:file] == target } }.each do |target|
66
+ targets.reject { |target| results_data.any? { |j| j[:file] =~ %r{#{target}} } }.each do |target|
66
67
  report.add_event(
67
68
  file: target,
68
69
  source: name,
@@ -84,10 +85,16 @@ module PDK
84
85
  state: :failure,
85
86
  }
86
87
 
87
- attributes = offense.match(PUPPET_SYNTAX_PATTERN)
88
+ if offense.match(PUPPET_LOGGER_PREFIX)
89
+ attributes = offense.match(PUPPET_SYNTAX_PATTERN)
88
90
 
89
- attributes.names.each do |name|
90
- offense_data[name.to_sym] = attributes[name] unless attributes[name].nil?
91
+ unless attributes.nil?
92
+ attributes.names.each do |name|
93
+ offense_data[name.to_sym] = attributes[name] unless attributes[name].nil?
94
+ end
95
+ end
96
+ else
97
+ offense_data[:message] = offense
91
98
  end
92
99
 
93
100
  offense_data
@@ -40,7 +40,7 @@ module PDK
40
40
  begin
41
41
  json_data = JSON.parse(result[:stdout])
42
42
  rescue JSON::ParserError
43
- json_data = {}
43
+ raise PDK::Validate::ParseOutputError, result[:stdout]
44
44
  end
45
45
 
46
46
  return unless json_data.key?('files')
data/lib/pdk/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module PDK
2
- VERSION = '1.6.0'.freeze
2
+ VERSION = '1.6.1'.freeze
3
3
  TEMPLATE_REF = VERSION
4
4
  end
data/locales/pdk.pot CHANGED
@@ -6,11 +6,11 @@
6
6
  #, fuzzy
7
7
  msgid ""
8
8
  msgstr ""
9
- "Project-Id-Version: puppet development kit v1.5.0-43-ga5c5c15\n"
9
+ "Project-Id-Version: puppet development kit v1.6.0-37-g9a9b458\n"
10
10
  "\n"
11
11
  "Report-Msgid-Bugs-To: docs@puppet.com\n"
12
- "POT-Creation-Date: 2018-06-20 21:35-0700\n"
13
- "PO-Revision-Date: 2018-06-20 21:35-0700\n"
12
+ "POT-Creation-Date: 2018-07-25 13:54+1000\n"
13
+ "PO-Revision-Date: 2018-07-25 13:54+1000\n"
14
14
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
15
15
  "Language-Team: LANGUAGE <LL@li.org>\n"
16
16
  "Language: \n"
@@ -392,7 +392,7 @@ msgid "Run unit tests in parallel."
392
392
  msgstr ""
393
393
 
394
394
  #: ../lib/pdk/cli/test/unit.rb:13
395
- msgid "More verbose output. Displays examples in each unit test file."
395
+ msgid "More verbose --list output. Displays a list of examples in each unit test file."
396
396
  msgstr ""
397
397
 
398
398
  #: ../lib/pdk/cli/test/unit.rb:14
@@ -419,6 +419,10 @@ msgstr ""
419
419
  msgid "\t%{id}\t%{description}"
420
420
  msgstr ""
421
421
 
422
+ #: ../lib/pdk/cli/test/unit.rb:56
423
+ msgid "--verbose has no effect when not used with --list"
424
+ msgstr ""
425
+
422
426
  #: ../lib/pdk/cli/update.rb:7
423
427
  msgid "update [options]"
424
428
  msgstr ""
@@ -570,123 +574,123 @@ msgstr ""
570
574
  msgid "You do not have permission to write to '%{parent_dir}'"
571
575
  msgstr ""
572
576
 
573
- #: ../lib/pdk/generate/module.rb:83
577
+ #: ../lib/pdk/generate/module.rb:87
574
578
  msgid "Module '%{name}' generated at path '%{path}', from template '%{template_url}'."
575
579
  msgstr ""
576
580
 
577
- #: ../lib/pdk/generate/module.rb:84
581
+ #: ../lib/pdk/generate/module.rb:88
578
582
  msgid "In your module directory, add classes with the 'pdk new class' command."
579
583
  msgstr ""
580
584
 
581
- #: ../lib/pdk/generate/module.rb:87
585
+ #: ../lib/pdk/generate/module.rb:91
582
586
  msgid "Failed to move '%{source}' to '%{target}': %{message}"
583
587
  msgstr ""
584
588
 
585
- #: ../lib/pdk/generate/module.rb:101
589
+ #: ../lib/pdk/generate/module.rb:105
586
590
  msgid "Your username is not a valid Forge username. Proceeding with the username %{username}. You can fix this later in metadata.json."
587
591
  msgstr ""
588
592
 
589
- #: ../lib/pdk/generate/module.rb:142
593
+ #: ../lib/pdk/generate/module.rb:146
590
594
  msgid "Unable to create directory '%{dir}': %{message}"
591
595
  msgstr ""
592
596
 
593
- #: ../lib/pdk/generate/module.rb:154
597
+ #: ../lib/pdk/generate/module.rb:158
594
598
  msgid "If you have a name for your module, add it here."
595
599
  msgstr ""
596
600
 
597
- #: ../lib/pdk/generate/module.rb:155
601
+ #: ../lib/pdk/generate/module.rb:159
598
602
  msgid "This is the name that will be associated with your module, it should be relevant to the modules content."
599
603
  msgstr ""
600
604
 
601
- #: ../lib/pdk/generate/module.rb:158
605
+ #: ../lib/pdk/generate/module.rb:162
602
606
  msgid "Module names must begin with a lowercase letter and can only include lowercase letters, numbers, and underscores."
603
607
  msgstr ""
604
608
 
605
- #: ../lib/pdk/generate/module.rb:162
609
+ #: ../lib/pdk/generate/module.rb:166
606
610
  msgid "If you have a Puppet Forge username, add it here."
607
611
  msgstr ""
608
612
 
609
- #: ../lib/pdk/generate/module.rb:163
613
+ #: ../lib/pdk/generate/module.rb:167
610
614
  msgid "We can use this to upload your module to the Forge when it's complete."
611
615
  msgstr ""
612
616
 
613
- #: ../lib/pdk/generate/module.rb:166
617
+ #: ../lib/pdk/generate/module.rb:170
614
618
  msgid "Forge usernames can only contain lowercase letters and numbers"
615
619
  msgstr ""
616
620
 
617
- #: ../lib/pdk/generate/module.rb:171
621
+ #: ../lib/pdk/generate/module.rb:175
618
622
  msgid "What version is this module?"
619
623
  msgstr ""
620
624
 
621
- #: ../lib/pdk/generate/module.rb:172
625
+ #: ../lib/pdk/generate/module.rb:176
622
626
  msgid "Puppet uses Semantic Versioning (semver.org) to version modules."
623
627
  msgstr ""
624
628
 
625
- #: ../lib/pdk/generate/module.rb:175
629
+ #: ../lib/pdk/generate/module.rb:179
626
630
  msgid "Semantic Version numbers must be in the form MAJOR.MINOR.PATCH"
627
631
  msgstr ""
628
632
 
629
- #: ../lib/pdk/generate/module.rb:181
633
+ #: ../lib/pdk/generate/module.rb:185
630
634
  msgid "Who wrote this module?"
631
635
  msgstr ""
632
636
 
633
- #: ../lib/pdk/generate/module.rb:182
637
+ #: ../lib/pdk/generate/module.rb:186
634
638
  msgid "This is used to credit the module's author."
635
639
  msgstr ""
636
640
 
637
- #: ../lib/pdk/generate/module.rb:188
641
+ #: ../lib/pdk/generate/module.rb:192
638
642
  msgid "What license does this module code fall under?"
639
643
  msgstr ""
640
644
 
641
- #: ../lib/pdk/generate/module.rb:189
645
+ #: ../lib/pdk/generate/module.rb:193
642
646
  msgid "This should be an identifier from https://spdx.org/licenses/. Common values are \"Apache-2.0\", \"MIT\", or \"proprietary\"."
643
647
  msgstr ""
644
648
 
645
- #: ../lib/pdk/generate/module.rb:195
649
+ #: ../lib/pdk/generate/module.rb:199
646
650
  msgid "What operating systems does this module support?"
647
651
  msgstr ""
648
652
 
649
- #: ../lib/pdk/generate/module.rb:196
653
+ #: ../lib/pdk/generate/module.rb:200
650
654
  msgid "Use the up and down keys to move between the choices, space to select and enter to continue."
651
655
  msgstr ""
652
656
 
653
- #: ../lib/pdk/generate/module.rb:252
657
+ #: ../lib/pdk/generate/module.rb:256
654
658
  msgid "Summarize the purpose of this module in a single sentence."
655
659
  msgstr ""
656
660
 
657
- #: ../lib/pdk/generate/module.rb:253
661
+ #: ../lib/pdk/generate/module.rb:257
658
662
  msgid "This helps other Puppet users understand what the module does."
659
663
  msgstr ""
660
664
 
661
- #: ../lib/pdk/generate/module.rb:260
665
+ #: ../lib/pdk/generate/module.rb:264
662
666
  msgid "If there is a source code repository for this module, enter the URL here."
663
667
  msgstr ""
664
668
 
665
- #: ../lib/pdk/generate/module.rb:261
669
+ #: ../lib/pdk/generate/module.rb:265
666
670
  msgid "Skip this if no repository exists yet. You can update this later in the metadata.json."
667
671
  msgstr ""
668
672
 
669
- #: ../lib/pdk/generate/module.rb:268
673
+ #: ../lib/pdk/generate/module.rb:272
670
674
  msgid "If there is a URL where others can learn more about this module, enter it here."
671
675
  msgstr ""
672
676
 
673
- #: ../lib/pdk/generate/module.rb:269 ../lib/pdk/generate/module.rb:276
677
+ #: ../lib/pdk/generate/module.rb:273 ../lib/pdk/generate/module.rb:280
674
678
  msgid "Optional. You can update this later in the metadata.json."
675
679
  msgstr ""
676
680
 
677
- #: ../lib/pdk/generate/module.rb:275
681
+ #: ../lib/pdk/generate/module.rb:279
678
682
  msgid "If there is a public issue tracker for this module, enter its URL here."
679
683
  msgstr ""
680
684
 
681
- #: ../lib/pdk/generate/module.rb:302
685
+ #: ../lib/pdk/generate/module.rb:306
682
686
  msgid "update"
683
687
  msgstr ""
684
688
 
685
- #: ../lib/pdk/generate/module.rb:302
689
+ #: ../lib/pdk/generate/module.rb:306
686
690
  msgid "create"
687
691
  msgstr ""
688
692
 
689
- #: ../lib/pdk/generate/module.rb:303
693
+ #: ../lib/pdk/generate/module.rb:307
690
694
  msgid ""
691
695
  "\n"
692
696
  "We need to %{action} the metadata.json file for this module, so we\\'re going to ask you %{count} questions.\n"
@@ -694,19 +698,19 @@ msgid ""
694
698
  "\n"
695
699
  msgstr ""
696
700
 
697
- #: ../lib/pdk/generate/module.rb:317
701
+ #: ../lib/pdk/generate/module.rb:321
698
702
  msgid "No answers given, interview cancelled."
699
703
  msgstr ""
700
704
 
701
- #: ../lib/pdk/generate/module.rb:341
705
+ #: ../lib/pdk/generate/module.rb:345
702
706
  msgid "Metadata will be generated based on this information, continue?"
703
707
  msgstr ""
704
708
 
705
- #: ../lib/pdk/generate/module.rb:343
709
+ #: ../lib/pdk/generate/module.rb:347
706
710
  msgid "Interview cancelled; exiting."
707
711
  msgstr ""
708
712
 
709
- #: ../lib/pdk/generate/module.rb:347
713
+ #: ../lib/pdk/generate/module.rb:351
710
714
  msgid "Process cancelled; exiting."
711
715
  msgstr ""
712
716
 
@@ -778,7 +782,7 @@ msgstr ""
778
782
  msgid "Unable to find the %{type} template in %{url}."
779
783
  msgstr ""
780
784
 
781
- #: ../lib/pdk/generate/puppet_object.rb:280
785
+ #: ../lib/pdk/generate/puppet_object.rb:282
782
786
  msgid "'%{dir}' does not contain valid Puppet module metadata: %{msg}"
783
787
  msgstr ""
784
788
 
@@ -786,7 +790,7 @@ msgstr ""
786
790
  msgid "A task named '%{name}' already exists in this module; defined in %{file}"
787
791
  msgstr ""
788
792
 
789
- #: ../lib/pdk/module/build.rb:157
793
+ #: ../lib/pdk/module/build.rb:160
790
794
  msgid "Symlinks in modules are not supported and will not be included in the package. Please investigate symlink %{from} -> %{to}."
791
795
  msgstr ""
792
796
 
@@ -806,28 +810,28 @@ msgstr ""
806
810
  msgid "skipping '%{path}'"
807
811
  msgstr ""
808
812
 
809
- #: ../lib/pdk/module/convert.rb:118
813
+ #: ../lib/pdk/module/convert.rb:120
810
814
  msgid "Unable to update module metadata; %{path} exists but it is not readable."
811
815
  msgstr ""
812
816
 
813
- #: ../lib/pdk/module/convert.rb:123
817
+ #: ../lib/pdk/module/convert.rb:125
814
818
  msgid "Unable to update module metadata; %{path} exists but it is not a file."
815
819
  msgstr ""
816
820
 
817
- #: ../lib/pdk/module/convert.rb:166 ../lib/pdk/module/convert.rb:171 ../lib/pdk/module/convert.rb:175
821
+ #: ../lib/pdk/module/convert.rb:168 ../lib/pdk/module/convert.rb:173 ../lib/pdk/module/convert.rb:177
818
822
  msgid ""
819
823
  "\n"
820
824
  "%{banner}"
821
825
  msgstr ""
822
826
 
823
- #: ../lib/pdk/module/convert.rb:177
827
+ #: ../lib/pdk/module/convert.rb:179
824
828
  msgid ""
825
829
  "\n"
826
830
  "%{summary}\n"
827
831
  "\n"
828
832
  msgstr ""
829
833
 
830
- #: ../lib/pdk/module/convert.rb:188
834
+ #: ../lib/pdk/module/convert.rb:190
831
835
  msgid ""
832
836
  "\n"
833
837
  "You can find a report of differences in %{path}.\n"
@@ -896,31 +900,35 @@ msgid ""
896
900
  "%{exception}: %{message}"
897
901
  msgstr ""
898
902
 
899
- #: ../lib/pdk/module/templatedir.rb:189
900
- msgid "The specified template '%{path}' is not a directory."
903
+ #: ../lib/pdk/module/templatedir.rb:191
904
+ msgid "The built-in template has substantially changed. Please run \"pdk convert\" on your module to continue."
901
905
  msgstr ""
902
906
 
903
907
  #: ../lib/pdk/module/templatedir.rb:193
904
- msgid "The template at '%{path}' does not contain a 'moduleroot/' directory."
908
+ msgid "The specified template '%{path}' is not a directory."
905
909
  msgstr ""
906
910
 
907
911
  #: ../lib/pdk/module/templatedir.rb:198
912
+ msgid "The template at '%{path}' does not contain a 'moduleroot/' directory."
913
+ msgstr ""
914
+
915
+ #: ../lib/pdk/module/templatedir.rb:203
908
916
  msgid "The template at '%{path}' does not contain a 'moduleroot_init/' directory, which indicates you are using an older style of template. Before continuing please use the --template-url flag when running the pdk new commands to pass a new style template."
909
917
  msgstr ""
910
918
 
911
- #: ../lib/pdk/module/templatedir.rb:213
919
+ #: ../lib/pdk/module/templatedir.rb:218
912
920
  msgid "The directory '%{dir}' doesn't exist"
913
921
  msgstr ""
914
922
 
915
- #: ../lib/pdk/module/templatedir.rb:271
923
+ #: ../lib/pdk/module/templatedir.rb:273
916
924
  msgid "'%{file}' is not a valid YAML file: %{message}"
917
925
  msgstr ""
918
926
 
919
- #: ../lib/pdk/module/templatedir.rb:299
927
+ #: ../lib/pdk/module/templatedir.rb:301
920
928
  msgid "Unable to set HEAD of git repository at '%{repo}' to ref:'%{ref}'."
921
929
  msgstr ""
922
930
 
923
- #: ../lib/pdk/module/templatedir.rb:304
931
+ #: ../lib/pdk/module/templatedir.rb:306
924
932
  msgid "Unable to clone git repository at '%{repo}' into '%{dest}'."
925
933
  msgstr ""
926
934
 
@@ -960,47 +968,47 @@ msgstr ""
960
968
  msgid "You do not have permission to write to '%{path}'"
961
969
  msgstr ""
962
970
 
963
- #: ../lib/pdk/report/event.rb:175
971
+ #: ../lib/pdk/report/event.rb:191
964
972
  msgid "File not specified."
965
973
  msgstr ""
966
974
 
967
- #: ../lib/pdk/report/event.rb:179
975
+ #: ../lib/pdk/report/event.rb:195
968
976
  msgid "File must be a String."
969
977
  msgstr ""
970
978
 
971
- #: ../lib/pdk/report/event.rb:212
979
+ #: ../lib/pdk/report/event.rb:228
972
980
  msgid "State not specified."
973
981
  msgstr ""
974
982
 
975
- #: ../lib/pdk/report/event.rb:217
983
+ #: ../lib/pdk/report/event.rb:233
976
984
  msgid "State must be a Symbol, not %{type}"
977
985
  msgstr ""
978
986
 
979
- #: ../lib/pdk/report/event.rb:222
987
+ #: ../lib/pdk/report/event.rb:238
980
988
  msgid "Invalid state %{state}. Valid states are: %{valid}."
981
989
  msgstr ""
982
990
 
983
- #: ../lib/pdk/report/event.rb:241
991
+ #: ../lib/pdk/report/event.rb:257
984
992
  msgid "Source not specified."
985
993
  msgstr ""
986
994
 
987
- #: ../lib/pdk/report/event.rb:262
995
+ #: ../lib/pdk/report/event.rb:278
988
996
  msgid "Line must be an Integer or a String representation of an Integer."
989
997
  msgstr ""
990
998
 
991
- #: ../lib/pdk/report/event.rb:266
999
+ #: ../lib/pdk/report/event.rb:282
992
1000
  msgid "The line number can contain only the digits 0-9."
993
1001
  msgstr ""
994
1002
 
995
- #: ../lib/pdk/report/event.rb:287
1003
+ #: ../lib/pdk/report/event.rb:303
996
1004
  msgid "Column must be an Integer or a String representation of an Integer."
997
1005
  msgstr ""
998
1006
 
999
- #: ../lib/pdk/report/event.rb:291
1007
+ #: ../lib/pdk/report/event.rb:307
1000
1008
  msgid "The column number can contain only the digits 0-9."
1001
1009
  msgstr ""
1002
1010
 
1003
- #: ../lib/pdk/report/event.rb:309
1011
+ #: ../lib/pdk/report/event.rb:325
1004
1012
  msgid "Trace must be an Array of stack trace lines."
1005
1013
  msgstr ""
1006
1014
 
@@ -1033,11 +1041,11 @@ msgid "Failed to prepare to run the unit tests."
1033
1041
  msgstr ""
1034
1042
 
1035
1043
  #: ../lib/pdk/tests/unit.rb:72
1036
- msgid "Running unit tests."
1044
+ msgid "Running unit tests in parallel."
1037
1045
  msgstr ""
1038
1046
 
1039
1047
  #: ../lib/pdk/tests/unit.rb:72
1040
- msgid "Running unit tests in parallel."
1048
+ msgid "Running unit tests."
1041
1049
  msgstr ""
1042
1050
 
1043
1051
  #: ../lib/pdk/tests/unit.rb:86
@@ -1174,23 +1182,23 @@ msgstr ""
1174
1182
  msgid "Unable to download %{url}. Check internet connectivity and try again. %{error}"
1175
1183
  msgstr ""
1176
1184
 
1177
- #: ../lib/pdk/validate/base_validator.rb:74
1185
+ #: ../lib/pdk/validate/base_validator.rb:83
1178
1186
  msgid "Invoking %{cmd}"
1179
1187
  msgstr ""
1180
1188
 
1181
- #: ../lib/pdk/validate/base_validator.rb:79
1189
+ #: ../lib/pdk/validate/base_validator.rb:88
1182
1190
  msgid "%{validator}: Skipped '%{target}'. Target does not contain any files to validate (%{pattern})."
1183
1191
  msgstr ""
1184
1192
 
1185
- #: ../lib/pdk/validate/base_validator.rb:83
1193
+ #: ../lib/pdk/validate/base_validator.rb:92
1186
1194
  msgid "Target does not contain any files to validate (%{pattern})."
1187
1195
  msgstr ""
1188
1196
 
1189
- #: ../lib/pdk/validate/base_validator.rb:92
1197
+ #: ../lib/pdk/validate/base_validator.rb:101
1190
1198
  msgid "%{validator}: Skipped '%{target}'. Target file not found."
1191
1199
  msgstr ""
1192
1200
 
1193
- #: ../lib/pdk/validate/base_validator.rb:96
1201
+ #: ../lib/pdk/validate/base_validator.rb:105
1194
1202
  msgid "File does not exist."
1195
1203
  msgstr ""
1196
1204
 
@@ -1226,7 +1234,7 @@ msgstr ""
1226
1234
  msgid "Checking Puppet manifest style (%{pattern})."
1227
1235
  msgstr ""
1228
1236
 
1229
- #: ../lib/pdk/validate/puppet/puppet_syntax.rb:40
1237
+ #: ../lib/pdk/validate/puppet/puppet_syntax.rb:41
1230
1238
  msgid "Checking Puppet manifest syntax (%{pattern})."
1231
1239
  msgstr ""
1232
1240
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet, Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-06-21 00:00:00.000000000 Z
11
+ date: 2018-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -295,7 +295,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
295
295
  version: '0'
296
296
  requirements: []
297
297
  rubyforge_project:
298
- rubygems_version: 2.6.14
298
+ rubygems_version: 2.6.14.1
299
299
  signing_key:
300
300
  specification_version: 4
301
301
  summary: A key part of the Puppet Development Kit, the shortest path to better modules