bolt 0.8.0 → 0.9.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/lib/bolt/cli.rb +31 -21
- data/lib/bolt/config.rb +1 -0
- data/lib/bolt/error.rb +28 -0
- data/lib/bolt/executor.rb +10 -6
- data/lib/bolt/node.rb +7 -5
- data/lib/bolt/node/errors.rb +25 -3
- data/lib/bolt/node/orch.rb +7 -16
- data/lib/bolt/node/output.rb +17 -0
- data/lib/bolt/node/ssh.rb +101 -44
- data/lib/bolt/node/winrm.rb +86 -40
- data/lib/bolt/outputter/human.rb +65 -8
- data/lib/bolt/outputter/json.rb +8 -1
- data/lib/bolt/result.rb +74 -124
- data/lib/bolt/version.rb +1 -1
- data/{vendored/puppet → modules/boltlib}/lib/puppet/functions/file_upload.rb +9 -7
- data/{vendored/puppet → modules/boltlib}/lib/puppet/functions/run_command.rb +8 -9
- data/{vendored/puppet → modules/boltlib}/lib/puppet/functions/run_plan.rb +8 -12
- data/{vendored/puppet → modules/boltlib}/lib/puppet/functions/run_script.rb +12 -8
- data/{vendored/puppet → modules/boltlib}/lib/puppet/functions/run_task.rb +10 -10
- data/vendored/puppet/lib/puppet/agent.rb +1 -1
- data/vendored/puppet/lib/puppet/application/lookup.rb +1 -3
- data/vendored/puppet/lib/puppet/configurer.rb +2 -3
- data/vendored/puppet/lib/puppet/configurer/plugin_handler.rb +25 -7
- data/vendored/puppet/lib/puppet/defaults.rb +9 -1
- data/vendored/puppet/lib/puppet/face/epp.rb +4 -2
- data/vendored/puppet/lib/puppet/face/module/build.rb +1 -1
- data/vendored/puppet/lib/puppet/face/module/list.rb +5 -16
- data/vendored/puppet/lib/puppet/face/module/uninstall.rb +14 -3
- data/vendored/puppet/lib/puppet/face/plugin.rb +1 -3
- data/vendored/puppet/lib/puppet/forge/errors.rb +17 -7
- data/vendored/puppet/lib/puppet/functions.rb +8 -6
- data/vendored/puppet/lib/puppet/functions/each.rb +10 -4
- data/vendored/puppet/lib/puppet/functions/lookup.rb +2 -2
- data/vendored/puppet/lib/puppet/functions/map.rb +12 -2
- data/vendored/puppet/lib/puppet/functions/slice.rb +2 -3
- data/vendored/puppet/lib/puppet/graph/simple_graph.rb +9 -5
- data/vendored/puppet/lib/puppet/interface.rb +1 -0
- data/vendored/puppet/lib/puppet/module_tool/errors/installer.rb +27 -17
- data/vendored/puppet/lib/puppet/module_tool/errors/shared.rb +143 -63
- data/vendored/puppet/lib/puppet/module_tool/errors/uninstaller.rb +37 -14
- data/vendored/puppet/lib/puppet/module_tool/errors/upgrader.rb +30 -18
- data/vendored/puppet/lib/puppet/network/auth_config_parser.rb +8 -8
- data/vendored/puppet/lib/puppet/network/http/error.rb +7 -7
- data/vendored/puppet/lib/puppet/network/http/rack.rb +2 -2
- data/vendored/puppet/lib/puppet/network/http/webrick.rb +1 -1
- data/vendored/puppet/lib/puppet/node.rb +10 -0
- data/vendored/puppet/lib/puppet/node/facts.rb +9 -0
- data/vendored/puppet/lib/puppet/parameter/value_collection.rb +16 -6
- data/vendored/puppet/lib/puppet/parser/resource.rb +103 -31
- data/vendored/puppet/lib/puppet/pops/evaluator/access_operator.rb +13 -0
- data/vendored/puppet/lib/puppet/pops/evaluator/evaluator_impl.rb +22 -6
- data/vendored/puppet/lib/puppet/pops/loader/static_loader.rb +1 -1
- data/vendored/puppet/lib/puppet/pops/lookup/lookup_adapter.rb +13 -4
- data/vendored/puppet/lib/puppet/pops/model/ast_transformer.rb +1 -1
- data/vendored/puppet/lib/puppet/pops/parser/eparser.rb +527 -529
- data/vendored/puppet/lib/puppet/pops/serialization/abstract_reader.rb +4 -0
- data/vendored/puppet/lib/puppet/pops/serialization/abstract_writer.rb +6 -0
- data/vendored/puppet/lib/puppet/pops/serialization/extension.rb +1 -0
- data/vendored/puppet/lib/puppet/pops/serialization/serializer.rb +2 -1
- data/vendored/puppet/lib/puppet/pops/types/execution_result.rb +8 -0
- data/vendored/puppet/lib/puppet/pops/types/iterable.rb +2 -0
- data/vendored/puppet/lib/puppet/pops/types/p_object_type.rb +3 -0
- data/vendored/puppet/lib/puppet/pops/types/p_object_type_extension.rb +6 -0
- data/vendored/puppet/lib/puppet/pops/types/p_uri_type.rb +191 -0
- data/vendored/puppet/lib/puppet/pops/types/string_converter.rb +17 -0
- data/vendored/puppet/lib/puppet/pops/types/type_calculator.rb +5 -0
- data/vendored/puppet/lib/puppet/pops/types/type_factory.rb +7 -0
- data/vendored/puppet/lib/puppet/pops/types/type_formatter.rb +16 -18
- data/vendored/puppet/lib/puppet/pops/types/type_mismatch_describer.rb +15 -5
- data/vendored/puppet/lib/puppet/pops/types/type_parser.rb +6 -0
- data/vendored/puppet/lib/puppet/pops/types/type_with_members.rb +43 -0
- data/vendored/puppet/lib/puppet/pops/types/types.rb +3 -0
- data/vendored/puppet/lib/puppet/provider/package/gem.rb +1 -1
- data/vendored/puppet/lib/puppet/provider/package/nim.rb +7 -8
- data/vendored/puppet/lib/puppet/provider/package/opkg.rb +1 -1
- data/vendored/puppet/lib/puppet/provider/package/pkg.rb +6 -4
- data/vendored/puppet/lib/puppet/provider/package/pkgutil.rb +3 -3
- data/vendored/puppet/lib/puppet/provider/service/init.rb +1 -1
- data/vendored/puppet/lib/puppet/syntax_checkers/base64.rb +5 -6
- data/vendored/puppet/lib/puppet/transaction.rb +1 -1
- data/vendored/puppet/lib/puppet/type.rb +1 -9
- data/vendored/puppet/lib/puppet/type/schedule.rb +1 -1
- data/vendored/puppet/lib/puppet/util/log.rb +2 -3
- data/vendored/puppet/lib/puppet/util/plist.rb +1 -1
- data/vendored/puppet/lib/puppet/util/reference.rb +2 -3
- data/vendored/puppet/lib/puppet_pal.rb +326 -53
- metadata +28 -12
- data/lib/bolt/node/result.rb +0 -115
- data/vendored/puppet/lib/puppet/configurer/downloader_factory.rb +0 -44
data/lib/bolt/version.rb
CHANGED
@@ -5,8 +5,6 @@
|
|
5
5
|
# * A target is a String with a targets's hostname or a Target.
|
6
6
|
# * The returned value contains information about the result per target.
|
7
7
|
#
|
8
|
-
# Since > 5.4.0 TODO: Update when version is known
|
9
|
-
#
|
10
8
|
Puppet::Functions.create_function(:file_upload, Puppet::Functions::InternalFunction) do
|
11
9
|
local_types do
|
12
10
|
type 'TargetOrTargets = Variant[String[1], Target, Array[TargetOrTargets]]'
|
@@ -22,18 +20,22 @@ Puppet::Functions.create_function(:file_upload, Puppet::Functions::InternalFunct
|
|
22
20
|
def file_upload(scope, source, destination, *targets)
|
23
21
|
unless Puppet[:tasks]
|
24
22
|
raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
|
25
|
-
Puppet::Pops::Issues::TASK_OPERATION_NOT_SUPPORTED_WHEN_COMPILING,
|
26
|
-
|
23
|
+
Puppet::Pops::Issues::TASK_OPERATION_NOT_SUPPORTED_WHEN_COMPILING, operation: 'file_upload'
|
24
|
+
)
|
27
25
|
end
|
28
26
|
|
29
27
|
executor = Puppet.lookup(:bolt_executor) { nil }
|
30
28
|
unless executor && Puppet.features.bolt?
|
31
|
-
raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
|
29
|
+
raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
|
30
|
+
Puppet::Pops::Issues::TASK_MISSING_BOLT, action: _('do file uploads')
|
31
|
+
)
|
32
32
|
end
|
33
33
|
|
34
34
|
found = Puppet::Parser::Files.find_file(source, scope.compiler.environment)
|
35
35
|
unless found && Puppet::FileSystem.exist?(found)
|
36
|
-
raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
|
36
|
+
raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
|
37
|
+
Puppet::Pops::Issues::NO_SUCH_FILE_OR_DIRECTORY, file: source
|
38
|
+
)
|
37
39
|
end
|
38
40
|
|
39
41
|
# Ensure that that given targets are all Target instances
|
@@ -43,7 +45,7 @@ Puppet::Functions.create_function(:file_upload, Puppet::Functions::InternalFunct
|
|
43
45
|
Puppet::Pops::Types::ExecutionResult::EMPTY_RESULT
|
44
46
|
else
|
45
47
|
# Awaits change in the executor, enabling it receive Target instances
|
46
|
-
hosts = targets.map
|
48
|
+
hosts = targets.map(&:host)
|
47
49
|
|
48
50
|
Puppet::Pops::Types::ExecutionResult.from_bolt(
|
49
51
|
executor.file_upload(executor.from_uris(hosts), found, destination)
|
@@ -5,8 +5,6 @@
|
|
5
5
|
# * A target is a String with a targets's hostname or a Target.
|
6
6
|
# * The returned value contains information about the result per target.
|
7
7
|
#
|
8
|
-
# Since > 5.4.0 TODO: Update when version is known
|
9
|
-
#
|
10
8
|
Puppet::Functions.create_function(:run_command) do
|
11
9
|
local_types do
|
12
10
|
type 'TargetOrTargets = Variant[String[1], Target, Array[TargetOrTargets]]'
|
@@ -20,27 +18,28 @@ Puppet::Functions.create_function(:run_command) do
|
|
20
18
|
def run_command(command, *targets)
|
21
19
|
unless Puppet[:tasks]
|
22
20
|
raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
|
23
|
-
Puppet::Pops::Issues::TASK_OPERATION_NOT_SUPPORTED_WHEN_COMPILING,
|
24
|
-
|
21
|
+
Puppet::Pops::Issues::TASK_OPERATION_NOT_SUPPORTED_WHEN_COMPILING, operation: 'run_command'
|
22
|
+
)
|
25
23
|
end
|
26
24
|
|
27
25
|
executor = Puppet.lookup(:bolt_executor) { nil }
|
28
26
|
unless executor && Puppet.features.bolt?
|
29
|
-
raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
|
27
|
+
raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
|
28
|
+
Puppet::Pops::Issues::TASK_MISSING_BOLT, action: _('run a command')
|
29
|
+
)
|
30
30
|
end
|
31
31
|
|
32
32
|
# Ensure that that given targets are all Target instances
|
33
33
|
targets = targets.flatten.map { |t| t.is_a?(String) ? Puppet::Pops::Types::TypeFactory.target.create(t) : t }
|
34
|
+
|
34
35
|
if targets.empty?
|
35
36
|
call_function('debug', "Simulating run_command('#{command}') - no targets given - no action taken")
|
36
37
|
Puppet::Pops::Types::ExecutionResult::EMPTY_RESULT
|
37
38
|
else
|
38
39
|
# Awaits change in the executor, enabling it receive Target instances
|
39
|
-
hosts = targets.map
|
40
|
+
hosts = targets.map(&:host)
|
40
41
|
|
41
|
-
Puppet::Pops::Types::ExecutionResult.from_bolt(
|
42
|
-
executor.run_command(executor.from_uris(hosts), command)
|
43
|
-
)
|
42
|
+
Puppet::Pops::Types::ExecutionResult.from_bolt(executor.run_command(executor.from_uris(hosts), command))
|
44
43
|
end
|
45
44
|
end
|
46
45
|
end
|
@@ -1,15 +1,13 @@
|
|
1
|
-
# Runs the `plan` referenced by its name passing giving arguments to it given as a hash of name to value mappings
|
1
|
+
# Runs the `plan` referenced by its name passing giving arguments to it given as a hash of name to value mappings.
|
2
2
|
# A plan is autoloaded from under <root>/plans if not already defined.
|
3
3
|
#
|
4
4
|
# @example defining and running a plan
|
5
|
-
# plan myplan($x) {
|
5
|
+
# plan myplan($x) {
|
6
6
|
# # do things with tasks
|
7
7
|
# notice "plan done with param x = ${x}"
|
8
8
|
# }
|
9
9
|
# run_plan('myplan', {x => 'testing' }
|
10
10
|
#
|
11
|
-
# @since > 5.2 TODO: change this when known
|
12
|
-
#
|
13
11
|
Puppet::Functions.create_function(:run_plan, Puppet::Functions::InternalFunction) do
|
14
12
|
dispatch :run_plan do
|
15
13
|
scope_param
|
@@ -20,21 +18,19 @@ Puppet::Functions.create_function(:run_plan, Puppet::Functions::InternalFunction
|
|
20
18
|
def run_plan(scope, plan_name, named_args = {})
|
21
19
|
unless Puppet[:tasks]
|
22
20
|
raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
|
23
|
-
Puppet::Pops::Issues::TASK_OPERATION_NOT_SUPPORTED_WHEN_COMPILING,
|
24
|
-
|
21
|
+
Puppet::Pops::Issues::TASK_OPERATION_NOT_SUPPORTED_WHEN_COMPILING, operation: 'run_plan'
|
22
|
+
)
|
25
23
|
end
|
26
24
|
|
27
25
|
loaders = closure_scope.compiler.loaders
|
28
|
-
# The perspective of the environment is wanted here (for now) to not have to
|
29
|
-
# to have dependencies defined in meta data.
|
26
|
+
# The perspective of the environment is wanted here (for now) to not have to
|
27
|
+
# require modules to have dependencies defined in meta data.
|
30
28
|
loader = loaders.private_environment_loader
|
31
|
-
if loader && func = loader.load(:plan, plan_name)
|
29
|
+
if loader && (func = loader.load(:plan, plan_name))
|
32
30
|
# TODO: Add profiling around this
|
33
|
-
|
31
|
+
return func.class.dispatcher.dispatchers[0].call_by_name_with_scope(scope, named_args, true)
|
34
32
|
end
|
35
33
|
# Could not find plan
|
36
34
|
raise ArgumentError, "Function #{self.class.name}(): Unknown plan: '#{plan_name}'"
|
37
35
|
end
|
38
|
-
|
39
36
|
end
|
40
|
-
|
@@ -5,8 +5,6 @@
|
|
5
5
|
# * A target is a String with a targets's hostname or a Target.
|
6
6
|
# * The returned value contains information about the result per target.
|
7
7
|
#
|
8
|
-
# Since > 5.4.0 TODO: Update when version is known
|
9
|
-
#
|
10
8
|
Puppet::Functions.create_function(:run_script, Puppet::Functions::InternalFunction) do
|
11
9
|
local_types do
|
12
10
|
type 'TargetOrTargets = Variant[String[1], Target, Array[TargetOrTargets]]'
|
@@ -32,21 +30,27 @@ Puppet::Functions.create_function(:run_script, Puppet::Functions::InternalFuncti
|
|
32
30
|
def run_script_with_args(scope, script, targets, args_hash)
|
33
31
|
unless Puppet[:tasks]
|
34
32
|
raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
|
35
|
-
Puppet::Pops::Issues::TASK_OPERATION_NOT_SUPPORTED_WHEN_COMPILING,
|
36
|
-
|
33
|
+
Puppet::Pops::Issues::TASK_OPERATION_NOT_SUPPORTED_WHEN_COMPILING, operation: 'run_script'
|
34
|
+
)
|
37
35
|
end
|
38
36
|
|
39
37
|
executor = Puppet.lookup(:bolt_executor) { nil }
|
40
38
|
unless executor && Puppet.features.bolt?
|
41
|
-
raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
|
39
|
+
raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
|
40
|
+
Puppet::Pops::Issues::TASK_MISSING_BOLT, action: _('run a script')
|
41
|
+
)
|
42
42
|
end
|
43
43
|
|
44
44
|
found = Puppet::Parser::Files.find_file(script, scope.compiler.environment)
|
45
45
|
unless found && Puppet::FileSystem.exist?(found)
|
46
|
-
raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
|
46
|
+
raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
|
47
|
+
Puppet::Pops::Issues::NO_SUCH_FILE_OR_DIRECTORY, file: script
|
48
|
+
)
|
47
49
|
end
|
48
50
|
unless Puppet::FileSystem.file?(found)
|
49
|
-
raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
|
51
|
+
raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
|
52
|
+
Puppet::Pops::Issues::NOT_A_FILE, file: script
|
53
|
+
)
|
50
54
|
end
|
51
55
|
|
52
56
|
# Ensure that that given targets are all Target instances)
|
@@ -56,7 +60,7 @@ Puppet::Functions.create_function(:run_script, Puppet::Functions::InternalFuncti
|
|
56
60
|
Puppet::Pops::Types::ExecutionResult::EMPTY_RESULT
|
57
61
|
else
|
58
62
|
# Awaits change in the executor, enabling it receive Target instances
|
59
|
-
hosts = targets.map
|
63
|
+
hosts = targets.map(&:host)
|
60
64
|
|
61
65
|
Puppet::Pops::Types::ExecutionResult.from_bolt(
|
62
66
|
executor.run_script(executor.from_uris(hosts), found, args_hash['arguments'])
|
@@ -5,8 +5,6 @@
|
|
5
5
|
# * A target is a String with a targets's hostname or a Target.
|
6
6
|
# * The returned value contains information about the result per target.
|
7
7
|
#
|
8
|
-
# Since > 5.4.0 TODO: Update when version is known
|
9
|
-
#
|
10
8
|
Puppet::Functions.create_function(:run_task) do
|
11
9
|
local_types do
|
12
10
|
type 'TargetOrTargets = Variant[String[1], Target, Array[TargetOrTargets]]'
|
@@ -38,7 +36,9 @@ Puppet::Functions.create_function(:run_task) do
|
|
38
36
|
def run_named_task(task_name, targets, task_args = nil)
|
39
37
|
task_type = Puppet.lookup(:loaders).private_environment_loader.load(:type, task_name)
|
40
38
|
if task_type.nil?
|
41
|
-
raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
|
39
|
+
raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
|
40
|
+
Puppet::Pops::Issues::UNKNOWN_TASK, type_name: task_name
|
41
|
+
)
|
42
42
|
end
|
43
43
|
use_args = task_args.nil? ? {} : task_args
|
44
44
|
task_instance = call_function('new', task_type, use_args)
|
@@ -48,13 +48,15 @@ Puppet::Functions.create_function(:run_task) do
|
|
48
48
|
def run_task_instance(task, *targets)
|
49
49
|
unless Puppet[:tasks]
|
50
50
|
raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
|
51
|
-
Puppet::Pops::Issues::TASK_OPERATION_NOT_SUPPORTED_WHEN_COMPILING,
|
52
|
-
|
51
|
+
Puppet::Pops::Issues::TASK_OPERATION_NOT_SUPPORTED_WHEN_COMPILING, operation: 'run_task'
|
52
|
+
)
|
53
53
|
end
|
54
54
|
|
55
55
|
executor = Puppet.lookup(:bolt_executor) { nil }
|
56
56
|
unless executor && Puppet.features.bolt?
|
57
|
-
raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
|
57
|
+
raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
|
58
|
+
Puppet::Pops::Issues::TASK_MISSING_BOLT, action: _('run a task')
|
59
|
+
)
|
58
60
|
end
|
59
61
|
|
60
62
|
# Ensure that that given targets are all Target instances
|
@@ -64,16 +66,14 @@ Puppet::Functions.create_function(:run_task) do
|
|
64
66
|
Puppet::Pops::Types::ExecutionResult::EMPTY_RESULT
|
65
67
|
else
|
66
68
|
# Awaits change in the executor, enabling it receive Target instances
|
67
|
-
hosts = targets.map
|
69
|
+
hosts = targets.map(&:host)
|
68
70
|
|
69
71
|
# TODO: separate handling of default since it's platform specific
|
70
72
|
input_method = task._pcore_type['input_method'].value
|
71
73
|
|
72
74
|
arguments = task.task_args
|
73
75
|
Puppet::Pops::Types::ExecutionResult.from_bolt(
|
74
|
-
executor.run_task(
|
75
|
-
executor.from_uris(hosts), task.executable_path, input_method, arguments
|
76
|
-
)
|
76
|
+
executor.run_task(executor.from_uris(hosts), task.executable_path, input_method, arguments)
|
77
77
|
)
|
78
78
|
end
|
79
79
|
end
|
@@ -122,7 +122,7 @@ class Puppet::Agent
|
|
122
122
|
# to it during the yield.
|
123
123
|
def with_client(transaction_uuid, job_id = nil)
|
124
124
|
begin
|
125
|
-
@client = client_class.new(
|
125
|
+
@client = client_class.new(transaction_uuid, job_id)
|
126
126
|
rescue StandardError => detail
|
127
127
|
Puppet.log_exception(detail, _("Could not create instance of %{client_class}: %{detail}") % { client_class: client_class, detail: detail })
|
128
128
|
return
|
@@ -340,7 +340,6 @@ Copyright (c) 2015 Puppet Inc., LLC Licensed under the Apache 2.0 License
|
|
340
340
|
fact_file = options[:fact_file]
|
341
341
|
|
342
342
|
if fact_file
|
343
|
-
original_facts = node.parameters
|
344
343
|
if fact_file.end_with?("json")
|
345
344
|
given_facts = JSON.parse(Puppet::FileSystem.read(fact_file, :encoding => 'utf-8'))
|
346
345
|
else
|
@@ -350,8 +349,7 @@ Copyright (c) 2015 Puppet Inc., LLC Licensed under the Apache 2.0 License
|
|
350
349
|
unless given_facts.instance_of?(Hash)
|
351
350
|
raise _("Incorrect formatted data in %{fact_file} given via the --facts flag") % { fact_file: fact_file }
|
352
351
|
end
|
353
|
-
|
354
|
-
node.parameters = original_facts.merge(given_facts)
|
352
|
+
node.add_extra_facts(given_facts)
|
355
353
|
end
|
356
354
|
|
357
355
|
Puppet[:code] = 'undef' unless options[:compile]
|
@@ -8,7 +8,6 @@ require 'securerandom'
|
|
8
8
|
class Puppet::Configurer
|
9
9
|
require 'puppet/configurer/fact_handler'
|
10
10
|
require 'puppet/configurer/plugin_handler'
|
11
|
-
require 'puppet/configurer/downloader_factory'
|
12
11
|
|
13
12
|
include Puppet::Configurer::FactHandler
|
14
13
|
|
@@ -56,7 +55,7 @@ class Puppet::Configurer
|
|
56
55
|
end
|
57
56
|
end
|
58
57
|
|
59
|
-
def initialize(
|
58
|
+
def initialize(transaction_uuid = nil, job_id = nil)
|
60
59
|
@running = false
|
61
60
|
@splayed = false
|
62
61
|
@cached_catalog_status = 'not_used'
|
@@ -65,7 +64,7 @@ class Puppet::Configurer
|
|
65
64
|
@job_id = job_id
|
66
65
|
@static_catalog = true
|
67
66
|
@checksum_type = Puppet[:supported_checksum_types]
|
68
|
-
@handler = Puppet::Configurer::PluginHandler.new(
|
67
|
+
@handler = Puppet::Configurer::PluginHandler.new()
|
69
68
|
end
|
70
69
|
|
71
70
|
# Get the remote catalog, yo. Returns nil if no catalog can be found.
|
@@ -4,15 +4,33 @@
|
|
4
4
|
require 'puppet/configurer'
|
5
5
|
|
6
6
|
class Puppet::Configurer::PluginHandler
|
7
|
-
def initialize(factory)
|
8
|
-
@factory = factory
|
9
|
-
end
|
10
|
-
|
11
7
|
# Retrieve facts from the central server.
|
12
8
|
def download_plugins(environment)
|
13
|
-
|
14
|
-
|
15
|
-
|
9
|
+
source_permissions = Puppet.features.microsoft_windows? ? :ignore : :use
|
10
|
+
|
11
|
+
plugin_downloader = Puppet::Configurer::Downloader.new(
|
12
|
+
"plugin",
|
13
|
+
Puppet[:plugindest],
|
14
|
+
Puppet[:pluginsource],
|
15
|
+
Puppet[:pluginsignore],
|
16
|
+
environment
|
17
|
+
)
|
18
|
+
plugin_fact_downloader = Puppet::Configurer::Downloader.new(
|
19
|
+
"pluginfacts",
|
20
|
+
Puppet[:pluginfactdest],
|
21
|
+
Puppet[:pluginfactsource],
|
22
|
+
Puppet[:pluginsignore],
|
23
|
+
environment,
|
24
|
+
source_permissions
|
25
|
+
)
|
26
|
+
locales_downloader = Puppet::Configurer::Downloader.new(
|
27
|
+
"locales",
|
28
|
+
Puppet[:localedest],
|
29
|
+
Puppet[:localesource],
|
30
|
+
Puppet[:localeignore],
|
31
|
+
environment
|
32
|
+
)
|
33
|
+
|
16
34
|
result = []
|
17
35
|
result += plugin_fact_downloader.evaluate
|
18
36
|
result += plugin_downloader.evaluate
|
@@ -166,6 +166,13 @@ module Puppet
|
|
166
166
|
:type => :boolean,
|
167
167
|
:desc => "Whether to enable experimental performance profiling",
|
168
168
|
},
|
169
|
+
:future_features => {
|
170
|
+
:default => false,
|
171
|
+
:type => :boolean,
|
172
|
+
:desc => "Whether or not to enable all features currently being developed for future
|
173
|
+
major releases of Puppet. Should be used with caution, as in development
|
174
|
+
features are experimental and can have unexpected effects."
|
175
|
+
},
|
169
176
|
:static_catalogs => {
|
170
177
|
:default => true,
|
171
178
|
:type => :boolean,
|
@@ -294,7 +301,8 @@ module Puppet
|
|
294
301
|
:desc => "The environment Puppet is running in. For clients
|
295
302
|
(e.g., `puppet agent`) this determines the environment itself, which
|
296
303
|
is used to find modules and much more. For servers (i.e., `puppet master`)
|
297
|
-
this provides the default environment for nodes we know nothing about."
|
304
|
+
this provides the default environment for nodes we know nothing about.",
|
305
|
+
:short => "E"
|
298
306
|
},
|
299
307
|
:environmentpath => {
|
300
308
|
:default => "$codedir/environments",
|
@@ -92,7 +92,8 @@ Puppet::Face.define(:epp, '0.0.1') do
|
|
92
92
|
end
|
93
93
|
end
|
94
94
|
if !missing_files.empty?
|
95
|
-
raise Puppet::Error, _("One or more file(s) specified did not exist:\n
|
95
|
+
raise Puppet::Error, _("One or more file(s) specified did not exist:\n%{missing_files_list}") %
|
96
|
+
{ missing_files_list: missing_files.map { |f| " #{f}" }.join("\n") }
|
96
97
|
else
|
97
98
|
# Exit with 1 if there were errors
|
98
99
|
raise Puppet::Error, _("Errors while validating epp") unless status
|
@@ -180,7 +181,8 @@ Puppet::Face.define(:epp, '0.0.1') do
|
|
180
181
|
end
|
181
182
|
|
182
183
|
if !missing_files.empty?
|
183
|
-
raise Puppet::Error, _("One or more file(s) specified did not exist:\n
|
184
|
+
raise Puppet::Error, _("One or more file(s) specified did not exist:\n%{missing_files_list}") %
|
185
|
+
{ missing_files_list: missing_files.collect { |f| " #{f}" }.join("\n") }
|
184
186
|
end
|
185
187
|
end
|
186
188
|
buffer.string
|
@@ -57,7 +57,7 @@ Puppet::Face.define(:module, '1.0.0') do
|
|
57
57
|
|
58
58
|
when_rendering :console do |return_value|
|
59
59
|
# Get the string representation of the Pathname object.
|
60
|
-
_("Module built: ")
|
60
|
+
_("Module built: %{path}") % { path: return_value.expand_path.to_s }
|
61
61
|
end
|
62
62
|
end
|
63
63
|
end
|
@@ -109,20 +109,10 @@ Puppet::Face.define(:module, '1.0.0') do
|
|
109
109
|
end
|
110
110
|
|
111
111
|
def warn_unmet_dependencies(environment)
|
112
|
-
error_types =
|
113
|
-
:non_semantic_version => {
|
114
|
-
:title => _("Non semantic version dependency")
|
115
|
-
},
|
116
|
-
:missing => {
|
117
|
-
:title => _("Missing dependency")
|
118
|
-
},
|
119
|
-
:version_mismatch => {
|
120
|
-
:title => _("Module '%s' (v%s) fails to meet some dependencies:")
|
121
|
-
}
|
122
|
-
}
|
112
|
+
error_types = [:non_semantic_version, :version_mismatch, :missing]
|
123
113
|
|
124
114
|
@unmet_deps = {}
|
125
|
-
error_types.
|
115
|
+
error_types.each do |type|
|
126
116
|
@unmet_deps[type] = Hash.new do |hash, key|
|
127
117
|
hash[key] = { :errors => [], :parent => nil }
|
128
118
|
end
|
@@ -162,17 +152,16 @@ Puppet::Face.define(:module, '1.0.0') do
|
|
162
152
|
unless @unmet_deps[type].empty?
|
163
153
|
@unmet_deps[type].keys.sort_by {|dep| dep }.each do |dep|
|
164
154
|
name = dep.gsub('/', '-')
|
165
|
-
title = error_types[type][:title]
|
166
155
|
errors = @unmet_deps[type][dep][:errors]
|
167
156
|
version = @unmet_deps[type][dep][:version]
|
168
157
|
|
169
158
|
msg = case type
|
170
159
|
when :version_mismatch
|
171
|
-
|
160
|
+
_("Module '%{name}' (v%{version}) fails to meet some dependencies:\n") % { name: name, version: version }
|
172
161
|
when :non_semantic_version
|
173
|
-
|
162
|
+
_("Non semantic version dependency %{name} (v%{version}):\n") % { name: name, version: version }
|
174
163
|
else
|
175
|
-
|
164
|
+
_("Missing dependency '%{name}':\n") % { name: name }
|
176
165
|
end
|
177
166
|
|
178
167
|
errors.each { |error_string| msg << " #{error_string}\n" }
|