bolt 2.44.0 → 3.0.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 +1 -1
- data/bolt-modules/boltlib/lib/puppet/functions/apply_prep.rb +25 -0
- data/bolt-modules/boltlib/lib/puppet/functions/wait_until_available.rb +7 -3
- data/lib/bolt/bolt_option_parser.rb +3 -120
- data/lib/bolt/cli.rb +30 -112
- data/lib/bolt/config.rb +35 -214
- data/lib/bolt/config/options.rb +13 -122
- data/lib/bolt/config/transport/local.rb +1 -0
- data/lib/bolt/config/transport/options.rb +1 -1
- data/lib/bolt/logger.rb +1 -1
- data/lib/bolt/outputter/human.rb +1 -1
- data/lib/bolt/outputter/json.rb +16 -16
- data/lib/bolt/pal.rb +1 -1
- data/lib/bolt/pal/yaml_plan/evaluator.rb +7 -19
- data/lib/bolt/pal/yaml_plan/step.rb +3 -24
- data/lib/bolt/pal/yaml_plan/step/upload.rb +2 -2
- data/lib/bolt/plugin/module.rb +0 -23
- data/lib/bolt/plugin/puppet_connect_data.rb +45 -3
- data/lib/bolt/project.rb +16 -56
- data/lib/bolt/project_manager.rb +4 -3
- data/lib/bolt/project_manager/module_migrator.rb +6 -5
- data/lib/bolt/shell/powershell.rb +1 -2
- data/lib/bolt/shell/powershell/snippets.rb +9 -149
- data/lib/bolt/transport/local.rb +1 -9
- data/lib/bolt/version.rb +1 -1
- data/lib/bolt_server/transport_app.rb +1 -1
- data/modules/aggregate/plans/count.pp +21 -0
- data/modules/aggregate/plans/targets.pp +21 -0
- data/modules/puppet_connect/plans/test_input_data.pp +31 -0
- data/modules/puppetdb_fact/plans/init.pp +10 -0
- metadata +3 -3
- data/modules/aggregate/plans/nodes.pp +0 -36
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e265544847cf9e2086949db52ee887dc05e8b0aab953728742982f9cd8965779
|
4
|
+
data.tar.gz: 616156a11d84daa9b28328b1c19f6c5bc23ca6036741c4898cc7dc9e891ca81d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc271dc6f2e7dd536ff60b4af94f48757fda48794808f4a2ea055a064c6627c01f832c3a64a430927879206b8aa1aaee94ac7075caed65580a06fa3402304bb4
|
7
|
+
data.tar.gz: 6ca3af874edf3c165766c8a48070b130defb611d0fa98ee92393bf44e524182341a8812c3730c3d4094aecbb99d7fd52201b9cf6f6e262afa75849042737cdde
|
data/Puppetfile
CHANGED
@@ -28,7 +28,7 @@ mod 'puppetlabs-python_task_helper', '0.5.0'
|
|
28
28
|
mod 'puppetlabs-reboot', '3.2.0'
|
29
29
|
mod 'puppetlabs-ruby_task_helper', '0.6.0'
|
30
30
|
mod 'puppetlabs-ruby_plugin_helper', '0.2.0'
|
31
|
-
mod 'puppetlabs-stdlib', '6.
|
31
|
+
mod 'puppetlabs-stdlib', '6.6.0'
|
32
32
|
|
33
33
|
# Plugin modules
|
34
34
|
mod 'puppetlabs-aws_inventory', '0.6.0'
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'bolt/logger'
|
3
4
|
require 'bolt/task'
|
4
5
|
|
5
6
|
# Installs the `puppet-agent` package on targets if needed, then collects facts,
|
@@ -131,10 +132,20 @@ Puppet::Functions.create_function(:apply_prep) do
|
|
131
132
|
task = applicator.custom_facts_task
|
132
133
|
arguments = { 'plugins' => Puppet::Pops::Types::PSensitiveType::Sensitive.new(plugins) }
|
133
134
|
results = executor.run_task(targets, task, arguments)
|
135
|
+
|
134
136
|
# TODO: Standardize RunFailure type with error above
|
135
137
|
raise Bolt::RunFailure.new(results, 'run_task', task.name) unless results.ok?
|
136
138
|
|
137
139
|
results.each do |result|
|
140
|
+
# Log a warning if the client version is < 6
|
141
|
+
if unsupported_puppet?(result['clientversion'])
|
142
|
+
Bolt::Logger.deprecate(
|
143
|
+
"unsupported_puppet",
|
144
|
+
"Detected unsupported Puppet agent version #{result['clientversion']} on target "\
|
145
|
+
"#{result.target}. Bolt supports Puppet agent 6.0.0 and higher."
|
146
|
+
)
|
147
|
+
end
|
148
|
+
|
138
149
|
inventory.add_facts(result.target, result.value)
|
139
150
|
end
|
140
151
|
end
|
@@ -143,4 +154,18 @@ Puppet::Functions.create_function(:apply_prep) do
|
|
143
154
|
# Return nothing
|
144
155
|
nil
|
145
156
|
end
|
157
|
+
|
158
|
+
# Returns true if the client's major version is < 6.
|
159
|
+
#
|
160
|
+
private def unsupported_puppet?(client_version)
|
161
|
+
if client_version.nil?
|
162
|
+
false
|
163
|
+
else
|
164
|
+
begin
|
165
|
+
Integer(client_version.split('.').first) < 6
|
166
|
+
rescue StandardError
|
167
|
+
false
|
168
|
+
end
|
169
|
+
end
|
170
|
+
end
|
146
171
|
end
|
@@ -2,7 +2,11 @@
|
|
2
2
|
|
3
3
|
require 'bolt/util'
|
4
4
|
|
5
|
-
# Wait until all targets accept connections.
|
5
|
+
# Wait until all targets accept connections. This function allows a plan execution to wait for a customizable
|
6
|
+
# amount of time via the `wait_time` option until a target connection can be reestablished. The plan proceeds
|
7
|
+
# to the next step if the connection fails to reconnect in the time specified (default: 120 seconds). A typical
|
8
|
+
# use case for this function is if your plan reboots a remote host and the plan needs to wait for the host to reconnect
|
9
|
+
# before it continues to the next step.
|
6
10
|
#
|
7
11
|
# > **Note:** Not available in apply block
|
8
12
|
Puppet::Functions.create_function(:wait_until_available) do
|
@@ -10,8 +14,8 @@ Puppet::Functions.create_function(:wait_until_available) do
|
|
10
14
|
# @param targets A pattern identifying zero or more targets. See {get_targets} for accepted patterns.
|
11
15
|
# @param options A hash of additional options.
|
12
16
|
# @option options [String] description A description for logging. (default: 'wait until available')
|
13
|
-
# @option options [Numeric] wait_time The time to wait. (default: 120)
|
14
|
-
# @option options [Numeric] retry_interval The interval to wait before retrying. (default: 1)
|
17
|
+
# @option options [Numeric] wait_time The time to wait, in seconds. (default: 120)
|
18
|
+
# @option options [Numeric] retry_interval The interval to wait before retrying, in seconds. (default: 1)
|
15
19
|
# @option options [Boolean] _catch_errors Whether to catch raised errors.
|
16
20
|
# @return A list of results, one entry per target. Successful results have no value.
|
17
21
|
# @example Wait for targets
|
@@ -6,15 +6,15 @@ require 'optparse'
|
|
6
6
|
|
7
7
|
module Bolt
|
8
8
|
class BoltOptionParser < OptionParser
|
9
|
-
PROJECT_PATHS = %w[project
|
10
|
-
OPTIONS = { inventory: %w[targets query rerun
|
9
|
+
PROJECT_PATHS = %w[project].freeze
|
10
|
+
OPTIONS = { inventory: %w[targets query rerun],
|
11
11
|
authentication: %w[user password password-prompt private-key host-key-check ssl ssl-verify],
|
12
12
|
escalation: %w[run-as sudo-password sudo-password-prompt sudo-executable],
|
13
13
|
run_context: %w[concurrency inventoryfile save-rerun cleanup],
|
14
14
|
global_config_setters: PROJECT_PATHS + %w[modulepath],
|
15
15
|
transports: %w[transport connect-timeout tty native-ssh ssh-command copy-command],
|
16
16
|
display: %w[format color verbose trace],
|
17
|
-
global: %w[help version
|
17
|
+
global: %w[help version log-level clear-cache] }.freeze
|
18
18
|
|
19
19
|
ACTION_OPTS = OPTIONS.values.flatten.freeze
|
20
20
|
|
@@ -114,21 +114,6 @@ module Bolt
|
|
114
114
|
{ flags: OPTIONS[:global],
|
115
115
|
banner: PROJECT_HELP }
|
116
116
|
end
|
117
|
-
when 'puppetfile'
|
118
|
-
case action
|
119
|
-
when 'install'
|
120
|
-
{ flags: OPTIONS[:global] + OPTIONS[:global_config_setters] + %w[puppetfile],
|
121
|
-
banner: PUPPETFILE_INSTALL_HELP }
|
122
|
-
when 'show-modules'
|
123
|
-
{ flags: OPTIONS[:global] + OPTIONS[:global_config_setters],
|
124
|
-
banner: PUPPETFILE_SHOWMODULES_HELP }
|
125
|
-
when 'generate-types'
|
126
|
-
{ flags: OPTIONS[:global] + OPTIONS[:global_config_setters],
|
127
|
-
banner: PUPPETFILE_GENERATETYPES_HELP }
|
128
|
-
else
|
129
|
-
{ flags: OPTIONS[:global],
|
130
|
-
banner: PUPPETFILE_HELP }
|
131
|
-
end
|
132
117
|
when 'script'
|
133
118
|
case action
|
134
119
|
when 'run'
|
@@ -192,7 +177,6 @@ module Bolt
|
|
192
177
|
module Manage Bolt project modules
|
193
178
|
plan Convert, create, show, and run Bolt plans
|
194
179
|
project Create and migrate Bolt projects
|
195
|
-
puppetfile Install and list modules and generate type references
|
196
180
|
script Upload a local script and run it remotely
|
197
181
|
secret Create encryption keys and encrypt and decrypt values
|
198
182
|
task Show and run Bolt tasks
|
@@ -576,55 +560,6 @@ module Bolt
|
|
576
560
|
Migrate a Bolt project to use current best practices and the latest version of configuration files.
|
577
561
|
HELP
|
578
562
|
|
579
|
-
PUPPETFILE_HELP = <<~HELP
|
580
|
-
NAME
|
581
|
-
puppetfile
|
582
|
-
|
583
|
-
USAGE
|
584
|
-
bolt puppetfile <action> [options]
|
585
|
-
|
586
|
-
DESCRIPTION
|
587
|
-
Install and list modules and generate type references
|
588
|
-
|
589
|
-
ACTIONS
|
590
|
-
generate-types Generate type references to register in plans
|
591
|
-
install Install modules from a Puppetfile into a project
|
592
|
-
show-modules List modules available to the Bolt project
|
593
|
-
HELP
|
594
|
-
|
595
|
-
PUPPETFILE_GENERATETYPES_HELP = <<~HELP
|
596
|
-
NAME
|
597
|
-
generate-types
|
598
|
-
|
599
|
-
USAGE
|
600
|
-
bolt puppetfile generate-types [options]
|
601
|
-
|
602
|
-
DESCRIPTION
|
603
|
-
Generate type references to register in plans.
|
604
|
-
HELP
|
605
|
-
|
606
|
-
PUPPETFILE_INSTALL_HELP = <<~HELP
|
607
|
-
NAME
|
608
|
-
install
|
609
|
-
|
610
|
-
USAGE
|
611
|
-
bolt puppetfile install [options]
|
612
|
-
|
613
|
-
DESCRIPTION
|
614
|
-
Install modules from a Puppetfile into a project
|
615
|
-
HELP
|
616
|
-
|
617
|
-
PUPPETFILE_SHOWMODULES_HELP = <<~HELP
|
618
|
-
NAME
|
619
|
-
show-modules
|
620
|
-
|
621
|
-
USAGE
|
622
|
-
bolt puppetfile show-modules [options]
|
623
|
-
|
624
|
-
DESCRIPTION
|
625
|
-
List modules available to the Bolt project.
|
626
|
-
HELP
|
627
|
-
|
628
563
|
SCRIPT_HELP = <<~HELP
|
629
564
|
NAME
|
630
565
|
script
|
@@ -791,15 +726,6 @@ module Bolt
|
|
791
726
|
define('--noop', 'See what changes Bolt will make without actually executing the changes') do |_|
|
792
727
|
@options[:noop] = true
|
793
728
|
end
|
794
|
-
define('--description DESCRIPTION',
|
795
|
-
'Deprecated. Description to use for the job') do |description|
|
796
|
-
Bolt::Logger.deprecate(
|
797
|
-
"description_cli_option",
|
798
|
-
"Command line option '--description' is deprecated, and will be "\
|
799
|
-
"removed in Bolt 3.0."
|
800
|
-
)
|
801
|
-
@options[:description] = description
|
802
|
-
end
|
803
729
|
define('--params PARAMETERS',
|
804
730
|
"Parameters to a task or plan as json, a json file '@<file>', or on stdin '-'") do |params|
|
805
731
|
@options[:task_options] = parse_params(params)
|
@@ -877,31 +803,10 @@ module Bolt
|
|
877
803
|
File.expand_path(moduledir)
|
878
804
|
end
|
879
805
|
end
|
880
|
-
define('--boltdir PATH',
|
881
|
-
'Deprecated. Specify what project to load config from (default:',
|
882
|
-
'autodiscovered from current working dir)') do |path|
|
883
|
-
Bolt::Logger.deprecate(
|
884
|
-
"boltdir_cli_option",
|
885
|
-
"Command line option '--boltdir' is deprecated, use '--project' instead."
|
886
|
-
)
|
887
|
-
@options[:boltdir] = path
|
888
|
-
end
|
889
806
|
define('--project PATH',
|
890
807
|
'Path to load the Bolt project from (default: autodiscovered from current dir)') do |path|
|
891
808
|
@options[:project] = path
|
892
809
|
end
|
893
|
-
define('--configfile PATH',
|
894
|
-
'Deprecated. Specify where to load config from (default:',
|
895
|
-
'~/.puppetlabs/bolt/bolt.yaml). Directory containing bolt.yaml will be',
|
896
|
-
'used as the project directory.') do |path|
|
897
|
-
Bolt::Logger.deprecate(
|
898
|
-
"configfile_cli_option",
|
899
|
-
"Command line option '--configfile' is deprecated, and " \
|
900
|
-
"will be removed in Bolt 3.0. Use '--project' and provide the "\
|
901
|
-
"directory path instead."
|
902
|
-
)
|
903
|
-
@options[:configfile] = path
|
904
|
-
end
|
905
810
|
define('--hiera-config PATH',
|
906
811
|
'Specify where to load Hiera config from (default: ~/.puppetlabs/bolt/hiera.yaml)') do |path|
|
907
812
|
@options[:'hiera-config'] = File.expand_path(path)
|
@@ -913,19 +818,6 @@ module Bolt
|
|
913
818
|
end
|
914
819
|
@options[:inventoryfile] = File.expand_path(path)
|
915
820
|
end
|
916
|
-
define('--puppetfile PATH',
|
917
|
-
'Deprecated. Specify a Puppetfile to use when installing modules.',
|
918
|
-
' (default: ~/.puppetlabs/bolt/Puppetfile)',
|
919
|
-
'Modules are installed in the current project.') do |path|
|
920
|
-
command = Bolt::Util.powershell? ? 'Update-BoltProject' : 'bolt project migrate'
|
921
|
-
Bolt::Logger.deprecate(
|
922
|
-
"puppetfile_cli_option",
|
923
|
-
"Command line option '--puppetfile' is deprecated, and will be removed "\
|
924
|
-
"in Bolt 3.0. You can migrate to using the new module management "\
|
925
|
-
"workflow using '#{command}'."
|
926
|
-
)
|
927
|
-
@options[:puppetfile_path] = File.expand_path(path)
|
928
|
-
end
|
929
821
|
define('--[no-]save-rerun', 'Whether to update the rerun file after this command.') do |save|
|
930
822
|
@options[:'save-rerun'] = save
|
931
823
|
end
|
@@ -1018,15 +910,6 @@ module Bolt
|
|
1018
910
|
puts Bolt::VERSION
|
1019
911
|
raise Bolt::CLIExit
|
1020
912
|
end
|
1021
|
-
define('--debug', 'Display debug logging') do |_|
|
1022
|
-
@options[:debug] = true
|
1023
|
-
# We don't actually set '--log-level debug' here, but once the options are evaluated by
|
1024
|
-
# the config class the end result is the same.
|
1025
|
-
Bolt::Logger.deprecate(
|
1026
|
-
"debug_cli_option",
|
1027
|
-
"Command line option '--debug' is deprecated, set '--log-level debug' instead."
|
1028
|
-
)
|
1029
|
-
end
|
1030
913
|
define('--log-level LEVEL',
|
1031
914
|
"Set the log level for the console. Available options are",
|
1032
915
|
"trace, debug, info, warn, error, fatal, any.") do |level|
|
data/lib/bolt/cli.rb
CHANGED
@@ -33,19 +33,18 @@ module Bolt
|
|
33
33
|
|
34
34
|
class CLI
|
35
35
|
COMMANDS = {
|
36
|
-
'command'
|
37
|
-
'script'
|
38
|
-
'task'
|
39
|
-
'plan'
|
40
|
-
'file'
|
41
|
-
'
|
42
|
-
'
|
43
|
-
'
|
44
|
-
'
|
45
|
-
'
|
46
|
-
'
|
47
|
-
'
|
48
|
-
'guide' => %w[]
|
36
|
+
'command' => %w[run],
|
37
|
+
'script' => %w[run],
|
38
|
+
'task' => %w[show run],
|
39
|
+
'plan' => %w[show run convert new],
|
40
|
+
'file' => %w[download upload],
|
41
|
+
'secret' => %w[encrypt decrypt createkeys],
|
42
|
+
'inventory' => %w[show],
|
43
|
+
'group' => %w[show],
|
44
|
+
'project' => %w[init migrate],
|
45
|
+
'module' => %w[add generate-types install show],
|
46
|
+
'apply' => %w[],
|
47
|
+
'guide' => %w[]
|
49
48
|
}.freeze
|
50
49
|
|
51
50
|
attr_reader :config, :options
|
@@ -155,25 +154,19 @@ module Bolt
|
|
155
154
|
# Loads the project and configuration. All errors that are raised here are not
|
156
155
|
# handled by the outputter, as it relies on config being loaded.
|
157
156
|
def load_config
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
Bolt::
|
157
|
+
project = if ENV['BOLT_PROJECT']
|
158
|
+
Bolt::Project.create_project(ENV['BOLT_PROJECT'], 'environment')
|
159
|
+
elsif options[:project]
|
160
|
+
dir = Pathname.new(options[:project])
|
161
|
+
if (dir + Bolt::Project::BOLTDIR_NAME).directory?
|
162
|
+
Bolt::Project.create_project(dir + Bolt::Project::BOLTDIR_NAME)
|
163
|
+
else
|
164
|
+
Bolt::Project.create_project(dir)
|
165
|
+
end
|
163
166
|
else
|
164
|
-
|
165
|
-
project = if cli_flag
|
166
|
-
dir = Pathname.new(cli_flag)
|
167
|
-
if (dir + Bolt::Project::BOLTDIR_NAME).directory?
|
168
|
-
Bolt::Project.create_project(dir + Bolt::Project::BOLTDIR_NAME)
|
169
|
-
else
|
170
|
-
Bolt::Project.create_project(dir)
|
171
|
-
end
|
172
|
-
else
|
173
|
-
Bolt::Project.find_boltdir(Dir.pwd)
|
174
|
-
end
|
175
|
-
Bolt::Config.from_project(project, options)
|
167
|
+
Bolt::Project.find_boltdir(Dir.pwd)
|
176
168
|
end
|
169
|
+
@config = Bolt::Config.from_project(project, options)
|
177
170
|
rescue Bolt::Error => e
|
178
171
|
fatal_error(e)
|
179
172
|
raise e
|
@@ -210,9 +203,8 @@ module Bolt
|
|
210
203
|
|
211
204
|
return unless !stdout.empty? && stdout.to_i < 3
|
212
205
|
|
213
|
-
msg = "Detected PowerShell 2 on controller. PowerShell 2 is
|
214
|
-
|
215
|
-
Bolt::Logger.deprecate("powershell_2_controller", msg)
|
206
|
+
msg = "Detected PowerShell 2 on controller. PowerShell 2 is unsupported."
|
207
|
+
Bolt::Logger.deprecation_warning("powershell_2_controller", msg)
|
216
208
|
end
|
217
209
|
end
|
218
210
|
|
@@ -306,10 +298,6 @@ module Bolt
|
|
306
298
|
"Unknown argument(s) #{options[:leftovers].join(', ')}"
|
307
299
|
end
|
308
300
|
|
309
|
-
if options.slice(:boltdir, :configfile, :project).length > 1
|
310
|
-
raise Bolt::CLIError, "Only one of '--boltdir', '--project', or '--configfile' may be specified"
|
311
|
-
end
|
312
|
-
|
313
301
|
if options[:noop] &&
|
314
302
|
!(options[:subcommand] == 'task' && options[:action] == 'run') && options[:subcommand] != 'apply'
|
315
303
|
raise Bolt::CLIError,
|
@@ -322,10 +310,6 @@ module Bolt
|
|
322
310
|
"Option '--env-var' may only be specified when running a command or script"
|
323
311
|
end
|
324
312
|
end
|
325
|
-
|
326
|
-
if options.key?(:debug) && options.key?(:log)
|
327
|
-
raise Bolt::CLIError, "Only one of '--debug' or '--log-level' may be specified"
|
328
|
-
end
|
329
313
|
end
|
330
314
|
|
331
315
|
def handle_parser_errors
|
@@ -388,7 +372,7 @@ module Bolt
|
|
388
372
|
# Initialize inventory and targets. Errors here are better to catch early.
|
389
373
|
# options[:target_args] will contain a string/array version of the targetting options this is passed to plans
|
390
374
|
# options[:targets] will contain a resolved set of Target objects
|
391
|
-
unless %w[guide module project
|
375
|
+
unless %w[guide module project secret].include?(options[:subcommand]) ||
|
392
376
|
%w[convert new show].include?(options[:action])
|
393
377
|
update_targets(options)
|
394
378
|
end
|
@@ -443,9 +427,6 @@ module Bolt
|
|
443
427
|
list_modules
|
444
428
|
end
|
445
429
|
return 0
|
446
|
-
when 'show-modules'
|
447
|
-
list_modules
|
448
|
-
return 0
|
449
430
|
when 'convert'
|
450
431
|
pal.convert_plan(options[:object])
|
451
432
|
return 0
|
@@ -495,17 +476,6 @@ module Bolt
|
|
495
476
|
when 'generate-types'
|
496
477
|
code = generate_types
|
497
478
|
end
|
498
|
-
when 'puppetfile'
|
499
|
-
case options[:action]
|
500
|
-
when 'generate-types'
|
501
|
-
code = generate_types
|
502
|
-
when 'install'
|
503
|
-
code = install_puppetfile(
|
504
|
-
config.puppetfile_config,
|
505
|
-
config.puppetfile,
|
506
|
-
config.modulepath.first
|
507
|
-
)
|
508
|
-
end
|
509
479
|
when 'secret'
|
510
480
|
code = Bolt::Secret.execute(plugins, outputter, options)
|
511
481
|
when 'apply'
|
@@ -523,7 +493,6 @@ module Bolt
|
|
523
493
|
|
524
494
|
elapsed_time = Benchmark.realtime do
|
525
495
|
executor_opts = {}
|
526
|
-
executor_opts[:description] = options[:description] if options.key?(:description)
|
527
496
|
executor_opts[:env_vars] = options[:env_vars] if options.key?(:env_vars)
|
528
497
|
executor.subscribe(outputter)
|
529
498
|
executor.subscribe(log_outputter)
|
@@ -540,8 +509,7 @@ module Bolt
|
|
540
509
|
targets,
|
541
510
|
options[:task_options],
|
542
511
|
executor,
|
543
|
-
inventory
|
544
|
-
options[:description])
|
512
|
+
inventory)
|
545
513
|
when 'file'
|
546
514
|
src = options[:object]
|
547
515
|
dest = options[:leftovers].first
|
@@ -664,7 +632,6 @@ module Bolt
|
|
664
632
|
|
665
633
|
plan_context = { plan_name: plan_name,
|
666
634
|
params: plan_arguments }
|
667
|
-
plan_context[:description] = options[:description] if options[:description]
|
668
635
|
|
669
636
|
executor = Bolt::Executor.new(config.concurrency, analytics, options[:noop], config.modified_concurrency)
|
670
637
|
if %w[human rainbow].include?(options.fetch(:format, 'human'))
|
@@ -728,12 +695,10 @@ module Bolt
|
|
728
695
|
end
|
729
696
|
|
730
697
|
def list_modules
|
731
|
-
assert_puppetfile_or_module_command(config.project.modules)
|
732
698
|
outputter.print_module_list(pal.list_modules)
|
733
699
|
end
|
734
700
|
|
735
701
|
def generate_types
|
736
|
-
assert_puppetfile_or_module_command(config.project.modules)
|
737
702
|
# generate_types will surface a nice error with helpful message if it fails
|
738
703
|
pal.generate_types(cache: true)
|
739
704
|
0
|
@@ -743,19 +708,17 @@ module Bolt
|
|
743
708
|
#
|
744
709
|
def install_project_modules(project, config, force, resolve)
|
745
710
|
assert_project_file(project)
|
746
|
-
assert_puppetfile_or_module_command(project.modules)
|
747
711
|
|
748
|
-
unless project.modules
|
712
|
+
unless project.modules.any?
|
749
713
|
outputter.print_message "Project configuration file #{project.project_file} does not "\
|
750
714
|
"specify any module dependencies. Nothing to do."
|
751
715
|
return 0
|
752
716
|
end
|
753
717
|
|
754
|
-
modules = project.modules || []
|
755
718
|
installer = Bolt::ModuleInstaller.new(outputter, pal)
|
756
719
|
|
757
720
|
ok = outputter.spin do
|
758
|
-
installer.install(modules,
|
721
|
+
installer.install(project.modules,
|
759
722
|
project.puppetfile,
|
760
723
|
project.managed_moduledir,
|
761
724
|
config,
|
@@ -770,14 +733,12 @@ module Bolt
|
|
770
733
|
#
|
771
734
|
def add_project_module(name, project, config)
|
772
735
|
assert_project_file(project)
|
773
|
-
assert_puppetfile_or_module_command(project.modules)
|
774
736
|
|
775
|
-
modules = project.modules || []
|
776
737
|
installer = Bolt::ModuleInstaller.new(outputter, pal)
|
777
738
|
|
778
739
|
ok = outputter.spin do
|
779
740
|
installer.add(name,
|
780
|
-
modules,
|
741
|
+
project.modules,
|
781
742
|
project.puppetfile,
|
782
743
|
project.managed_moduledir,
|
783
744
|
project.project_file,
|
@@ -808,8 +769,6 @@ module Bolt
|
|
808
769
|
# Loads a Puppetfile and installs its modules.
|
809
770
|
#
|
810
771
|
def install_puppetfile(puppetfile_config, puppetfile, moduledir)
|
811
|
-
assert_puppetfile_or_module_command(config.project.modules)
|
812
|
-
|
813
772
|
outputter.print_message("Installing modules from Puppetfile")
|
814
773
|
installer = Bolt::ModuleInstaller.new(outputter, pal)
|
815
774
|
ok = outputter.spin do
|
@@ -819,47 +778,6 @@ module Bolt
|
|
819
778
|
ok ? 0 : 1
|
820
779
|
end
|
821
780
|
|
822
|
-
# Raises an error if the 'puppetfile install' command is deprecated due to
|
823
|
-
# modules being configured.
|
824
|
-
#
|
825
|
-
def assert_puppetfile_or_module_command(modules)
|
826
|
-
if Bolt::Util.powershell?
|
827
|
-
case options[:action]
|
828
|
-
when 'generate-types'
|
829
|
-
old_command = 'Register-BoltPuppetfileTypes'
|
830
|
-
new_command = 'Register-BoltModuleTypes'
|
831
|
-
when 'install'
|
832
|
-
old_command = 'Install-BoltPuppetfile'
|
833
|
-
new_command = 'Install-BoltModule'
|
834
|
-
when 'show', 'show-modules'
|
835
|
-
old_command = 'Get-BoltPuppetfileModules'
|
836
|
-
new_command = 'Get-BoltModule'
|
837
|
-
end
|
838
|
-
else
|
839
|
-
old_command = "bolt puppetfile #{options[:action]}"
|
840
|
-
new_command = if options[:action] == 'show-modules'
|
841
|
-
'bolt module show'
|
842
|
-
else
|
843
|
-
"bolt module #{options[:action]}"
|
844
|
-
end
|
845
|
-
end
|
846
|
-
|
847
|
-
if modules && options[:subcommand] == 'puppetfile'
|
848
|
-
raise Bolt::CLIError,
|
849
|
-
"Unable to use command '#{old_command}' when 'modules' is configured in "\
|
850
|
-
"bolt-project.yaml. Use '#{new_command}' instead."
|
851
|
-
elsif modules.nil? && options[:subcommand] == 'puppetfile'
|
852
|
-
msg = "Command '#{old_command}' is deprecated and will be removed in Bolt 3.0. Update your project to use "\
|
853
|
-
"the module management feature. For more information, see https://pup.pt/bolt-module-migrate."
|
854
|
-
Bolt::Logger.deprecate("puppetfile_command", msg)
|
855
|
-
elsif modules.nil? && options[:subcommand] == 'module'
|
856
|
-
msg = "Unable to use command '#{new_command}' when 'modules' is not configured in "\
|
857
|
-
"bolt-project.yaml. "
|
858
|
-
msg += "Use '#{old_command}' instead." if options[:action] != 'add'
|
859
|
-
raise Bolt::CLIError, msg
|
860
|
-
end
|
861
|
-
end
|
862
|
-
|
863
781
|
def pal
|
864
782
|
@pal ||= Bolt::PAL.new(Bolt::Config::Modulepath.new(config.modulepath),
|
865
783
|
config.hiera_config,
|