bolt 3.11.0 → 3.12.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of bolt might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ef5e67102ddbc1b3ef1c0d08352fd5392766b73f3686e54ca62e9f5e09141356
4
- data.tar.gz: dc371bb5483705f7c7dbca0be037aad53338e27480faf1f884eb669f8c14fbb2
3
+ metadata.gz: 6b7b8c5255bf4fcfcfe96a63f2dd479a92018a0a5cccd3898d1ad405232ad7ff
4
+ data.tar.gz: 83cb6eb774b74151c3b6eee76562c0c588da592b3f97a6d744995330cceb7079
5
5
  SHA512:
6
- metadata.gz: 7efd326949ec4d661ff4d4471d9626dcf2688a5e0f699f777d70537135493b2b55250054b6de1989f933a23c8aafb6e2124a7062d32f398218529fd6550ff2b7
7
- data.tar.gz: ac92568d449f852bc39e0c824c9fe6e3c13cee329fa6c5a3bfc1794b01a9b4b9278124456fe4adfd9cebe2ec0056ab42651b5f1aa4f1a56402a743c7893e42a3
6
+ metadata.gz: dfddff8a230e8995804f304e79f0de6a2aa04149fae2c9c5ba1412afb073e5aab31e0c922b14935344c65672195f757e5326e7a7dbd7995acb97b98d154adbc8
7
+ data.tar.gz: f4bc0bfe2f2f12f94c2fe93e0caf2ce6a011b0e25a8d5e933632d6438e86232ec931936d66734bcbba2a955164ef5989f95a271d22aab963d58376d4ed5d6dd3
data/Puppetfile CHANGED
@@ -6,7 +6,7 @@ moduledir File.join(File.dirname(__FILE__), 'modules')
6
6
 
7
7
  # Core modules used by 'apply'
8
8
  mod 'puppetlabs-service', '2.0.0'
9
- mod 'puppetlabs-puppet_agent', '4.7.0'
9
+ mod 'puppetlabs-puppet_agent', '4.8.0'
10
10
  mod 'puppetlabs-facts', '1.4.0'
11
11
 
12
12
  # Core types and providers for Puppet 6
@@ -122,7 +122,13 @@ module Bolt
122
122
  logs.each do |log|
123
123
  bolt_level = Bolt::Util::PuppetLogLevel::MAPPING[log['level'].to_sym]
124
124
  message = log['message'].chomp
125
- @logger.send(bolt_level, "#{target.name}: #{message}")
125
+
126
+ case bolt_level
127
+ when :warn
128
+ handle_warning(target, message)
129
+ else
130
+ @logger.send(bolt_level, "#{target.name}: #{message}")
131
+ end
126
132
  end
127
133
  end
128
134
 
@@ -138,6 +144,22 @@ module Bolt
138
144
  result
139
145
  end
140
146
 
147
+ # Handles logging Puppet warnings, some of which are suppressable.
148
+ #
149
+ # @param target [Bolt::Target] The target the apply ran on.
150
+ # @param message [String] The log message.
151
+ #
152
+ private def handle_warning(target, message)
153
+ # Messages about exported resource declaration and collection, which are
154
+ # not supported in manifest blocks.
155
+ if message.include?(Puppet::Pops::Issues::RT_NO_STORECONFIGS_EXPORT.format) ||
156
+ message.include?(Puppet::Pops::Issues::RT_NO_STORECONFIGS.format)
157
+ Bolt::Logger.warn('exported_resources', "#{target.name}: #{message}")
158
+ else
159
+ @logger.send(:warn, "#{target.name}: #{message}")
160
+ end
161
+ end
162
+
141
163
  def validate_hiera_config(hiera_config)
142
164
  if File.exist?(File.path(hiera_config))
143
165
  data = File.open(File.path(hiera_config), "r:UTF-8") { |f| YAML.safe_load(f.read, [Symbol]) }
data/lib/bolt/error.rb CHANGED
@@ -69,7 +69,7 @@ module Bolt
69
69
  'value' => result.value,
70
70
  'object' => result.object
71
71
  }
72
- message = "Plan aborted: Running container '#{result.object}' failed."
72
+ message = "Running container '#{result.object}' failed."
73
73
  super(message, 'bolt/container-failure', details)
74
74
  @result = result
75
75
  @error_code = 2
@@ -86,7 +86,7 @@ module Bolt
86
86
  'result_set' => result_set
87
87
  }
88
88
  object_msg = " '#{object}'" if object
89
- message = "Plan aborted: #{action}#{object_msg} failed on #{result_set.error_set.length} target"
89
+ message = "#{action}#{object_msg} failed on #{result_set.error_set.length} target"
90
90
  message += "s" unless result_set.error_set.length == 1
91
91
  super(message, 'bolt/run-failure', details)
92
92
  @result_set = result_set
@@ -122,7 +122,7 @@ module Bolt
122
122
  'failed_indices' => failed_indices,
123
123
  'results' => results
124
124
  }
125
- message = "Plan aborted: parallel block failed on #{failed_indices.length} target"
125
+ message = "parallel block failed on #{failed_indices.length} target"
126
126
  message += "s" unless failed_indices.length == 1
127
127
  super(message, 'bolt/parallel-failure', details)
128
128
  @error_code = 2
@@ -462,9 +462,11 @@ module Bolt
462
462
  end
463
463
 
464
464
  def print_topics(topics)
465
- print_message("Available topics are:")
466
- print_message(topics.join("\n"))
467
- print_message("\nUse 'bolt guide <TOPIC>' to view a specific guide.")
465
+ info = +"#{colorize(:cyan, 'Topics')}\n"
466
+ info << indent(2, topics.join("\n"))
467
+ info << "\n\n#{colorize(:cyan, 'Additional information')}\n"
468
+ info << indent(2, "Use 'bolt guide <TOPIC>' to view a specific guide.")
469
+ @stream.puts info
468
470
  end
469
471
 
470
472
  def print_guide(guide, _topic)
data/lib/bolt/pal.rb CHANGED
@@ -324,7 +324,7 @@ module Bolt
324
324
  data['files'].each do |f|
325
325
  # If any file has been updated since we last cached, update the
326
326
  # cache
327
- next if File.mtime(f['path']).to_s == f['mtime']
327
+ next unless file_modified?(f['path'], f['mtime'])
328
328
  data = get_task_info(task_name, with_mtime: true)
329
329
  data = Bolt::Util.walk_keys(data, &:to_s)
330
330
  # Tell Bolt to write to the cache file once we're done
@@ -423,13 +423,10 @@ module Bolt
423
423
 
424
424
  plan_list = plan_names.each_with_object([]) do |plan_name, list|
425
425
  data = plan_cache[plan_name] || get_plan_info(plan_name, with_mtime: true)
426
-
427
- # If the plan is a 'local' plan (in the project itself, or the
428
- # modules/ directory) then verify it hasn't been updated since we
429
- # cached it. If it has been updated, refresh the cache and use the
430
- # new data.
431
- if data['file'] &&
432
- File.mtime(data.dig('file', 'path')).to_s != data.dig('file', 'mtime')
426
+ # If the plan is a 'local' plan (in the project itself, or the modules/
427
+ # directory) then verify it hasn't been updated since we cached it. If
428
+ # it has been updated, refresh the cache and use the new data.
429
+ if file_modified?(data.dig('file', 'path'), data.dig('file', 'mtime'))
433
430
  data = get_plan_info(plan_name, with_mtime: true)
434
431
  updated = true
435
432
  plan_cache[plan_name] = data
@@ -443,6 +440,16 @@ module Bolt
443
440
  filter_content ? filter_content(plan_list, @project&.plans) : plan_list
444
441
  end
445
442
 
443
+ # Returns true if a file has been modified or no longer exists, false
444
+ # otherwise.
445
+ #
446
+ # @param path [String] The path to the file.
447
+ # @param mtime [String] The last time the file was modified.
448
+ #
449
+ private def file_modified?(path, mtime)
450
+ path && !(File.exist?(path) && File.mtime(path).to_s == mtime)
451
+ end
452
+
446
453
  def list_plans(filter_content: false)
447
454
  in_bolt_compiler do |compiler|
448
455
  errors = []
data/lib/bolt/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bolt
4
- VERSION = '3.11.0'
4
+ VERSION = '3.12.0'
5
5
  end
@@ -16,7 +16,10 @@
16
16
  }
17
17
  },
18
18
  "additionalProperties": false
19
+ },
20
+ "versioned_project": {
21
+ "type": "string"
19
22
  }
20
23
  },
21
- "required": ["puppet_connect_data"]
24
+ "required": ["puppet_connect_data", "versioned_project"]
22
25
  }
@@ -637,11 +637,10 @@ module BoltServer
637
637
  #
638
638
  # @param versioned_project [String] the versioned_project to compute the inventory from
639
639
  post '/project_inventory_targets' do
640
- raise BoltServer::RequestError, "'versioned_project' is a required argument" if params['versioned_project'].nil?
641
640
  content_type :json
642
641
  body = JSON.parse(request.body.read)
643
642
  validate_schema(@schemas["connect-data"], body)
644
- in_bolt_project(params['versioned_project']) do |context|
643
+ in_bolt_project(body['versioned_project']) do |context|
645
644
  if context[:config].inventoryfile &&
646
645
  context[:config].project.inventory_file.to_s !=
647
646
  context[:config].inventoryfile
@@ -88,7 +88,7 @@ plan canary(
88
88
  $message = "Plan failed for ${merged_result.error_set.count} targets."
89
89
  }
90
90
  else {
91
- $message = "Plan aborted. ${canr.error_set.count} canary target failures. ${restr.count} targets skipped."
91
+ $message = "${canr.error_set.count} canary target failures. ${restr.count} targets skipped."
92
92
  }
93
93
  $details = {'action' => $action,
94
94
  'object' => $object,
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bolt
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.11.0
4
+ version: 3.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-06-21 00:00:00.000000000 Z
11
+ date: 2021-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable