bolt 2.31.0 → 2.35.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 +7 -7
- data/bolt-modules/boltlib/lib/puppet/functions/catch_errors.rb +1 -3
- data/bolt-modules/boltlib/lib/puppet/functions/download_file.rb +17 -6
- data/bolt-modules/boltlib/lib/puppet/functions/facts.rb +6 -0
- data/bolt-modules/boltlib/lib/puppet/functions/parallelize.rb +56 -0
- data/bolt-modules/boltlib/lib/puppet/functions/puppetdb_query.rb +2 -2
- data/bolt-modules/boltlib/lib/puppet/functions/run_command.rb +24 -6
- data/bolt-modules/boltlib/lib/puppet/functions/run_script.rb +27 -8
- data/bolt-modules/boltlib/lib/puppet/functions/run_task.rb +21 -1
- data/bolt-modules/boltlib/lib/puppet/functions/run_task_with.rb +18 -1
- data/bolt-modules/boltlib/lib/puppet/functions/upload_file.rb +24 -6
- data/bolt-modules/out/lib/puppet/functions/out/message.rb +44 -1
- data/bolt-modules/prompt/lib/puppet/functions/prompt.rb +3 -0
- data/guides/logging.txt +18 -0
- data/guides/module.txt +19 -0
- data/guides/modulepath.txt +25 -0
- data/lib/bolt/bolt_option_parser.rb +6 -1
- data/lib/bolt/cli.rb +70 -144
- data/lib/bolt/config/options.rb +35 -17
- data/lib/bolt/config/transport/options.rb +1 -1
- data/lib/bolt/error.rb +37 -3
- data/lib/bolt/executor.rb +111 -13
- data/lib/bolt/inventory/group.rb +2 -1
- data/lib/bolt/module_installer.rb +71 -115
- data/lib/bolt/{puppetfile → module_installer}/installer.rb +3 -2
- data/lib/bolt/module_installer/puppetfile.rb +117 -0
- data/lib/bolt/module_installer/puppetfile/forge_module.rb +54 -0
- data/lib/bolt/module_installer/puppetfile/git_module.rb +37 -0
- data/lib/bolt/module_installer/puppetfile/module.rb +26 -0
- data/lib/bolt/module_installer/resolver.rb +76 -0
- data/lib/bolt/module_installer/specs.rb +93 -0
- data/lib/bolt/module_installer/specs/forge_spec.rb +85 -0
- data/lib/bolt/module_installer/specs/git_spec.rb +179 -0
- data/lib/bolt/outputter.rb +0 -47
- data/lib/bolt/outputter/human.rb +23 -11
- data/lib/bolt/outputter/json.rb +1 -1
- data/lib/bolt/pal.rb +48 -30
- data/lib/bolt/pal/yaml_plan.rb +11 -2
- data/lib/bolt/pal/yaml_plan/evaluator.rb +23 -1
- data/lib/bolt/pal/yaml_plan/loader.rb +14 -9
- data/lib/bolt/plan_creator.rb +160 -0
- data/lib/bolt/plugin.rb +1 -1
- data/lib/bolt/project.rb +5 -10
- data/lib/bolt/project_migrator/config.rb +2 -1
- data/lib/bolt/project_migrator/inventory.rb +2 -2
- data/lib/bolt/project_migrator/modules.rb +10 -8
- data/lib/bolt/puppetdb/client.rb +3 -2
- data/lib/bolt/puppetdb/config.rb +8 -6
- data/lib/bolt/result.rb +23 -11
- data/lib/bolt/shell/bash.rb +11 -6
- data/lib/bolt/shell/powershell.rb +12 -7
- data/lib/bolt/task/run.rb +1 -1
- data/lib/bolt/transport/base.rb +18 -18
- data/lib/bolt/transport/docker.rb +23 -6
- data/lib/bolt/transport/orch.rb +23 -19
- data/lib/bolt/transport/orch/connection.rb +10 -3
- data/lib/bolt/transport/remote.rb +3 -3
- data/lib/bolt/transport/simple.rb +6 -6
- data/lib/bolt/util.rb +5 -0
- data/lib/bolt/version.rb +1 -1
- data/lib/bolt/yarn.rb +23 -0
- data/lib/bolt_server/file_cache.rb +2 -0
- data/lib/bolt_server/schemas/partials/task.json +17 -2
- data/lib/bolt_server/transport_app.rb +38 -7
- data/lib/bolt_spec/plans/action_stubs/command_stub.rb +1 -1
- data/lib/bolt_spec/plans/action_stubs/script_stub.rb +1 -1
- data/lib/bolt_spec/plans/mock_executor.rb +9 -6
- metadata +25 -8
- data/lib/bolt/puppetfile.rb +0 -149
- data/lib/bolt/puppetfile/module.rb +0 -93
- data/modules/secure_env_vars/plans/init.pp +0 -20
data/guides/module.txt
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
TOPIC
|
2
|
+
module
|
3
|
+
|
4
|
+
DESCRIPTION
|
5
|
+
Modules are shareable, reusable packages of Puppet content. They can include
|
6
|
+
tasks, plans, functions, and other types of content that you can use in your
|
7
|
+
project. You can download and install modules to your project from the
|
8
|
+
Puppet Forge or write your own modules. Bolt also ships with several helpful
|
9
|
+
modules pre-installed that are available to all of your projects.
|
10
|
+
|
11
|
+
Bolt makes it easy to manage the modules that your project depends on. You
|
12
|
+
can use Bolt commands to install a project's modules, add new modules to a
|
13
|
+
project, and view the modules that are available to the project.
|
14
|
+
|
15
|
+
To learn more about managing modules in a project, see the documentation.
|
16
|
+
To learn how modules are loaded by Bolt, see the 'modulepath' guide.
|
17
|
+
|
18
|
+
DOCUMENTATION
|
19
|
+
https://pup.pt/bolt-modules
|
@@ -0,0 +1,25 @@
|
|
1
|
+
TOPIC
|
2
|
+
modulepath
|
3
|
+
|
4
|
+
DESCRIPTION
|
5
|
+
The modulepath is an ordered list of directories that Bolt loads modules
|
6
|
+
from. When Bolt runs a command, it automatically loads modules from the
|
7
|
+
modulepath.
|
8
|
+
|
9
|
+
While Bolt has a default modulepath, you can also configure your own
|
10
|
+
modulepath, which can include directories within the project or directories
|
11
|
+
elsewhere on your system. Regardless of whether your project uses a default
|
12
|
+
or configured modulepath, Bolt automatically adds directories to the
|
13
|
+
modulepath. This includes modules containing core Bolt content, which is
|
14
|
+
added to the beginning of the modulepath, and bundled content, which is
|
15
|
+
added to the end of the modulepath.
|
16
|
+
|
17
|
+
Modules loaded from a directory listed earlier in the modulepath take
|
18
|
+
precedence over modules with the same name loaded from a directory later in
|
19
|
+
the modulepath. Bolt will not warn or error when two modules share a name
|
20
|
+
and instead will ignore modules with a lower precedence.
|
21
|
+
|
22
|
+
To learn more about modules, see the 'module' guide.
|
23
|
+
|
24
|
+
DOCUMENTATION
|
25
|
+
https://pup.pt/bolt-project-reference#modulepath
|
@@ -88,7 +88,7 @@ module Bolt
|
|
88
88
|
{ flags: OPTIONS[:global] + OPTIONS[:global_config_setters],
|
89
89
|
banner: PLAN_CONVERT_HELP }
|
90
90
|
when 'new'
|
91
|
-
{ flags: OPTIONS[:global] + %w[configfile project],
|
91
|
+
{ flags: OPTIONS[:global] + %w[configfile project pp],
|
92
92
|
banner: PLAN_NEW_HELP }
|
93
93
|
when 'run'
|
94
94
|
{ flags: ACTION_OPTS + %w[params compile-concurrency tmpdir hiera-config],
|
@@ -945,6 +945,11 @@ module Bolt
|
|
945
945
|
@options[:resolve] = resolve
|
946
946
|
end
|
947
947
|
|
948
|
+
separator "\nPLAN OPTIONS"
|
949
|
+
define('--pp', 'Create a new Puppet language plan.') do |pp|
|
950
|
+
@options[:puppet] = pp
|
951
|
+
end
|
952
|
+
|
948
953
|
separator "\nDISPLAY OPTIONS"
|
949
954
|
define('--filter FILTER', 'Filter tasks and plans by a matching substring') do |filter|
|
950
955
|
unless /^[a-z0-9_:]+$/.match(filter)
|
data/lib/bolt/cli.rb
CHANGED
@@ -15,17 +15,18 @@ require 'bolt/config'
|
|
15
15
|
require 'bolt/error'
|
16
16
|
require 'bolt/executor'
|
17
17
|
require 'bolt/inventory'
|
18
|
-
require 'bolt/rerun'
|
19
18
|
require 'bolt/logger'
|
19
|
+
require 'bolt/module_installer'
|
20
20
|
require 'bolt/outputter'
|
21
|
-
require 'bolt/
|
21
|
+
require 'bolt/pal'
|
22
|
+
require 'bolt/plan_creator'
|
22
23
|
require 'bolt/plugin'
|
23
24
|
require 'bolt/project_migrator'
|
24
|
-
require 'bolt/
|
25
|
+
require 'bolt/puppetdb'
|
26
|
+
require 'bolt/rerun'
|
27
|
+
require 'bolt/secret'
|
25
28
|
require 'bolt/target'
|
26
29
|
require 'bolt/version'
|
27
|
-
require 'bolt/secret'
|
28
|
-
require 'bolt/module_installer'
|
29
30
|
|
30
31
|
module Bolt
|
31
32
|
class CLIExit < StandardError; end
|
@@ -196,10 +197,6 @@ module Bolt
|
|
196
197
|
|
197
198
|
warn_inventory_overrides_cli(options)
|
198
199
|
|
199
|
-
# Assert whether the puppetfile/module commands are available depending
|
200
|
-
# on whether 'modules' is configured.
|
201
|
-
assert_puppetfile_or_module_command(config.project.modules)
|
202
|
-
|
203
200
|
options
|
204
201
|
rescue Bolt::Error => e
|
205
202
|
outputter.fatal_error(e)
|
@@ -228,9 +225,9 @@ module Bolt
|
|
228
225
|
|
229
226
|
def validate(options)
|
230
227
|
unless COMMANDS.include?(options[:subcommand])
|
228
|
+
command = Bolt::Util.powershell? ? 'Get-Command -Module PuppetBolt' : 'bolt help'
|
231
229
|
raise Bolt::CLIError,
|
232
|
-
"
|
233
|
-
"#{COMMANDS.keys.join(', ')}"
|
230
|
+
"'#{options[:subcommand]}' is not a Bolt command. See '#{command}'."
|
234
231
|
end
|
235
232
|
|
236
233
|
actions = COMMANDS[options[:subcommand]]
|
@@ -285,8 +282,9 @@ module Bolt
|
|
285
282
|
end
|
286
283
|
|
287
284
|
if options[:subcommand] == 'module' && options[:action] == 'install' && options[:object]
|
285
|
+
command = Bolt::Util.powershell? ? 'Add-BoltModule -Module' : 'bolt module add'
|
288
286
|
raise Bolt::CLIError, "Invalid argument '#{options[:object]}'. To add a new module to "\
|
289
|
-
"the project, run '
|
287
|
+
"the project, run '#{command} #{options[:object]}'."
|
290
288
|
end
|
291
289
|
|
292
290
|
if options[:subcommand] != 'file' && options[:subcommand] != 'script' &&
|
@@ -465,7 +463,16 @@ module Bolt
|
|
465
463
|
when 'plan'
|
466
464
|
case options[:action]
|
467
465
|
when 'new'
|
468
|
-
|
466
|
+
command = Bolt::Util.powershell? ? 'New-BoltPlan' : 'bolt plan new'
|
467
|
+
@logger.warn("Command '#{command}' is experimental and subject to changes.")
|
468
|
+
plan_name = options[:object]
|
469
|
+
|
470
|
+
# If this passes validation, it will return the path to the plan to create
|
471
|
+
Bolt::PlanCreator.validate_input(config.project, plan_name)
|
472
|
+
code = Bolt::PlanCreator.create_plan(config.project.plans_path,
|
473
|
+
plan_name,
|
474
|
+
outputter,
|
475
|
+
options[:puppet])
|
469
476
|
when 'run'
|
470
477
|
code = run_plan(options[:object], options[:task_options], options[:target_args], options)
|
471
478
|
end
|
@@ -568,10 +575,15 @@ module Bolt
|
|
568
575
|
outputter.print_task_info(pal.get_task(task_name))
|
569
576
|
end
|
570
577
|
|
578
|
+
# Filters a list of content by matching substring.
|
579
|
+
#
|
580
|
+
private def filter_content(content, filter)
|
581
|
+
return content unless content && filter
|
582
|
+
content.select { |name,| name.include?(filter) }
|
583
|
+
end
|
584
|
+
|
571
585
|
def list_tasks
|
572
|
-
tasks = pal.list_tasks
|
573
|
-
tasks.select! { |task| task.first.include?(options[:filter]) } if options[:filter]
|
574
|
-
tasks.select! { |task| config.project.tasks.include?(task.first) } unless config.project.tasks.nil?
|
586
|
+
tasks = filter_content(pal.list_tasks(filter_content: true), options[:filter])
|
575
587
|
outputter.print_tasks(tasks, pal.user_modulepath)
|
576
588
|
end
|
577
589
|
|
@@ -580,9 +592,7 @@ module Bolt
|
|
580
592
|
end
|
581
593
|
|
582
594
|
def list_plans
|
583
|
-
plans = pal.list_plans
|
584
|
-
plans.select! { |plan| plan.first.include?(options[:filter]) } if options[:filter]
|
585
|
-
plans.select! { |plan| config.project.plans.include?(plan.first) } unless config.project.plans.nil?
|
595
|
+
plans = filter_content(pal.list_plans(filter_content: true), options[:filter])
|
586
596
|
outputter.print_plans(plans, pal.user_modulepath)
|
587
597
|
end
|
588
598
|
|
@@ -617,118 +627,6 @@ module Bolt
|
|
617
627
|
outputter.print_groups(groups)
|
618
628
|
end
|
619
629
|
|
620
|
-
def new_plan(plan_name)
|
621
|
-
@logger.warn("Command 'bolt plan new' is experimental and subject to changes.")
|
622
|
-
|
623
|
-
if config.project.name.nil?
|
624
|
-
raise Bolt::Error.new(
|
625
|
-
"Project directory '#{config.project.path}' is not a named project. Unable to create "\
|
626
|
-
"a project-level plan. To name a project, set the 'name' key in the 'bolt-project.yaml' "\
|
627
|
-
"configuration file.",
|
628
|
-
"bolt/unnamed-project-error"
|
629
|
-
)
|
630
|
-
end
|
631
|
-
|
632
|
-
if plan_name !~ Bolt::Module::CONTENT_NAME_REGEX
|
633
|
-
message = <<~MESSAGE.chomp
|
634
|
-
Invalid plan name '#{plan_name}'. Plan names are composed of one or more name segments
|
635
|
-
separated by double colons '::'.
|
636
|
-
|
637
|
-
Each name segment must begin with a lowercase letter, and may only include lowercase
|
638
|
-
letters, digits, and underscores.
|
639
|
-
|
640
|
-
Examples of valid plan names:
|
641
|
-
- #{config.project.name}
|
642
|
-
- #{config.project.name}::my_plan
|
643
|
-
MESSAGE
|
644
|
-
|
645
|
-
raise Bolt::ValidationError, message
|
646
|
-
end
|
647
|
-
|
648
|
-
prefix, *name_segments, basename = plan_name.split('::')
|
649
|
-
|
650
|
-
# If the plan name is just the project name, then create an 'init' plan.
|
651
|
-
# Otherwise, use the last name segment for the plan's filename.
|
652
|
-
basename ||= 'init'
|
653
|
-
|
654
|
-
unless prefix == config.project.name
|
655
|
-
message = "First segment of plan name '#{plan_name}' must match project name '#{config.project.name}'. "\
|
656
|
-
"Did you mean '#{config.project.name}::#{plan_name}'?"
|
657
|
-
|
658
|
-
raise Bolt::ValidationError, message
|
659
|
-
end
|
660
|
-
|
661
|
-
dir_path = config.project.plans_path.join(*name_segments)
|
662
|
-
|
663
|
-
%w[pp yaml].each do |ext|
|
664
|
-
next unless (path = config.project.plans_path + "#{basename}.#{ext}").exist?
|
665
|
-
raise Bolt::Error.new(
|
666
|
-
"A plan with the name '#{plan_name}' already exists at '#{path}', nothing to do.",
|
667
|
-
'bolt/existing-plan-error'
|
668
|
-
)
|
669
|
-
end
|
670
|
-
|
671
|
-
begin
|
672
|
-
FileUtils.mkdir_p(dir_path)
|
673
|
-
rescue Errno::EEXIST => e
|
674
|
-
raise Bolt::Error.new(
|
675
|
-
"#{e.message}; unable to create plan directory '#{dir_path}'",
|
676
|
-
'bolt/existing-file-error'
|
677
|
-
)
|
678
|
-
end
|
679
|
-
|
680
|
-
plan_path = dir_path + "#{basename}.yaml"
|
681
|
-
|
682
|
-
plan_template = <<~PLAN
|
683
|
-
# This is the structure of a simple plan. To learn more about writing
|
684
|
-
# YAML plans, see the documentation: http://pup.pt/bolt-yaml-plans
|
685
|
-
|
686
|
-
# The description sets the description of the plan that will appear
|
687
|
-
# in 'bolt plan show' output.
|
688
|
-
description: A plan created with bolt plan new
|
689
|
-
|
690
|
-
# The parameters key defines the parameters that can be passed to
|
691
|
-
# the plan.
|
692
|
-
parameters:
|
693
|
-
targets:
|
694
|
-
type: TargetSpec
|
695
|
-
description: A list of targets to run actions on
|
696
|
-
default: localhost
|
697
|
-
|
698
|
-
# The steps key defines the actions the plan will take in order.
|
699
|
-
steps:
|
700
|
-
- message: Hello from #{plan_name}
|
701
|
-
- name: command_step
|
702
|
-
command: whoami
|
703
|
-
targets: $targets
|
704
|
-
|
705
|
-
# The return key sets the return value of the plan.
|
706
|
-
return: $command_step
|
707
|
-
PLAN
|
708
|
-
|
709
|
-
begin
|
710
|
-
File.write(plan_path, plan_template)
|
711
|
-
rescue Errno::EACCES => e
|
712
|
-
raise Bolt::FileError.new(
|
713
|
-
"#{e.message}; unable to create plan",
|
714
|
-
plan_path
|
715
|
-
)
|
716
|
-
end
|
717
|
-
|
718
|
-
output = <<~OUTPUT
|
719
|
-
Created plan '#{plan_name}' at '#{plan_path}'
|
720
|
-
|
721
|
-
Show this plan with:
|
722
|
-
bolt plan show #{plan_name}
|
723
|
-
Run this plan with:
|
724
|
-
bolt plan run #{plan_name}
|
725
|
-
OUTPUT
|
726
|
-
|
727
|
-
outputter.print_message(output)
|
728
|
-
|
729
|
-
0
|
730
|
-
end
|
731
|
-
|
732
630
|
def run_plan(plan_name, plan_arguments, nodes, options)
|
733
631
|
unless nodes.empty?
|
734
632
|
if plan_arguments['nodes'] || plan_arguments['targets']
|
@@ -820,10 +718,12 @@ module Bolt
|
|
820
718
|
end
|
821
719
|
|
822
720
|
def list_modules
|
721
|
+
assert_puppetfile_or_module_command(config.project.modules)
|
823
722
|
outputter.print_module_list(pal.list_modules)
|
824
723
|
end
|
825
724
|
|
826
725
|
def generate_types
|
726
|
+
assert_puppetfile_or_module_command(config.project.modules)
|
827
727
|
# generate_types will surface a nice error with helpful message if it fails
|
828
728
|
pal.generate_types
|
829
729
|
0
|
@@ -844,8 +744,9 @@ module Bolt
|
|
844
744
|
"project name must begin with a lowercase letter and can include lowercase "\
|
845
745
|
"letters, numbers, and underscores."
|
846
746
|
else
|
747
|
+
command = Bolt::Util.powershell? ? 'New-BoltProject -Name <NAME>' : 'bolt project init <NAME>'
|
847
748
|
raise Bolt::ValidationError, "The current directory name '#{name}' is an invalid "\
|
848
|
-
"project name. Please specify a name using '
|
749
|
+
"project name. Please specify a name using '#{command}'."
|
849
750
|
end
|
850
751
|
end
|
851
752
|
|
@@ -902,6 +803,7 @@ module Bolt
|
|
902
803
|
#
|
903
804
|
def install_project_modules(project, force, resolve)
|
904
805
|
assert_project_file(project)
|
806
|
+
assert_puppetfile_or_module_command(project.modules)
|
905
807
|
|
906
808
|
unless project.modules
|
907
809
|
outputter.print_message "Project configuration file #{project.project_file} does not "\
|
@@ -923,6 +825,7 @@ module Bolt
|
|
923
825
|
#
|
924
826
|
def add_project_module(name, project)
|
925
827
|
assert_project_file(project)
|
828
|
+
assert_puppetfile_or_module_command(project.modules)
|
926
829
|
|
927
830
|
modules = project.modules || []
|
928
831
|
installer = Bolt::ModuleInstaller.new(outputter, pal)
|
@@ -940,11 +843,13 @@ module Bolt
|
|
940
843
|
def assert_project_file(project)
|
941
844
|
unless project.project_file?
|
942
845
|
msg = if project.config_file.exist?
|
846
|
+
command = Bolt::Util.powershell? ? 'Update-BoltProject' : 'bolt project migrate'
|
943
847
|
"Detected Bolt configuration file #{project.config_file}, unable to install "\
|
944
|
-
"modules. To update to a project configuration file, run '
|
848
|
+
"modules. To update to a project configuration file, run '#{command}'."
|
945
849
|
else
|
850
|
+
command = Bolt::Util.powershell? ? 'New-BoltProject' : 'bolt project init'
|
946
851
|
"Could not find project configuration file #{project.project_file}, unable "\
|
947
|
-
"to install modules. To create a Bolt project, run '
|
852
|
+
"to install modules. To create a Bolt project, run '#{command}'."
|
948
853
|
end
|
949
854
|
|
950
855
|
raise Bolt::Error.new(msg, 'bolt/missing-project-config-error')
|
@@ -953,10 +858,12 @@ module Bolt
|
|
953
858
|
|
954
859
|
# Loads a Puppetfile and installs its modules.
|
955
860
|
#
|
956
|
-
def install_puppetfile(
|
861
|
+
def install_puppetfile(puppetfile_config, puppetfile, moduledir)
|
862
|
+
assert_puppetfile_or_module_command(config.project.modules)
|
863
|
+
|
957
864
|
outputter.print_message("Installing modules from Puppetfile")
|
958
865
|
installer = Bolt::ModuleInstaller.new(outputter, pal)
|
959
|
-
ok = installer.install_puppetfile(puppetfile, moduledir,
|
866
|
+
ok = installer.install_puppetfile(puppetfile, moduledir, puppetfile_config)
|
960
867
|
ok ? 0 : 1
|
961
868
|
end
|
962
869
|
|
@@ -964,17 +871,36 @@ module Bolt
|
|
964
871
|
# modules being configured.
|
965
872
|
#
|
966
873
|
def assert_puppetfile_or_module_command(modules)
|
874
|
+
if Bolt::Util.powershell?
|
875
|
+
case options[:action]
|
876
|
+
when 'generate-types'
|
877
|
+
old_command = 'Register-BoltPuppetfileTypes'
|
878
|
+
new_command = 'Register-BoltModuleTypes'
|
879
|
+
when 'install'
|
880
|
+
old_command = 'Install-BoltPuppetfile'
|
881
|
+
new_command = 'Install-BoltModule'
|
882
|
+
when 'show', 'show-modules'
|
883
|
+
old_command = 'Get-BoltPuppetfileModules'
|
884
|
+
new_command = 'Get-BoltModule'
|
885
|
+
end
|
886
|
+
else
|
887
|
+
old_command = "bolt puppetfile #{options[:action]}"
|
888
|
+
new_command = if options[:action] == 'show-modules'
|
889
|
+
'bolt module show'
|
890
|
+
else
|
891
|
+
"bolt module #{options[:action]}"
|
892
|
+
end
|
893
|
+
end
|
894
|
+
|
967
895
|
if modules && options[:subcommand] == 'puppetfile'
|
968
896
|
raise Bolt::CLIError,
|
969
|
-
"Unable to use command '
|
970
|
-
"
|
971
|
-
"instead. For a list of available actions for the 'module' command, run "\
|
972
|
-
"'bolt module --help'."
|
897
|
+
"Unable to use command '#{old_command}' when 'modules' is configured in "\
|
898
|
+
"bolt-project.yaml. Use '#{new_command}' instead."
|
973
899
|
elsif modules.nil? && options[:subcommand] == 'module'
|
974
|
-
|
975
|
-
|
976
|
-
|
977
|
-
|
900
|
+
msg = "Unable to use command '#{new_command}' when 'modules' is not configured in "\
|
901
|
+
"bolt-project.yaml. "
|
902
|
+
msg += "Use '#{old_command}' instead." if options[:action] != 'add'
|
903
|
+
raise Bolt::CLIError, msg
|
978
904
|
end
|
979
905
|
end
|
980
906
|
|
data/lib/bolt/config/options.rb
CHANGED
@@ -234,26 +234,44 @@ module Bolt
|
|
234
234
|
type: Array,
|
235
235
|
items: {
|
236
236
|
type: [Hash, String],
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
237
|
+
oneOf: [
|
238
|
+
{
|
239
|
+
required: ["name"],
|
240
|
+
properties: {
|
241
|
+
"name" => {
|
242
|
+
description: "The name of the module.",
|
243
|
+
type: String
|
244
|
+
},
|
245
|
+
"version_requirement" => {
|
246
|
+
description: "The version requirement for the module. Accepts a specific version (1.2.3), version "\
|
247
|
+
"shorthand (1.2.x), or a version range (>= 1.2.0).",
|
248
|
+
type: String
|
249
|
+
}
|
250
|
+
}
|
242
251
|
},
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
252
|
+
{
|
253
|
+
required: %w[git ref],
|
254
|
+
properties: {
|
255
|
+
"git" => {
|
256
|
+
description: "The URL to the public git repository.",
|
257
|
+
type: String
|
258
|
+
},
|
259
|
+
"ref" => {
|
260
|
+
description: "The git reference to check out. Can be either a branch, tag, or commit SHA.",
|
261
|
+
type: String
|
262
|
+
}
|
263
|
+
}
|
247
264
|
}
|
248
|
-
|
265
|
+
]
|
249
266
|
},
|
250
267
|
_plugin: false,
|
251
268
|
_example: [
|
252
|
-
{ "name" => "puppetlabs-mysql" },
|
253
269
|
"puppetlabs-facts",
|
270
|
+
{ "name" => "puppetlabs-mysql" },
|
254
271
|
{ "name" => "puppetlabs-apache", "version_requirement" => "5.5.0" },
|
255
272
|
{ "name" => "puppetlabs-puppetdb", "version_requirement" => "7.x" },
|
256
|
-
{ "name" => "puppetlabs-firewall", "version_requirement" => ">= 1.0.0 < 3.0.0" }
|
273
|
+
{ "name" => "puppetlabs-firewall", "version_requirement" => ">= 1.0.0 < 3.0.0" },
|
274
|
+
{ "git" => "https://github.com/puppetlabs/puppetlabs-apt", "ref" => "7.6.0" }
|
257
275
|
]
|
258
276
|
},
|
259
277
|
"name" => {
|
@@ -265,7 +283,7 @@ module Bolt
|
|
265
283
|
_example: "myproject"
|
266
284
|
},
|
267
285
|
"plans" => {
|
268
|
-
description: "A list of plan names
|
286
|
+
description: "A list of plan names and glob patterns to filter the project's plans by. This option is used "\
|
269
287
|
"to limit the visibility of plans for users of the project. For example, project authors "\
|
270
288
|
"might want to limit the visibility of plans that are bundled with Bolt or plans that should "\
|
271
289
|
"only be run as part of another plan. When this option is not configured, all plans are "\
|
@@ -273,7 +291,7 @@ module Bolt
|
|
273
291
|
"list.",
|
274
292
|
type: Array,
|
275
293
|
_plugin: false,
|
276
|
-
_example: ["myproject", "myproject::foo", "myproject::bar"]
|
294
|
+
_example: ["myproject", "myproject::foo", "myproject::bar", "myproject::deploy::*"]
|
277
295
|
},
|
278
296
|
"plugin_hooks" => {
|
279
297
|
description: "A map of [plugin hooks](writing_plugins.md#hooks) and which plugins a hook should use. "\
|
@@ -329,7 +347,7 @@ module Bolt
|
|
329
347
|
"server_urls" => {
|
330
348
|
description: "An array containing the PuppetDB host to connect to. Include the protocol `https` "\
|
331
349
|
"and the port, which is usually `8081`. For example, "\
|
332
|
-
"`https://my-
|
350
|
+
"`https://my-puppetdb-server.com:8081`.",
|
333
351
|
type: Array,
|
334
352
|
_example: ["https://puppet.example.com:8081"]
|
335
353
|
},
|
@@ -384,7 +402,7 @@ module Bolt
|
|
384
402
|
_default: true
|
385
403
|
},
|
386
404
|
"tasks" => {
|
387
|
-
description: "A list of task names
|
405
|
+
description: "A list of task names and glob patterns to filter the project's tasks by. This option is used "\
|
388
406
|
"to limit the visibility of tasks for users of the project. For example, project authors "\
|
389
407
|
"might want to limit the visibility of tasks that are bundled with Bolt or plans that should "\
|
390
408
|
"only be run as part of a larger workflow. When this option is not configured, all tasks "\
|
@@ -395,7 +413,7 @@ module Bolt
|
|
395
413
|
type: String
|
396
414
|
},
|
397
415
|
_plugin: false,
|
398
|
-
_example: ["myproject", "myproject::foo", "myproject::bar"]
|
416
|
+
_example: ["myproject", "myproject::foo", "myproject::bar", "myproject::deploy_*"]
|
399
417
|
},
|
400
418
|
"trusted-external-command" => {
|
401
419
|
description: "The path to an executable on the Bolt controller that can produce external trusted facts. "\
|