bolt 3.16.1 → 3.20.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 +14 -14
- data/bolt-modules/boltlib/lib/puppet/functions/run_script.rb +1 -4
- data/bolt-modules/boltlib/lib/puppet/functions/upload_file.rb +1 -4
- data/bolt-modules/file/lib/puppet/functions/file/exists.rb +1 -4
- data/bolt-modules/file/lib/puppet/functions/file/read.rb +1 -4
- data/bolt-modules/file/lib/puppet/functions/file/readable.rb +1 -4
- data/lib/bolt/analytics.rb +2 -2
- data/lib/bolt/application.rb +24 -17
- data/lib/bolt/applicator.rb +7 -6
- data/lib/bolt/apply_inventory.rb +3 -3
- data/lib/bolt/apply_result.rb +2 -2
- data/lib/bolt/bolt_option_parser.rb +15 -0
- data/lib/bolt/catalog.rb +10 -11
- data/lib/bolt/cli.rb +24 -26
- data/lib/bolt/config/modulepath.rb +1 -1
- data/lib/bolt/config/options.rb +32 -13
- data/lib/bolt/config/transport/base.rb +4 -4
- data/lib/bolt/config/transport/docker.rb +2 -2
- data/lib/bolt/config/transport/local.rb +2 -2
- data/lib/bolt/config/transport/lxd.rb +2 -2
- data/lib/bolt/config/transport/options.rb +3 -2
- data/lib/bolt/config/transport/orch.rb +2 -2
- data/lib/bolt/config/transport/podman.rb +2 -2
- data/lib/bolt/config/transport/remote.rb +2 -2
- data/lib/bolt/config/transport/ssh.rb +2 -2
- data/lib/bolt/config/transport/winrm.rb +2 -2
- data/lib/bolt/config.rb +5 -5
- data/lib/bolt/container_result.rb +2 -2
- data/lib/bolt/error.rb +1 -1
- data/lib/bolt/executor.rb +17 -14
- data/lib/bolt/fiber_executor.rb +2 -2
- data/lib/bolt/inventory/group.rb +4 -4
- data/lib/bolt/inventory/inventory.rb +64 -41
- data/lib/bolt/inventory/options.rb +1 -1
- data/lib/bolt/inventory/target.rb +1 -1
- data/lib/bolt/inventory.rb +10 -17
- data/lib/bolt/module_installer/installer.rb +2 -2
- data/lib/bolt/module_installer/puppetfile/forge_module.rb +1 -1
- data/lib/bolt/module_installer/puppetfile/git_module.rb +1 -1
- data/lib/bolt/module_installer/puppetfile/module.rb +1 -1
- data/lib/bolt/module_installer/puppetfile.rb +3 -3
- data/lib/bolt/module_installer/resolver.rb +3 -3
- data/lib/bolt/module_installer/specs/forge_spec.rb +1 -1
- data/lib/bolt/module_installer/specs/git_spec.rb +1 -1
- data/lib/bolt/module_installer/specs.rb +3 -3
- data/lib/bolt/module_installer.rb +6 -6
- data/lib/bolt/node/errors.rb +1 -1
- data/lib/bolt/node/output.rb +1 -1
- data/lib/bolt/outputter/human.rb +2 -2
- data/lib/bolt/outputter/logger.rb +1 -1
- data/lib/bolt/outputter/rainbow.rb +1 -1
- data/lib/bolt/outputter.rb +4 -4
- data/lib/bolt/pal/logging.rb +1 -1
- data/lib/bolt/pal/yaml_plan/evaluator.rb +1 -1
- data/lib/bolt/pal/yaml_plan/loader.rb +2 -2
- data/lib/bolt/pal/yaml_plan/step.rb +11 -11
- data/lib/bolt/pal/yaml_plan/transpiler.rb +3 -3
- data/lib/bolt/pal/yaml_plan.rb +2 -2
- data/lib/bolt/pal.rb +11 -11
- data/lib/bolt/plan_creator.rb +87 -10
- data/lib/bolt/plan_result.rb +2 -2
- data/lib/bolt/plugin/cache.rb +2 -2
- data/lib/bolt/plugin/module.rb +1 -1
- data/lib/bolt/plugin.rb +18 -24
- data/lib/bolt/project.rb +4 -4
- data/lib/bolt/project_manager/config_migrator.rb +1 -1
- data/lib/bolt/project_manager/inventory_migrator.rb +1 -1
- data/lib/bolt/project_manager/migrator.rb +1 -1
- data/lib/bolt/project_manager/module_migrator.rb +5 -5
- data/lib/bolt/project_manager.rb +23 -4
- data/lib/bolt/puppetdb/config.rb +1 -1
- data/lib/bolt/puppetdb.rb +3 -3
- data/lib/bolt/result.rb +1 -1
- data/lib/bolt/shell/bash.rb +14 -8
- data/lib/bolt/shell/powershell.rb +23 -4
- data/lib/bolt/shell.rb +2 -2
- data/lib/bolt/target.rb +2 -2
- data/lib/bolt/transport/base.rb +1 -1
- data/lib/bolt/transport/docker/connection.rb +1 -1
- data/lib/bolt/transport/docker.rb +2 -2
- data/lib/bolt/transport/local/connection.rb +2 -2
- data/lib/bolt/transport/local.rb +3 -3
- data/lib/bolt/transport/lxd/connection.rb +1 -1
- data/lib/bolt/transport/lxd.rb +4 -4
- data/lib/bolt/transport/orch.rb +2 -2
- data/lib/bolt/transport/podman/connection.rb +1 -1
- data/lib/bolt/transport/podman.rb +2 -2
- data/lib/bolt/transport/remote.rb +2 -2
- data/lib/bolt/transport/simple.rb +3 -3
- data/lib/bolt/transport/ssh/connection.rb +3 -3
- data/lib/bolt/transport/ssh.rb +5 -5
- data/lib/bolt/transport/winrm/connection.rb +2 -2
- data/lib/bolt/transport/winrm.rb +3 -3
- data/lib/bolt/util.rb +11 -31
- data/lib/bolt/validator.rb +1 -1
- data/lib/bolt/version.rb +1 -1
- data/lib/bolt.rb +1 -1
- data/lib/bolt_server/transport_app.rb +27 -6
- data/lib/bolt_spec/bolt_context.rb +7 -5
- data/lib/bolt_spec/plans/mock_executor.rb +3 -3
- data/lib/bolt_spec/run.rb +1 -1
- data/libexec/bolt_catalog +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc5c8a79673414cca60534c299b63106ad7abe696bc942e7f913deaf57aa893f
|
4
|
+
data.tar.gz: 0db5d813eb99b4d452e92bde9d8518b10c60b5613a18cb310dffbc7c86c87d64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d67559bf87d79ec2adf72b6cf1d7de11a6b3ad925062ff7251e4be99240e551e9704c2fff1767979351f4485420cd7a62988f4f31c8bfe6cae940272898f564
|
7
|
+
data.tar.gz: 69c73373a0ee02aca8794f66c48cc0c84f9c6ce56c329648915b6cc15714e399f13716f93af439a8362bc1a6c17d736e76e1920d2243fc1f1cf76e7daeb11a49
|
data/Puppetfile
CHANGED
@@ -5,31 +5,31 @@ forge "http://forge.puppetlabs.com"
|
|
5
5
|
moduledir File.join(File.dirname(__FILE__), 'modules')
|
6
6
|
|
7
7
|
# Core modules used by 'apply'
|
8
|
-
mod 'puppetlabs-service', '2.
|
9
|
-
mod 'puppetlabs-puppet_agent', '4.
|
8
|
+
mod 'puppetlabs-service', '2.1.0'
|
9
|
+
mod 'puppetlabs-puppet_agent', '4.9.0'
|
10
10
|
mod 'puppetlabs-facts', '1.4.0'
|
11
11
|
|
12
12
|
# Core types and providers for Puppet 6
|
13
|
-
mod 'puppetlabs-augeas_core', '1.
|
14
|
-
mod 'puppetlabs-host_core', '1.0
|
13
|
+
mod 'puppetlabs-augeas_core', '1.2.0'
|
14
|
+
mod 'puppetlabs-host_core', '1.1.0'
|
15
15
|
mod 'puppetlabs-scheduled_task', '3.0.1'
|
16
|
-
mod 'puppetlabs-sshkeys_core', '2.
|
17
|
-
mod 'puppetlabs-zfs_core', '1.
|
18
|
-
mod 'puppetlabs-cron_core', '1.0
|
19
|
-
mod 'puppetlabs-mount_core', '1.0
|
20
|
-
mod 'puppetlabs-selinux_core', '1.
|
21
|
-
mod 'puppetlabs-yumrepo_core', '1.0
|
16
|
+
mod 'puppetlabs-sshkeys_core', '2.3.0'
|
17
|
+
mod 'puppetlabs-zfs_core', '1.3.0'
|
18
|
+
mod 'puppetlabs-cron_core', '1.1.0'
|
19
|
+
mod 'puppetlabs-mount_core', '1.1.0'
|
20
|
+
mod 'puppetlabs-selinux_core', '1.2.0'
|
21
|
+
mod 'puppetlabs-yumrepo_core', '1.1.0'
|
22
22
|
mod 'puppetlabs-zone_core', '1.0.3'
|
23
23
|
|
24
24
|
# Useful additional modules
|
25
|
-
mod 'puppetlabs-package', '2.
|
25
|
+
mod 'puppetlabs-package', '2.1.0'
|
26
26
|
mod 'puppetlabs-powershell_task_helper', '0.1.0'
|
27
|
-
mod 'puppetlabs-puppet_conf', '1.
|
27
|
+
mod 'puppetlabs-puppet_conf', '1.2.0'
|
28
28
|
mod 'puppetlabs-python_task_helper', '0.5.0'
|
29
|
-
mod 'puppetlabs-reboot', '4.0
|
29
|
+
mod 'puppetlabs-reboot', '4.1.0'
|
30
30
|
mod 'puppetlabs-ruby_task_helper', '0.6.0'
|
31
31
|
mod 'puppetlabs-ruby_plugin_helper', '0.2.0'
|
32
|
-
mod 'puppetlabs-stdlib', '
|
32
|
+
mod 'puppetlabs-stdlib', '8.1.0'
|
33
33
|
|
34
34
|
# Plugin modules
|
35
35
|
mod 'puppetlabs-aws_inventory', '0.7.0'
|
@@ -108,11 +108,8 @@ Puppet::Functions.create_function(:run_script, Puppet::Functions::InternalFuncti
|
|
108
108
|
# Send Analytics Report
|
109
109
|
executor.report_function_call(self.class.name)
|
110
110
|
|
111
|
-
future = executor&.future || {}
|
112
|
-
fallback = future.fetch('file_paths', false)
|
113
|
-
|
114
111
|
# Find the file path if it exists, otherwise return nil
|
115
|
-
found = Bolt::Util.find_file_from_scope(script, scope
|
112
|
+
found = Bolt::Util.find_file_from_scope(script, scope)
|
116
113
|
unless found && Puppet::FileSystem.exist?(found)
|
117
114
|
raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
|
118
115
|
Puppet::Pops::Issues::NO_SUCH_FILE_OR_DIRECTORY, file: script
|
@@ -70,11 +70,8 @@ Puppet::Functions.create_function(:upload_file, Puppet::Functions::InternalFunct
|
|
70
70
|
# Send Analytics Report
|
71
71
|
executor.report_function_call(self.class.name)
|
72
72
|
|
73
|
-
future = executor&.future || {}
|
74
|
-
fallback = future.fetch('file_paths', false)
|
75
|
-
|
76
73
|
# Find the file path if it exists, otherwise return nil
|
77
|
-
found = Bolt::Util.find_file_from_scope(source, scope
|
74
|
+
found = Bolt::Util.find_file_from_scope(source, scope)
|
78
75
|
unless found && Puppet::FileSystem.exist?(found)
|
79
76
|
raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
|
80
77
|
Puppet::Pops::Issues::NO_SUCH_FILE_OR_DIRECTORY, file: source
|
@@ -21,11 +21,8 @@ Puppet::Functions.create_function(:'file::exists', Puppet::Functions::InternalFu
|
|
21
21
|
executor = Puppet.lookup(:bolt_executor) {}
|
22
22
|
executor&.report_function_call(self.class.name)
|
23
23
|
|
24
|
-
future = executor&.future || Puppet.lookup(:future) { {} }
|
25
|
-
fallback = future.fetch('file_paths', false)
|
26
|
-
|
27
24
|
# Find the file path if it exists, otherwise return nil
|
28
|
-
found = Bolt::Util.find_file_from_scope(filename, scope
|
25
|
+
found = Bolt::Util.find_file_from_scope(filename, scope)
|
29
26
|
found ? Puppet::FileSystem.exist?(found) : false
|
30
27
|
end
|
31
28
|
end
|
@@ -20,11 +20,8 @@ Puppet::Functions.create_function(:'file::read', Puppet::Functions::InternalFunc
|
|
20
20
|
executor = Puppet.lookup(:bolt_executor) {}
|
21
21
|
executor&.report_function_call(self.class.name)
|
22
22
|
|
23
|
-
future = executor&.future || Puppet.lookup(:future) { {} }
|
24
|
-
fallback = future.fetch('file_paths', false)
|
25
|
-
|
26
23
|
# Find the file path if it exists, otherwise return nil
|
27
|
-
found = Bolt::Util.find_file_from_scope(filename, scope
|
24
|
+
found = Bolt::Util.find_file_from_scope(filename, scope)
|
28
25
|
unless found && Puppet::FileSystem.exist?(found)
|
29
26
|
raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
|
30
27
|
Puppet::Pops::Issues::NO_SUCH_FILE_OR_DIRECTORY, file: filename
|
@@ -21,11 +21,8 @@ Puppet::Functions.create_function(:'file::readable', Puppet::Functions::Internal
|
|
21
21
|
executor = Puppet.lookup(:bolt_executor) {}
|
22
22
|
executor&.report_function_call(self.class.name)
|
23
23
|
|
24
|
-
future = executor&.future || Puppet.lookup(:future) { {} }
|
25
|
-
fallback = future.fetch('file_paths', false)
|
26
|
-
|
27
24
|
# Find the file path if it exists, otherwise return nil
|
28
|
-
found = Bolt::Util.find_file_from_scope(filename, scope
|
25
|
+
found = Bolt::Util.find_file_from_scope(filename, scope)
|
29
26
|
found ? File.readable?(found) : false
|
30
27
|
end
|
31
28
|
end
|
data/lib/bolt/analytics.rb
CHANGED
data/lib/bolt/application.rb
CHANGED
@@ -2,7 +2,8 @@
|
|
2
2
|
|
3
3
|
require 'benchmark'
|
4
4
|
|
5
|
-
|
5
|
+
require_relative '../bolt/plan_creator'
|
6
|
+
require_relative '../bolt/util'
|
6
7
|
|
7
8
|
module Bolt
|
8
9
|
class Application
|
@@ -88,7 +89,7 @@ module Bolt
|
|
88
89
|
# @param env_vars [Hash] Environment variables to set on the target.
|
89
90
|
# @return [Bolt::ResultSet]
|
90
91
|
#
|
91
|
-
def run_command(command, targets, env_vars:
|
92
|
+
def run_command(command, targets, env_vars: nil)
|
92
93
|
targets = inventory.get_targets(targets)
|
93
94
|
|
94
95
|
with_benchmark do
|
@@ -120,8 +121,7 @@ module Bolt
|
|
120
121
|
# @return [Bolt::ResultSet]
|
121
122
|
#
|
122
123
|
def upload_file(source, destination, targets)
|
123
|
-
|
124
|
-
source = find_file(source, future)
|
124
|
+
source = find_file(source)
|
125
125
|
targets = inventory.get_targets(targets)
|
126
126
|
|
127
127
|
Bolt::Util.validate_file('source file', source, true)
|
@@ -258,7 +258,7 @@ module Bolt
|
|
258
258
|
config.project.puppetfile,
|
259
259
|
config.project.managed_moduledir,
|
260
260
|
config.project.project_file,
|
261
|
-
config.module_install)
|
261
|
+
@plugins.resolve_references(config.module_install))
|
262
262
|
end
|
263
263
|
|
264
264
|
# Generate Puppet data types from project modules.
|
@@ -292,7 +292,7 @@ module Bolt
|
|
292
292
|
installer.install(config.project.modules,
|
293
293
|
config.project.puppetfile,
|
294
294
|
config.project.managed_moduledir,
|
295
|
-
config.module_install,
|
295
|
+
@plugins.resolve_references(config.module_install),
|
296
296
|
force: force,
|
297
297
|
resolve: resolve)
|
298
298
|
end
|
@@ -327,11 +327,20 @@ module Bolt
|
|
327
327
|
#
|
328
328
|
# @param name [String] The name of the new plan.
|
329
329
|
# @param puppet [Boolean] Create a Puppet language plan.
|
330
|
+
# @param plan_script [String] Reference to the script to run in the new plan.
|
330
331
|
# @return [Boolean]
|
331
332
|
#
|
332
|
-
def new_plan(name, puppet: false)
|
333
|
-
Bolt::PlanCreator.
|
334
|
-
|
333
|
+
def new_plan(name, puppet: false, plan_script: nil)
|
334
|
+
Bolt::PlanCreator.validate_plan_name(config.project, name)
|
335
|
+
|
336
|
+
if plan_script
|
337
|
+
Bolt::Util.validate_file('script', find_file(plan_script))
|
338
|
+
end
|
339
|
+
|
340
|
+
Bolt::PlanCreator.create_plan(config.project.plans_path,
|
341
|
+
name,
|
342
|
+
is_puppet: puppet,
|
343
|
+
script: plan_script)
|
335
344
|
end
|
336
345
|
|
337
346
|
# Run a plan.
|
@@ -433,9 +442,8 @@ module Bolt
|
|
433
442
|
# @param env_vars [Hash] Environment variables to set on the target.
|
434
443
|
# @return [Bolt::ResultSet]
|
435
444
|
#
|
436
|
-
def run_script(script, targets, arguments: [], env_vars:
|
437
|
-
|
438
|
-
script = find_file(script, future)
|
445
|
+
def run_script(script, targets, arguments: [], env_vars: nil)
|
446
|
+
script = find_file(script)
|
439
447
|
|
440
448
|
Bolt::Util.validate_file('script', script)
|
441
449
|
|
@@ -555,18 +563,17 @@ module Bolt
|
|
555
563
|
# directory.
|
556
564
|
#
|
557
565
|
# @param path [String] The path to the file.
|
558
|
-
# @param future_file_paths [Boolean] Whether to use future file path behavior.
|
559
566
|
#
|
560
|
-
private def find_file(path
|
567
|
+
private def find_file(path)
|
561
568
|
return path if File.exist?(path) || Pathname.new(path).absolute?
|
562
569
|
modulepath = Bolt::Config::Modulepath.new(config.modulepath)
|
563
570
|
modules = Bolt::Module.discover(modulepath.full_modulepath, config.project)
|
564
|
-
mod, file
|
571
|
+
mod, file = path.split(File::SEPARATOR, 2)
|
565
572
|
|
566
573
|
if modules[mod]
|
567
574
|
logger.debug("Did not find file at #{File.expand_path(path)}, checking in module '#{mod}'")
|
568
|
-
found = Bolt::Util.find_file_in_module(modules[mod].path, file || ""
|
569
|
-
path
|
575
|
+
found = Bolt::Util.find_file_in_module(modules[mod].path, file || "")
|
576
|
+
path = found.nil? ? File.join(modules[mod].path, 'files', file) : found
|
570
577
|
end
|
571
578
|
|
572
579
|
path
|
data/lib/bolt/applicator.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'base64'
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
4
|
+
require_relative '../bolt/apply_result'
|
5
|
+
require_relative '../bolt/apply_target'
|
6
|
+
require_relative '../bolt/config'
|
7
|
+
require_relative '../bolt/error'
|
8
|
+
require_relative '../bolt/task'
|
9
|
+
require_relative '../bolt/util/puppet_log_level'
|
10
10
|
require 'find'
|
11
11
|
require 'json'
|
12
12
|
require 'logging'
|
@@ -239,6 +239,7 @@ module Bolt
|
|
239
239
|
search_dirs << mod.plugins if mod.plugins?
|
240
240
|
search_dirs << mod.pluginfacts if mod.pluginfacts?
|
241
241
|
search_dirs << mod.files if mod.files?
|
242
|
+
search_dirs << mod.scripts if mod.scripts?
|
242
243
|
type_files = "#{mod.path}/types"
|
243
244
|
search_dirs << type_files if File.exist?(type_files)
|
244
245
|
search_dirs
|
data/lib/bolt/apply_inventory.rb
CHANGED
data/lib/bolt/apply_result.rb
CHANGED
@@ -1042,6 +1042,21 @@ module Bolt
|
|
1042
1042
|
define('--pp', 'Create a new Puppet language plan.') do |_|
|
1043
1043
|
@options[:puppet] = true
|
1044
1044
|
end
|
1045
|
+
define('--script SCRIPT', 'Create a new plan that wraps a script.') do |path|
|
1046
|
+
# If the path is a relative, absolute, or not a scripts path, raise an
|
1047
|
+
# error. This flag is intended to be used to create shareable plans.
|
1048
|
+
#
|
1049
|
+
# This also limits valid mounts to files and scripts, which we may want
|
1050
|
+
# to expand in the future.
|
1051
|
+
if File.exist?(path) || Pathname.new(path).absolute? ||
|
1052
|
+
!%w[scripts files].include?(path.split(File::SEPARATOR)[1])
|
1053
|
+
raise Bolt::CLIError, "The script must be a detailed Puppet file reference, " \
|
1054
|
+
"for example 'mymodule/scripts/myscript.sh'. See http://pup.pt/bolt-scripts for " \
|
1055
|
+
"more information on detailed Puppet file references."
|
1056
|
+
end
|
1057
|
+
|
1058
|
+
@options[:plan_script] = path
|
1059
|
+
end
|
1045
1060
|
|
1046
1061
|
separator "\n#{self.class.colorize(:cyan, 'Display options')}"
|
1047
1062
|
define('--filter FILTER', 'Filter tasks and plans by a matching substring.') do |filter|
|
data/lib/bolt/catalog.rb
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
3
|
+
require_relative '../bolt/apply_inventory'
|
4
|
+
require_relative '../bolt/apply_target'
|
5
|
+
require_relative '../bolt/config'
|
6
|
+
require_relative '../bolt/error'
|
7
|
+
require_relative '../bolt/inventory'
|
8
|
+
require_relative '../bolt/pal'
|
9
|
+
require_relative '../bolt/puppetdb'
|
10
|
+
require_relative '../bolt/util'
|
11
11
|
|
12
12
|
Bolt::PAL.load_puppet
|
13
13
|
|
14
|
-
|
14
|
+
require_relative 'catalog/logging'
|
15
15
|
|
16
16
|
module Bolt
|
17
17
|
class Catalog
|
@@ -65,8 +65,7 @@ module Bolt
|
|
65
65
|
puppet_overrides = {
|
66
66
|
bolt_pdb_client: pdb_client,
|
67
67
|
bolt_inventory: inv,
|
68
|
-
bolt_project: bolt_project
|
69
|
-
future: request['future']
|
68
|
+
bolt_project: bolt_project
|
70
69
|
}
|
71
70
|
|
72
71
|
# Facts will be set by the catalog compiler, so we need to ensure
|
data/lib/bolt/cli.rb
CHANGED
@@ -9,24 +9,23 @@ require 'json'
|
|
9
9
|
require 'io/console'
|
10
10
|
require 'logging'
|
11
11
|
require 'optparse'
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
require 'bolt/version'
|
12
|
+
require_relative '../bolt/analytics'
|
13
|
+
require_relative '../bolt/application'
|
14
|
+
require_relative '../bolt/bolt_option_parser'
|
15
|
+
require_relative '../bolt/config'
|
16
|
+
require_relative '../bolt/error'
|
17
|
+
require_relative '../bolt/executor'
|
18
|
+
require_relative '../bolt/inventory'
|
19
|
+
require_relative '../bolt/logger'
|
20
|
+
require_relative '../bolt/module_installer'
|
21
|
+
require_relative '../bolt/outputter'
|
22
|
+
require_relative '../bolt/pal'
|
23
|
+
require_relative '../bolt/plugin'
|
24
|
+
require_relative '../bolt/project_manager'
|
25
|
+
require_relative '../bolt/puppetdb'
|
26
|
+
require_relative '../bolt/rerun'
|
27
|
+
require_relative '../bolt/target'
|
28
|
+
require_relative '../bolt/version'
|
30
29
|
|
31
30
|
module Bolt
|
32
31
|
class CLIExit < StandardError; end
|
@@ -54,8 +53,7 @@ module Bolt
|
|
54
53
|
TARGETING_OPTIONS = %i[query rerun targets].freeze
|
55
54
|
|
56
55
|
SUCCESS = 0
|
57
|
-
|
58
|
-
FAILURE = 2
|
56
|
+
FAILURE = 1
|
59
57
|
|
60
58
|
def initialize(argv)
|
61
59
|
Bolt::Logger.initialize_logging
|
@@ -435,7 +433,7 @@ module Bolt
|
|
435
433
|
config.project
|
436
434
|
)
|
437
435
|
|
438
|
-
plugins = Bolt::Plugin.
|
436
|
+
plugins = Bolt::Plugin.new(config, pal, analytics)
|
439
437
|
|
440
438
|
inventory = Bolt::Inventory.from_config(config, plugins)
|
441
439
|
|
@@ -448,7 +446,7 @@ module Bolt
|
|
448
446
|
check_gem_install
|
449
447
|
warn_inventory_overrides_cli(config, options)
|
450
448
|
submit_screen_view(analytics, config, inventory, options)
|
451
|
-
options[:targets] = process_target_list(plugins
|
449
|
+
options[:targets] = process_target_list(plugins, @rerun, options)
|
452
450
|
|
453
451
|
# TODO: Fix casing issue in Windows.
|
454
452
|
config.check_path_case('modulepath', config.modulepath)
|
@@ -611,7 +609,7 @@ module Bolt
|
|
611
609
|
app.convert_plan(options[:object])
|
612
610
|
SUCCESS
|
613
611
|
when 'new'
|
614
|
-
result = app.new_plan(options[:object], **options.slice(:puppet))
|
612
|
+
result = app.new_plan(options[:object], **options.slice(:puppet, :plan_script))
|
615
613
|
outputter.print_new_plan(**result)
|
616
614
|
SUCCESS
|
617
615
|
when 'run'
|
@@ -691,14 +689,14 @@ module Bolt
|
|
691
689
|
# Process the target list by turning a PuppetDB query or rerun mode into a
|
692
690
|
# list of target names.
|
693
691
|
#
|
694
|
-
# @param
|
692
|
+
# @param plugins [Bolt::Plugin] The Plugin instance.
|
695
693
|
# @param rerun [Bolt::Rerun] The Rerun instance.
|
696
694
|
# @param options [Hash] The CLI options.
|
697
695
|
# @return [Hash] The target list.
|
698
696
|
#
|
699
|
-
private def process_target_list(
|
697
|
+
private def process_target_list(plugins, rerun, options)
|
700
698
|
if options[:query]
|
701
|
-
|
699
|
+
plugins.puppetdb_client.query_certnames(options[:query])
|
702
700
|
elsif options[:rerun]
|
703
701
|
rerun.get_targets(options[:rerun])
|
704
702
|
elsif options[:targets]
|
data/lib/bolt/config/options.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
3
|
+
require_relative '../../bolt/config/transport/docker'
|
4
|
+
require_relative '../../bolt/config/transport/local'
|
5
|
+
require_relative '../../bolt/config/transport/lxd'
|
6
|
+
require_relative '../../bolt/config/transport/orch'
|
7
|
+
require_relative '../../bolt/config/transport/podman'
|
8
|
+
require_relative '../../bolt/config/transport/remote'
|
9
|
+
require_relative '../../bolt/config/transport/ssh'
|
10
|
+
require_relative '../../bolt/config/transport/winrm'
|
11
11
|
|
12
12
|
module Bolt
|
13
13
|
class Config
|
@@ -147,14 +147,23 @@ module Bolt
|
|
147
147
|
type: Hash,
|
148
148
|
properties: {
|
149
149
|
"file_paths" => {
|
150
|
-
description: "Load scripts from the `scripts/` directory of a module",
|
150
|
+
description: "Load scripts from the `scripts/` directory of a module.",
|
151
|
+
type: [TrueClass, FalseClass],
|
152
|
+
_example: true,
|
153
|
+
_default: false,
|
154
|
+
_deprecation: "Bolt no longer honors this option and enables loading scripts from the scripts "\
|
155
|
+
"directory by default."
|
156
|
+
},
|
157
|
+
"script_interpreter" => {
|
158
|
+
description: "Use a target's [`interpreters` configuration](bolt_transports_reference.md#interpreters) "\
|
159
|
+
"when running a script.",
|
151
160
|
type: [TrueClass, FalseClass],
|
152
161
|
_example: true,
|
153
162
|
_default: false
|
154
163
|
}
|
155
164
|
},
|
156
165
|
_plugin: false,
|
157
|
-
_example: { '
|
166
|
+
_example: { 'script_interpreter' => true }
|
158
167
|
},
|
159
168
|
"hiera-config" => {
|
160
169
|
description: "The path to the Hiera configuration file.",
|
@@ -248,10 +257,16 @@ module Bolt
|
|
248
257
|
type: Hash,
|
249
258
|
properties: {
|
250
259
|
"forge" => {
|
251
|
-
description: "A subsection
|
252
|
-
"operations only, and a `baseurl` setting to specify a different Forge host.",
|
260
|
+
description: "A subsection for configuring connections to a Forge host.",
|
253
261
|
type: Hash,
|
254
262
|
properties: {
|
263
|
+
"authorization_token" => {
|
264
|
+
description: "The token used to authorize requests to the Forge host. Must also specify "\
|
265
|
+
"`baseurl` when using this option.",
|
266
|
+
type: String,
|
267
|
+
_example: "Bearer eyJhbGciOiJIUzI1NiIsInR5c...",
|
268
|
+
_plugin: true
|
269
|
+
},
|
255
270
|
"baseurl" => {
|
256
271
|
description: "The URL to the Forge host.",
|
257
272
|
type: String,
|
@@ -265,7 +280,11 @@ module Bolt
|
|
265
280
|
_example: "https://my-forge-proxy.com:8080"
|
266
281
|
}
|
267
282
|
},
|
268
|
-
_example: {
|
283
|
+
_example: {
|
284
|
+
"authorization_token" => "Bearer eyJhbGciOiJIUzI1NiIsInR5c...",
|
285
|
+
"baseurl" => "https://forge.example.com",
|
286
|
+
"proxy" => "https://my-forge-proxy.com:8080"
|
287
|
+
}
|
269
288
|
},
|
270
289
|
"proxy" => {
|
271
290
|
description: "The HTTP proxy to use for Git and Forge operations.",
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
require_relative '../../../bolt/error'
|
4
|
+
require_relative '../../../bolt/util'
|
5
|
+
require_relative '../../../bolt/validator'
|
6
|
+
require_relative '../../../bolt/config/transport/options'
|
7
7
|
|
8
8
|
module Bolt
|
9
9
|
class Config
|
@@ -155,14 +155,15 @@ module Bolt
|
|
155
155
|
"`task.py`) and the extension is case sensitive. When a target's name is `localhost`, "\
|
156
156
|
"Ruby tasks run with the Bolt Ruby interpreter by default.",
|
157
157
|
additionalProperties: {
|
158
|
-
type: String,
|
158
|
+
type: [String, Array],
|
159
159
|
_plugin: false
|
160
160
|
},
|
161
161
|
propertyNames: {
|
162
162
|
pattern: "^.?[a-zA-Z0-9]+$"
|
163
163
|
},
|
164
164
|
_plugin: true,
|
165
|
-
_example: { "rb" => "/usr/bin/ruby"
|
165
|
+
_example: { "rb" => ["/usr/bin/ruby", "-r", "puppet"],
|
166
|
+
".py" => "/usr/bin/python3" }
|
166
167
|
},
|
167
168
|
"job-poll-interval" => {
|
168
169
|
type: Integer,
|