bolt 2.27.0 → 2.32.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 +13 -12
- data/bolt-modules/boltlib/lib/puppet/functions/write_file.rb +2 -2
- 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/module.txt +19 -0
- data/guides/modulepath.txt +25 -0
- data/lib/bolt/applicator.rb +14 -14
- data/lib/bolt/bolt_option_parser.rb +74 -22
- data/lib/bolt/catalog.rb +1 -1
- data/lib/bolt/cli.rb +178 -127
- data/lib/bolt/config.rb +13 -1
- data/lib/bolt/config/modulepath.rb +30 -0
- data/lib/bolt/config/options.rb +38 -9
- data/lib/bolt/config/transport/options.rb +1 -1
- data/lib/bolt/executor.rb +1 -1
- data/lib/bolt/inventory.rb +11 -10
- data/lib/bolt/logger.rb +26 -19
- data/lib/bolt/module_installer.rb +197 -0
- 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 +84 -0
- data/lib/bolt/module_installer/specs/git_spec.rb +178 -0
- data/lib/bolt/outputter.rb +2 -45
- data/lib/bolt/outputter/human.rb +78 -18
- data/lib/bolt/outputter/json.rb +22 -7
- data/lib/bolt/outputter/logger.rb +2 -2
- data/lib/bolt/pal.rb +29 -25
- data/lib/bolt/plugin.rb +1 -1
- data/lib/bolt/plugin/module.rb +1 -1
- data/lib/bolt/project.rb +32 -22
- data/lib/bolt/project_migrator.rb +80 -0
- data/lib/bolt/project_migrator/base.rb +39 -0
- data/lib/bolt/project_migrator/config.rb +67 -0
- data/lib/bolt/project_migrator/inventory.rb +67 -0
- data/lib/bolt/project_migrator/modules.rb +200 -0
- data/lib/bolt/shell/bash.rb +4 -3
- data/lib/bolt/transport/base.rb +4 -4
- data/lib/bolt/transport/ssh/connection.rb +1 -1
- data/lib/bolt/util.rb +51 -10
- data/lib/bolt/version.rb +1 -1
- data/lib/bolt_server/acl.rb +2 -2
- data/lib/bolt_server/base_config.rb +3 -3
- data/lib/bolt_server/file_cache.rb +11 -11
- data/lib/bolt_server/schemas/partials/task.json +17 -2
- data/lib/bolt_server/transport_app.rb +93 -13
- data/lib/bolt_spec/bolt_context.rb +8 -6
- data/lib/bolt_spec/plans.rb +1 -1
- data/lib/bolt_spec/plans/mock_executor.rb +1 -1
- data/lib/bolt_spec/run.rb +1 -1
- metadata +30 -11
- data/lib/bolt/project_migrate.rb +0 -138
- data/lib/bolt/puppetfile.rb +0 -160
- data/lib/bolt/puppetfile/module.rb +0 -66
- data/lib/bolt_server/pe/pal.rb +0 -67
@@ -1,66 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'bolt/error'
|
4
|
-
|
5
|
-
# This class represents a module specification. It used by the Bolt::Puppetfile
|
6
|
-
# class to have a consistent API for accessing a module's attributes.
|
7
|
-
#
|
8
|
-
module Bolt
|
9
|
-
class Puppetfile
|
10
|
-
class Module
|
11
|
-
attr_reader :owner, :name, :version
|
12
|
-
|
13
|
-
def initialize(owner, name, version = nil)
|
14
|
-
@owner = owner
|
15
|
-
@name = name
|
16
|
-
@version = version
|
17
|
-
end
|
18
|
-
|
19
|
-
# Creates a new module from a hash.
|
20
|
-
#
|
21
|
-
def self.from_hash(mod)
|
22
|
-
unless mod['name'].is_a?(String)
|
23
|
-
raise Bolt::ValidationError,
|
24
|
-
"Module name must be a String, not #{mod['name'].inspect}"
|
25
|
-
end
|
26
|
-
|
27
|
-
owner, name = mod['name'].tr('/', '-').split('-', 2)
|
28
|
-
|
29
|
-
unless owner && name
|
30
|
-
raise Bolt::ValidationError, "Module name #{mod['name']} must include both the owner and module name."
|
31
|
-
end
|
32
|
-
|
33
|
-
new(owner, name)
|
34
|
-
end
|
35
|
-
|
36
|
-
# Returns the module's title.
|
37
|
-
#
|
38
|
-
def title
|
39
|
-
"#{@owner}-#{@name}"
|
40
|
-
end
|
41
|
-
|
42
|
-
# Checks two modules for equality.
|
43
|
-
#
|
44
|
-
def eql?(other)
|
45
|
-
self.class == other.class && @owner == other.owner && @name == other.name
|
46
|
-
end
|
47
|
-
alias == eql?
|
48
|
-
|
49
|
-
# Hashes the module.
|
50
|
-
#
|
51
|
-
def hash
|
52
|
-
[@owner, @name].hash
|
53
|
-
end
|
54
|
-
|
55
|
-
# Returns the Puppetfile specification for the module.
|
56
|
-
#
|
57
|
-
def to_spec
|
58
|
-
if @version
|
59
|
-
"mod #{title.inspect}, #{@version.inspect}"
|
60
|
-
else
|
61
|
-
"mod #{title.inspect}"
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
data/lib/bolt_server/pe/pal.rb
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'bolt/pal'
|
4
|
-
require 'bolt/util'
|
5
|
-
|
6
|
-
module BoltServer
|
7
|
-
module PE
|
8
|
-
class PAL < Bolt::PAL
|
9
|
-
# PE_BOLTLIB_PATH is intended to function exactly like the BOLTLIB_PATH used
|
10
|
-
# in Bolt::PAL. Paths and variable names are similar to what exists in
|
11
|
-
# Bolt::PAL, but with a 'PE' prefix.
|
12
|
-
PE_BOLTLIB_PATH = '/opt/puppetlabs/server/apps/bolt-server/pe-bolt-modules'
|
13
|
-
|
14
|
-
# For now at least, we maintain an entirely separate codedir from
|
15
|
-
# puppetserver by default, so that filesync can work properly. If filesync
|
16
|
-
# is not used, this can instead match the usual puppetserver codedir.
|
17
|
-
# See the `orchestrator.bolt.codedir` tk config setting.
|
18
|
-
DEFAULT_BOLT_CODEDIR = '/opt/puppetlabs/server/data/orchestration-services/code'
|
19
|
-
|
20
|
-
# This function is nearly identical to Bolt::Pal's `with_puppet_settings` with the
|
21
|
-
# one difference that we set the codedir to point to actual code, rather than the
|
22
|
-
# tmpdir. We only use this funtion inside the PEBolt::PAL initializer so that Puppet
|
23
|
-
# is correctly configured to pull environment configuration correctly. If we don't
|
24
|
-
# set codedir in this way: when we try to load and interpolate the modulepath it
|
25
|
-
# won't correctly load.
|
26
|
-
def with_pe_pal_init_settings(codedir, environmentpath, basemodulepath)
|
27
|
-
Dir.mktmpdir('pe-bolt') do |dir|
|
28
|
-
cli = []
|
29
|
-
Puppet::Settings::REQUIRED_APP_SETTINGS.each do |setting|
|
30
|
-
dir = setting == :codedir ? codedir : dir
|
31
|
-
cli << "--#{setting}" << dir
|
32
|
-
end
|
33
|
-
cli << "--environmentpath" << environmentpath
|
34
|
-
cli << "--basemodulepath" << basemodulepath
|
35
|
-
Puppet.settings.send(:clear_everything_for_tests)
|
36
|
-
Puppet.initialize_settings(cli)
|
37
|
-
yield
|
38
|
-
# Ensure the puppet settings go back to what bolt expects after
|
39
|
-
# we finish with the settings we need for PEBolt::PAL init.
|
40
|
-
with_puppet_settings { |_| nil }
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
def initialize(plan_executor_config, environment_name, hiera_config = nil, max_compiles = nil)
|
45
|
-
# Bolt::PAL#initialize takes the modulepath as its first argument, but we
|
46
|
-
# want to customize it later, so we pass an empty value:
|
47
|
-
super([], hiera_config, max_compiles)
|
48
|
-
|
49
|
-
codedir = plan_executor_config['codedir'] || DEFAULT_BOLT_CODEDIR
|
50
|
-
environmentpath = plan_executor_config['environmentpath'] || "#{codedir}/environments"
|
51
|
-
basemodulepath = plan_executor_config['basemodulepath'] || "#{codedir}/modules:/opt/puppetlabs/puppet/modules"
|
52
|
-
|
53
|
-
with_pe_pal_init_settings(codedir, environmentpath, basemodulepath) do
|
54
|
-
environment = Puppet.lookup(:environments).get!(environment_name)
|
55
|
-
# A new modulepath is created from scratch (rather than using super's @modulepath)
|
56
|
-
# so that we can have full control over all the entries in modulepath. In the future
|
57
|
-
# it's likely we will need to preceed _both_ Bolt::PAL::BOLTLIB_PATH _and_
|
58
|
-
# Bolt::PAL::MODULES_PATH which would be more complex if we tried to use @modulepath since
|
59
|
-
# we need to append our modulepaths and exclude modules shiped in bolt gem code
|
60
|
-
modulepath_dirs = environment.modulepath
|
61
|
-
@user_modulepath = modulepath_dirs
|
62
|
-
@modulepath = [PE_BOLTLIB_PATH, Bolt::PAL::BOLTLIB_PATH, *modulepath_dirs]
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|