bolt 3.9.1 → 3.13.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 +4 -4
- data/Puppetfile +4 -4
- data/bolt-modules/log/lib/puppet/functions/log/debug.rb +39 -0
- data/bolt-modules/log/lib/puppet/functions/log/error.rb +40 -0
- data/bolt-modules/log/lib/puppet/functions/log/fatal.rb +40 -0
- data/bolt-modules/log/lib/puppet/functions/log/info.rb +39 -0
- data/bolt-modules/log/lib/puppet/functions/log/trace.rb +39 -0
- data/bolt-modules/log/lib/puppet/functions/log/warn.rb +41 -0
- data/bolt-modules/out/lib/puppet/functions/out/message.rb +6 -48
- data/bolt-modules/out/lib/puppet/functions/out/verbose.rb +33 -0
- data/guides/debugging.txt +28 -0
- data/lib/bolt/applicator.rb +23 -1
- data/lib/bolt/bolt_option_parser.rb +52 -5
- data/lib/bolt/cli.rb +40 -11
- data/lib/bolt/config/options.rb +2 -2
- data/lib/bolt/config/transport/docker.rb +0 -4
- data/lib/bolt/config/transport/podman.rb +0 -4
- data/lib/bolt/error.rb +3 -3
- data/lib/bolt/module_installer/installer.rb +1 -1
- data/lib/bolt/outputter/human.rb +52 -5
- data/lib/bolt/outputter/json.rb +11 -0
- data/lib/bolt/outputter/logger.rb +6 -0
- data/lib/bolt/pal.rb +110 -19
- data/lib/bolt/plugin.rb +38 -0
- data/lib/bolt/plugin/env_var.rb +8 -1
- data/lib/bolt/plugin/module.rb +1 -1
- data/lib/bolt/plugin/prompt.rb +8 -1
- data/lib/bolt/plugin/puppet_connect_data.rb +8 -1
- data/lib/bolt/plugin/puppetdb.rb +7 -1
- data/lib/bolt/plugin/task.rb +9 -1
- data/lib/bolt/project.rb +2 -1
- data/lib/bolt/task.rb +7 -0
- data/lib/bolt/util/format.rb +68 -0
- data/lib/bolt/version.rb +1 -1
- data/lib/bolt_server/schemas/connect-data.json +4 -1
- data/lib/bolt_server/transport_app.rb +82 -2
- data/lib/bolt_spec/bolt_context.rb +9 -0
- data/lib/bolt_spec/plans.rb +1 -1
- data/lib/bolt_spec/plans/mock_executor.rb +16 -2
- data/lib/bolt_spec/plans/publish_stub.rb +4 -4
- data/modules/canary/plans/init.pp +1 -1
- data/resources/bolt_bash_completion.sh +214 -0
- metadata +12 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80a2245a2ac92c15284c4d6206f5480c6cf72033b32b773a98303b634f853e54
|
4
|
+
data.tar.gz: 4a6e868eba652ea23cb8530a135e3187fae81296d63df8bf9b54d5c2117df615
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7373197cc0401a971ff8e68ed70ef31f90d2087d09a5a0a5178124e40d2aae59546db768480fb5ea65f2b2993d60104abcf137df281863ddaf37c69d58365e5
|
7
|
+
data.tar.gz: 338c72c31cc379aaf45adae5a122a2a2e9fe6dede738aec4b46c21b5102d16a00ee5a494514dd80bc9f4fcd922ee08e62164e64d34987d40ad1d7383ff475363
|
data/Puppetfile
CHANGED
@@ -6,13 +6,13 @@ 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.
|
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
|
13
13
|
mod 'puppetlabs-augeas_core', '1.1.2'
|
14
14
|
mod 'puppetlabs-host_core', '1.0.3'
|
15
|
-
mod 'puppetlabs-scheduled_task', '3.0.
|
15
|
+
mod 'puppetlabs-scheduled_task', '3.0.1'
|
16
16
|
mod 'puppetlabs-sshkeys_core', '2.2.0'
|
17
17
|
mod 'puppetlabs-zfs_core', '1.2.0'
|
18
18
|
mod 'puppetlabs-cron_core', '1.0.5'
|
@@ -29,14 +29,14 @@ mod 'puppetlabs-python_task_helper', '0.5.0'
|
|
29
29
|
mod 'puppetlabs-reboot', '4.0.2'
|
30
30
|
mod 'puppetlabs-ruby_task_helper', '0.6.0'
|
31
31
|
mod 'puppetlabs-ruby_plugin_helper', '0.2.0'
|
32
|
-
mod 'puppetlabs-stdlib', '7.0
|
32
|
+
mod 'puppetlabs-stdlib', '7.1.0'
|
33
33
|
|
34
34
|
# Plugin modules
|
35
35
|
mod 'puppetlabs-aws_inventory', '0.7.0'
|
36
36
|
mod 'puppetlabs-azure_inventory', '0.5.0'
|
37
37
|
mod 'puppetlabs-gcloud_inventory', '0.3.0'
|
38
38
|
mod 'puppetlabs-http_request', '0.2.2'
|
39
|
-
mod 'puppetlabs-pkcs7', '0.1.
|
39
|
+
mod 'puppetlabs-pkcs7', '0.1.2'
|
40
40
|
mod 'puppetlabs-secure_env_vars', '0.2.0'
|
41
41
|
mod 'puppetlabs-terraform', '0.6.1'
|
42
42
|
mod 'puppetlabs-vault', '0.4.0'
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'bolt/util/format'
|
4
|
+
|
5
|
+
# Log a debugging message.
|
6
|
+
#
|
7
|
+
# Messages logged at this level typically include detailed information about
|
8
|
+
# what a plan is doing. For example, you might log a message at the `debug`
|
9
|
+
# level that shows what value is returned from a function invocation.
|
10
|
+
#
|
11
|
+
# See [Logs](logs.md) for more information about Bolt's log levels.
|
12
|
+
#
|
13
|
+
# > **Note:** Not available in apply block
|
14
|
+
Puppet::Functions.create_function(:'log::debug') do
|
15
|
+
# Log a debugging message.
|
16
|
+
# @param message The message to log.
|
17
|
+
# @example Log a debugging message
|
18
|
+
# log::debug("Function frogsay returned: ${result}")
|
19
|
+
dispatch :log_debug do
|
20
|
+
param 'Any', :message
|
21
|
+
return_type 'Undef'
|
22
|
+
end
|
23
|
+
|
24
|
+
def log_debug(message)
|
25
|
+
unless Puppet[:tasks]
|
26
|
+
raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
|
27
|
+
Bolt::PAL::Issues::PLAN_OPERATION_NOT_SUPPORTED_WHEN_COMPILING,
|
28
|
+
action: 'log::debug'
|
29
|
+
)
|
30
|
+
end
|
31
|
+
|
32
|
+
Puppet.lookup(:bolt_executor).tap do |executor|
|
33
|
+
executor.report_function_call(self.class.name)
|
34
|
+
executor.publish_event(type: :log, level: :debug, message: Bolt::Util::Format.stringify(message))
|
35
|
+
end
|
36
|
+
|
37
|
+
nil
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'bolt/util/format'
|
4
|
+
|
5
|
+
# Log an error message.
|
6
|
+
#
|
7
|
+
# Messages logged at this level typically indicate that the plan encountered an
|
8
|
+
# error that can be recovered from. For example, you might log a message at the
|
9
|
+
# `error` level if you want to inform the user an action running on a target
|
10
|
+
# failed but that the plan will continue running.
|
11
|
+
#
|
12
|
+
# See [Logs](logs.md) for more information about Bolt's log levels.
|
13
|
+
#
|
14
|
+
# > **Note:** Not available in apply block
|
15
|
+
Puppet::Functions.create_function(:'log::error') do
|
16
|
+
# Log an error message.
|
17
|
+
# @param message The message to log.
|
18
|
+
# @example Log an error message
|
19
|
+
# log::error("The HTTP request returned an error, continuing the plan: ${result}")
|
20
|
+
dispatch :log_error do
|
21
|
+
param 'Any', :message
|
22
|
+
return_type 'Undef'
|
23
|
+
end
|
24
|
+
|
25
|
+
def log_error(message)
|
26
|
+
unless Puppet[:tasks]
|
27
|
+
raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
|
28
|
+
Bolt::PAL::Issues::PLAN_OPERATION_NOT_SUPPORTED_WHEN_COMPILING,
|
29
|
+
action: 'log::error'
|
30
|
+
)
|
31
|
+
end
|
32
|
+
|
33
|
+
Puppet.lookup(:bolt_executor).tap do |executor|
|
34
|
+
executor.report_function_call(self.class.name)
|
35
|
+
executor.publish_event(type: :log, level: :error, message: Bolt::Util::Format.stringify(message))
|
36
|
+
end
|
37
|
+
|
38
|
+
nil
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'bolt/util/format'
|
4
|
+
|
5
|
+
# Log a fatal message.
|
6
|
+
#
|
7
|
+
# Messages logged at this level indicate that the plan encountered an error that
|
8
|
+
# could not be recovered from. For example, you might log a message at the
|
9
|
+
# `fatal` level if a service is unavailable and the plan cannot continue running
|
10
|
+
# without it.
|
11
|
+
#
|
12
|
+
# See [Logs](logs.md) for more information about Bolt's log levels.
|
13
|
+
#
|
14
|
+
# > **Note:** Not available in apply block
|
15
|
+
Puppet::Functions.create_function(:'log::fatal') do
|
16
|
+
# Log a fatal message.
|
17
|
+
# @param message The message to log.
|
18
|
+
# @example Log a fatal message
|
19
|
+
# log::fatal("The service is unavailable, unable to continue running: ${result}")
|
20
|
+
dispatch :log_fatal do
|
21
|
+
param 'Any', :message
|
22
|
+
return_type 'Undef'
|
23
|
+
end
|
24
|
+
|
25
|
+
def log_fatal(message)
|
26
|
+
unless Puppet[:tasks]
|
27
|
+
raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
|
28
|
+
Bolt::PAL::Issues::PLAN_OPERATION_NOT_SUPPORTED_WHEN_COMPILING,
|
29
|
+
action: 'log::fatal'
|
30
|
+
)
|
31
|
+
end
|
32
|
+
|
33
|
+
Puppet.lookup(:bolt_executor).tap do |executor|
|
34
|
+
executor.report_function_call(self.class.name)
|
35
|
+
executor.publish_event(type: :log, level: :fatal, message: Bolt::Util::Format.stringify(message))
|
36
|
+
end
|
37
|
+
|
38
|
+
nil
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'bolt/util/format'
|
4
|
+
|
5
|
+
# Log an info message.
|
6
|
+
#
|
7
|
+
# Messages logged at this level typically include high-level information about
|
8
|
+
# what a plan is doing. For example, you might log a message at the `info` level
|
9
|
+
# that informs users that the plan is reading a file on disk.
|
10
|
+
#
|
11
|
+
# See [Logs](logs.md) for more information about Bolt's log levels.
|
12
|
+
#
|
13
|
+
# > **Note:** Not available in apply block
|
14
|
+
Puppet::Functions.create_function(:'log::info') do
|
15
|
+
# Log an info message.
|
16
|
+
# @param message The message to log.
|
17
|
+
# @example Log an info message
|
18
|
+
# log::info("Reading network device command file ${file}.")
|
19
|
+
dispatch :log_info do
|
20
|
+
param 'Any', :message
|
21
|
+
return_type 'Undef'
|
22
|
+
end
|
23
|
+
|
24
|
+
def log_info(message)
|
25
|
+
unless Puppet[:tasks]
|
26
|
+
raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
|
27
|
+
Bolt::PAL::Issues::PLAN_OPERATION_NOT_SUPPORTED_WHEN_COMPILING,
|
28
|
+
action: 'log::info'
|
29
|
+
)
|
30
|
+
end
|
31
|
+
|
32
|
+
Puppet.lookup(:bolt_executor).tap do |executor|
|
33
|
+
executor.report_function_call(self.class.name)
|
34
|
+
executor.publish_event(type: :log, level: :info, message: Bolt::Util::Format.stringify(message))
|
35
|
+
end
|
36
|
+
|
37
|
+
nil
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'bolt/util/format'
|
4
|
+
|
5
|
+
# Log a trace message.
|
6
|
+
#
|
7
|
+
# Messages logged at this level typically include the most detailed information
|
8
|
+
# about what a plan is doing. For example, you might log a message at the `trace`
|
9
|
+
# level that describes how a plan is manipulating data.
|
10
|
+
#
|
11
|
+
# See [Logs](logs.md) for more information about Bolt's log levels.
|
12
|
+
#
|
13
|
+
# > **Note:** Not available in apply block
|
14
|
+
Puppet::Functions.create_function(:'log::trace') do
|
15
|
+
# Log a trace message.
|
16
|
+
# @param message The message to log.
|
17
|
+
# @example Log a trace message
|
18
|
+
# log::trace("Creating Target object with data ${data} from file ${file}")
|
19
|
+
dispatch :log_trace do
|
20
|
+
param 'Any', :message
|
21
|
+
return_type 'Undef'
|
22
|
+
end
|
23
|
+
|
24
|
+
def log_trace(message)
|
25
|
+
unless Puppet[:tasks]
|
26
|
+
raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
|
27
|
+
Bolt::PAL::Issues::PLAN_OPERATION_NOT_SUPPORTED_WHEN_COMPILING,
|
28
|
+
action: 'log::trace'
|
29
|
+
)
|
30
|
+
end
|
31
|
+
|
32
|
+
Puppet.lookup(:bolt_executor).tap do |executor|
|
33
|
+
executor.report_function_call(self.class.name)
|
34
|
+
executor.publish_event(type: :log, level: :trace, message: Bolt::Util::Format.stringify(message))
|
35
|
+
end
|
36
|
+
|
37
|
+
nil
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'bolt/util/format'
|
4
|
+
|
5
|
+
# Log a warning message.
|
6
|
+
#
|
7
|
+
# Messages logged at this level typically include messages about deprecated
|
8
|
+
# behavior or potentially harmful situations that might affect the plan run.
|
9
|
+
# For example, you might log a message at the `warn` level if you are
|
10
|
+
# planning to make a breaking change to your plan in a future release and
|
11
|
+
# want to notify users.
|
12
|
+
#
|
13
|
+
# See [Logs](logs.md) for more information about Bolt's log levels.
|
14
|
+
#
|
15
|
+
# > **Note:** Not available in apply block
|
16
|
+
Puppet::Functions.create_function(:'log::warn') do
|
17
|
+
# Log a warning message.
|
18
|
+
# @param message The message to log.
|
19
|
+
# @example Log a warning message
|
20
|
+
# log::warn('This plan will no longer install the package in a future release.')
|
21
|
+
dispatch :log_warn do
|
22
|
+
param 'Any', :message
|
23
|
+
return_type 'Undef'
|
24
|
+
end
|
25
|
+
|
26
|
+
def log_warn(message)
|
27
|
+
unless Puppet[:tasks]
|
28
|
+
raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
|
29
|
+
Bolt::PAL::Issues::PLAN_OPERATION_NOT_SUPPORTED_WHEN_COMPILING,
|
30
|
+
action: 'log::warn'
|
31
|
+
)
|
32
|
+
end
|
33
|
+
|
34
|
+
Puppet.lookup(:bolt_executor).tap do |executor|
|
35
|
+
executor.report_function_call(self.class.name)
|
36
|
+
executor.publish_event(type: :log, level: :warn, message: Bolt::Util::Format.stringify(message))
|
37
|
+
end
|
38
|
+
|
39
|
+
nil
|
40
|
+
end
|
41
|
+
end
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'bolt/util/format'
|
4
|
+
|
3
5
|
# Output a message for the user.
|
4
6
|
#
|
5
7
|
# This will print a message to stdout when using the human output format,
|
@@ -22,55 +24,11 @@ Puppet::Functions.create_function(:'out::message') do
|
|
22
24
|
.from_issue_and_stack(Bolt::PAL::Issues::PLAN_OPERATION_NOT_SUPPORTED_WHEN_COMPILING, action: 'out::message')
|
23
25
|
end
|
24
26
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
executor.publish_event(type: :message, message: stringify(message))
|
30
|
-
|
31
|
-
nil
|
32
|
-
end
|
33
|
-
|
34
|
-
def stringify(message)
|
35
|
-
formatted = format_message(message)
|
36
|
-
if formatted.is_a?(Hash) || formatted.is_a?(Array)
|
37
|
-
::JSON.pretty_generate(formatted)
|
38
|
-
else
|
39
|
-
formatted
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
def format_message(message)
|
44
|
-
case message
|
45
|
-
when Array
|
46
|
-
message.map { |item| format_message(item) }
|
47
|
-
when Bolt::ApplyResult
|
48
|
-
format_apply_result(message)
|
49
|
-
when Bolt::Result, Bolt::ResultSet
|
50
|
-
# This is equivalent to to_s, but formattable
|
51
|
-
message.to_data
|
52
|
-
when Bolt::RunFailure
|
53
|
-
formatted_resultset = message.result_set.to_data
|
54
|
-
message.to_h.merge('result_set' => formatted_resultset)
|
55
|
-
when Hash
|
56
|
-
message.each_with_object({}) do |(k, v), h|
|
57
|
-
h[format_message(k)] = format_message(v)
|
58
|
-
end
|
59
|
-
when Integer, Float, NilClass
|
60
|
-
message
|
61
|
-
else
|
62
|
-
message.to_s
|
27
|
+
Puppet.lookup(:bolt_executor).tap do |executor|
|
28
|
+
executor.report_function_call(self.class.name)
|
29
|
+
executor.publish_event(type: :message, message: Bolt::Util::Format.stringify(message))
|
63
30
|
end
|
64
|
-
end
|
65
31
|
|
66
|
-
|
67
|
-
logs = result.resource_logs&.map do |log|
|
68
|
-
# Omit low-level info/debug messages
|
69
|
-
next if %w[info debug].include?(log['level'])
|
70
|
-
indent(2, format_log(log))
|
71
|
-
end
|
72
|
-
hash = result.to_data
|
73
|
-
hash['logs'] = logs unless logs.empty?
|
74
|
-
hash
|
32
|
+
nil
|
75
33
|
end
|
76
34
|
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'bolt/util/format'
|
4
|
+
|
5
|
+
# Output a message for the user when running in verbose mode.
|
6
|
+
#
|
7
|
+
# This will print a message to stdout when using the human output format,
|
8
|
+
# and print to stderr when using the json output format.
|
9
|
+
#
|
10
|
+
# > **Note:** Not available in apply block
|
11
|
+
Puppet::Functions.create_function(:'out::verbose') do
|
12
|
+
# @param message The message to output.
|
13
|
+
# @example Print a message
|
14
|
+
# out::verbose('Something went wrong')
|
15
|
+
dispatch :output_verbose do
|
16
|
+
param 'Any', :message
|
17
|
+
return_type 'Undef'
|
18
|
+
end
|
19
|
+
|
20
|
+
def output_verbose(message)
|
21
|
+
unless Puppet[:tasks]
|
22
|
+
raise Puppet::ParseErrorWithIssue
|
23
|
+
.from_issue_and_stack(Bolt::PAL::Issues::PLAN_OPERATION_NOT_SUPPORTED_WHEN_COMPILING, action: 'out::verbose')
|
24
|
+
end
|
25
|
+
|
26
|
+
Puppet.lookup(:bolt_executor).tap do |executor|
|
27
|
+
executor.report_function_call(self.class.name)
|
28
|
+
executor.publish_event(type: :verbose, message: Bolt::Util::Format.stringify(message))
|
29
|
+
end
|
30
|
+
|
31
|
+
nil
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
TOPIC
|
2
|
+
debugging
|
3
|
+
|
4
|
+
DESCRIPTION
|
5
|
+
When Bolt isn't behaving as expected, there are a few helpful commands and
|
6
|
+
logs that can help identify common issues. The first place to look is in
|
7
|
+
`<PROJECT>/bolt-debug.log`, which contains debug-level logs from the last Bolt
|
8
|
+
run. This log file includes where the Bolt project was loaded from, the
|
9
|
+
location of any configuration or inventory files that were loaded, and the
|
10
|
+
modulepath that modules were loaded from.
|
11
|
+
|
12
|
+
If you're having issues with loading targets or target configuration, you
|
13
|
+
can see the list of resolved Bolt target names by running `bolt inventory
|
14
|
+
show` on *nix systems or `Get-BoltInventory` in PowerShell. To see the
|
15
|
+
resolved configuration for each target, run the command with the `--detail` or
|
16
|
+
`-Detail` options.
|
17
|
+
|
18
|
+
Lastly, if you're having trouble loading Bolt content you can use `bolt
|
19
|
+
module show` on *nix systems or `Get-BoltModule` in PowerShell to see the list
|
20
|
+
of loaded modules, including where they were loaded from. You can also use
|
21
|
+
`bolt task show` or `Get-BoltTask` to list loaded tasks, and `bolt plan show`
|
22
|
+
or `Get-BoltPlan` to list loaded plans.
|
23
|
+
|
24
|
+
Visit the linked documentation for more in-depth troubleshooting help for
|
25
|
+
specific issues.
|
26
|
+
|
27
|
+
DOCUMENTATION
|
28
|
+
https://pup.pt/bolt-troubleshooting
|
data/lib/bolt/applicator.rb
CHANGED
@@ -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
|
-
|
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]) }
|