bolt 3.17.0 → 3.21.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 +177 -12
- 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 +87 -22
- data/lib/bolt/catalog.rb +10 -11
- data/lib/bolt/cli.rb +66 -24
- data/lib/bolt/config/modulepath.rb +1 -1
- data/lib/bolt/config/options.rb +42 -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 +9 -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 +3 -9
- data/lib/bolt/inventory/options.rb +1 -1
- data/lib/bolt/inventory/target.rb +1 -1
- data/lib/bolt/inventory.rb +8 -8
- 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 +45 -2
- data/lib/bolt/outputter/json.rb +8 -0
- 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 +25 -11
- data/lib/bolt/plan_creator.rb +4 -4
- 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 +7 -7
- data/lib/bolt/project.rb +7 -5
- 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 +26 -5
- data/lib/bolt_spec/bolt_context.rb +6 -4
- data/lib/bolt_spec/plans/mock_executor.rb +3 -3
- 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: 161a4fa9b8f36d32bd32964eeab21d3df8588e900f18999ee3ea9f0d56d56aec
|
4
|
+
data.tar.gz: bd8e0f955123e73058904f8e22335a516f1f41dcb5e8bdf4e7ad9bc0c01fe212
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b27fc4df0159d56610a5c2ebadd0a78234bc4e88815b2705f1000400f786079bddbcff37544024a81bc221afc48c60cfd884d2cee7f18018df1644dc7370548
|
7
|
+
data.tar.gz: 42c757fd3f406760d7b8d01809568270e92fb1ff57771ac07d392e26dd04be2f340a845906b7ea039e095e72e66bf37d56762b4e067db12eedb6773ffd47f492
|
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,8 +2,8 @@
|
|
2
2
|
|
3
3
|
require 'benchmark'
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
require_relative '../bolt/plan_creator'
|
6
|
+
require_relative '../bolt/util'
|
7
7
|
|
8
8
|
module Bolt
|
9
9
|
class Application
|
@@ -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
|
@@ -333,12 +333,6 @@ module Bolt
|
|
333
333
|
def new_plan(name, puppet: false, plan_script: nil)
|
334
334
|
Bolt::PlanCreator.validate_plan_name(config.project, name)
|
335
335
|
|
336
|
-
if plan_script && !config.future&.fetch('file_paths', false)
|
337
|
-
raise Bolt::CLIError,
|
338
|
-
"The --script flag can only be used if future.file_paths is " \
|
339
|
-
"configured in bolt-project.yaml."
|
340
|
-
end
|
341
|
-
|
342
336
|
if plan_script
|
343
337
|
Bolt::Util.validate_file('script', find_file(plan_script))
|
344
338
|
end
|
@@ -419,6 +413,178 @@ module Bolt
|
|
419
413
|
{ plugins: plugins.list_plugins, modulepath: pal.user_modulepath }
|
420
414
|
end
|
421
415
|
|
416
|
+
# Applies one or more policies to the specified targets.
|
417
|
+
#
|
418
|
+
# @param policies [String] A comma-separated list of policies to apply.
|
419
|
+
# @param targets [Array[String]] The list of targets to apply the policies to.
|
420
|
+
# @param noop [Boolean] Whether to apply the policies in no-operation mode.
|
421
|
+
# @return [Bolt::ResultSet]
|
422
|
+
#
|
423
|
+
def apply_policies(policies, targets, noop: false)
|
424
|
+
policies = policies.split(',')
|
425
|
+
|
426
|
+
# Validate that the policies are available to the project.
|
427
|
+
unavailable_policies = policies.reject do |policy|
|
428
|
+
@config.policies&.any? do |known_policy|
|
429
|
+
File.fnmatch?(known_policy, policy, File::FNM_EXTGLOB)
|
430
|
+
end
|
431
|
+
end
|
432
|
+
|
433
|
+
if unavailable_policies.any?
|
434
|
+
command = Bolt::Util.powershell? ? 'Get-BoltPolicy' : 'bolt policy show'
|
435
|
+
|
436
|
+
# CODEREVIEW: Phrasing
|
437
|
+
raise Bolt::Error.new(
|
438
|
+
"The following policies are not available to the project: '#{unavailable_policies.join("', '")}'. "\
|
439
|
+
"You must list policies in a project's 'policies' setting before Bolt can apply them to targets. "\
|
440
|
+
"For a list of policies available to the project, run '#{command}'.",
|
441
|
+
'bolt/unavailable-policy-error'
|
442
|
+
)
|
443
|
+
end
|
444
|
+
|
445
|
+
# Validate that the policies are loadable Puppet classes.
|
446
|
+
unloadable_policies = []
|
447
|
+
|
448
|
+
@pal.in_catalog_compiler do |_|
|
449
|
+
environment = Puppet.lookup(:current_environment)
|
450
|
+
|
451
|
+
unloadable_policies = policies.reject do |policy|
|
452
|
+
environment.known_resource_types.find_hostclass(policy)
|
453
|
+
end
|
454
|
+
end
|
455
|
+
|
456
|
+
# CODEREVIEW: Phrasing
|
457
|
+
if unloadable_policies.any?
|
458
|
+
raise Bolt::Error.new(
|
459
|
+
"The following policies cannot be loaded: '#{unloadable_policies.join("', '")}'. "\
|
460
|
+
"Policies must be a Puppet class saved to a project's or module's manifests directory.",
|
461
|
+
'bolt/unloadable-policy-error'
|
462
|
+
)
|
463
|
+
end
|
464
|
+
|
465
|
+
# Execute a single include statement with all the policies to apply them
|
466
|
+
# to the targets. Yay, reusable code!
|
467
|
+
apply(nil, targets, code: "include #{policies.join(', ')}", noop: noop)
|
468
|
+
end
|
469
|
+
|
470
|
+
# Add a new policy to the project.
|
471
|
+
#
|
472
|
+
# @param name [String] The name of the new policy.
|
473
|
+
# @return [Hash]
|
474
|
+
#
|
475
|
+
def new_policy(name)
|
476
|
+
# Validate the policy name
|
477
|
+
unless name =~ Bolt::Module::CONTENT_NAME_REGEX
|
478
|
+
message = <<~MESSAGE.chomp
|
479
|
+
Invalid policy name '#{name}'. Policy names are composed of one or more name segments
|
480
|
+
separated by double colons '::'.
|
481
|
+
|
482
|
+
Each name segment must begin with a lowercase letter, and can only include lowercase
|
483
|
+
letters, digits, and underscores.
|
484
|
+
|
485
|
+
Examples of valid policy names:
|
486
|
+
- #{@config.project.name}
|
487
|
+
- #{@config.project.name}::my_policy
|
488
|
+
MESSAGE
|
489
|
+
|
490
|
+
raise Bolt::ValidationError, message
|
491
|
+
end
|
492
|
+
|
493
|
+
# Validate that we're not running with the default project
|
494
|
+
if @config.project.name.nil?
|
495
|
+
command = Bolt::Util.powershell? ? 'New-BoltProject -Name <NAME>' : 'bolt project init <NAME>'
|
496
|
+
message = <<~MESSAGE.chomp
|
497
|
+
Can't create a policy for the default Bolt project because it doesn't
|
498
|
+
have a name. Run '#{command}' to create a new project.
|
499
|
+
MESSAGE
|
500
|
+
raise Bolt::ValidationError, message
|
501
|
+
end
|
502
|
+
|
503
|
+
prefix, *name_segments, basename = name.split('::')
|
504
|
+
|
505
|
+
# Error if name is not namespaced to project
|
506
|
+
unless prefix == @config.project.name
|
507
|
+
raise Bolt::ValidationError,
|
508
|
+
"Policy name '#{name}' must begin with project name '#{@config.project.name}'. Did "\
|
509
|
+
"you mean '#{@config.project.name}::#{name}'?"
|
510
|
+
end
|
511
|
+
|
512
|
+
# If the policy name is just the project name, use the special init.pp class
|
513
|
+
basename ||= 'init'
|
514
|
+
|
515
|
+
# Policies can be saved in subdirectories in the 'manifests/' directory
|
516
|
+
policy_dir = File.expand_path(File.join(name_segments), @config.project.manifests)
|
517
|
+
policy = File.expand_path("#{basename}.pp", policy_dir)
|
518
|
+
|
519
|
+
# Ensure the policy does not already exist
|
520
|
+
if File.exist?(policy)
|
521
|
+
raise Bolt::Error.new(
|
522
|
+
"A policy with the name '#{name}' already exists at '#{policy}', nothing to do.",
|
523
|
+
'bolt/existing-policy-error'
|
524
|
+
)
|
525
|
+
end
|
526
|
+
|
527
|
+
# Create the policy directory structure in the current project
|
528
|
+
begin
|
529
|
+
FileUtils.mkdir_p(policy_dir)
|
530
|
+
rescue Errno::EEXIST => e
|
531
|
+
raise Bolt::Error.new(
|
532
|
+
"#{e.message}; unable to create manifests directory '#{policy_dir}'",
|
533
|
+
'bolt/existing-file-error'
|
534
|
+
)
|
535
|
+
end
|
536
|
+
|
537
|
+
# Create the new policy
|
538
|
+
begin
|
539
|
+
File.write(policy, <<~POLICY)
|
540
|
+
class #{name} {
|
541
|
+
|
542
|
+
}
|
543
|
+
POLICY
|
544
|
+
rescue Errno::EACCES => e
|
545
|
+
raise Bolt::FileError.new("#{e.message}; unable to create policy", policy)
|
546
|
+
end
|
547
|
+
|
548
|
+
# Update the project configuration to include the new policy
|
549
|
+
project_config = Bolt::Util.read_yaml_hash(@config.project.project_file, 'project config')
|
550
|
+
|
551
|
+
# Add the 'policies' key if it does not exist and de-dupiclate entries
|
552
|
+
project_config['policies'] ||= []
|
553
|
+
project_config['policies'] << name
|
554
|
+
project_config['policies'].uniq!
|
555
|
+
|
556
|
+
begin
|
557
|
+
File.write(@config.project.project_file, project_config.to_yaml)
|
558
|
+
rescue Errno::EACCES => e
|
559
|
+
raise Bolt::FileError.new(
|
560
|
+
"#{e.message}; unable to update project configuration",
|
561
|
+
@config.project.project_file
|
562
|
+
)
|
563
|
+
end
|
564
|
+
|
565
|
+
{ name: name, path: policy }
|
566
|
+
end
|
567
|
+
|
568
|
+
# List policies available to the project.
|
569
|
+
#
|
570
|
+
# @return [Hash]
|
571
|
+
#
|
572
|
+
def list_policies
|
573
|
+
unless @config.policies
|
574
|
+
command = Bolt::Util.powershell? ? 'New-BoltPolicy -Name <NAME>' : 'bolt policy new <NAME>'
|
575
|
+
|
576
|
+
raise Bolt::Error.new(
|
577
|
+
"Project configuration file #{@config.project.project_file} does not "\
|
578
|
+
"specify any policies. You can add policies to the project by including "\
|
579
|
+
"a 'policies' key or creating a new policy using the '#{command}' "\
|
580
|
+
"command.",
|
581
|
+
'bolt/no-policies-error'
|
582
|
+
)
|
583
|
+
end
|
584
|
+
|
585
|
+
{ policies: @config.policies.uniq, modulepath: pal.user_modulepath }
|
586
|
+
end
|
587
|
+
|
422
588
|
# Initialize the current directory as a Bolt project.
|
423
589
|
#
|
424
590
|
# @param name [String] The name of the project.
|
@@ -575,11 +741,10 @@ module Bolt
|
|
575
741
|
modulepath = Bolt::Config::Modulepath.new(config.modulepath)
|
576
742
|
modules = Bolt::Module.discover(modulepath.full_modulepath, config.project)
|
577
743
|
mod, file = path.split(File::SEPARATOR, 2)
|
578
|
-
future = executor.future&.fetch('file_paths', false)
|
579
744
|
|
580
745
|
if modules[mod]
|
581
746
|
logger.debug("Did not find file at #{File.expand_path(path)}, checking in module '#{mod}'")
|
582
|
-
found = Bolt::Util.find_file_in_module(modules[mod].path, file || ""
|
747
|
+
found = Bolt::Util.find_file_in_module(modules[mod].path, file || "")
|
583
748
|
path = found.nil? ? File.join(modules[mod].path, 'files', file) : found
|
584
749
|
end
|
585
750
|
|
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