puppet 4.7.1 → 4.8.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puppet might be problematic. Click here for more details.
- data/Gemfile +0 -3
- data/MAINTAINERS +76 -0
- data/README.md +0 -6
- data/Rakefile +2 -2
- data/lib/puppet/agent.rb +3 -3
- data/lib/puppet/application/apply.rb +1 -1
- data/lib/puppet/configurer.rb +2 -2
- data/lib/puppet/data_providers.rb +1 -0
- data/lib/puppet/data_providers/data_adapter.rb +1 -0
- data/lib/puppet/data_providers/data_function_support.rb +1 -0
- data/lib/puppet/data_providers/function_env_data_provider.rb +1 -0
- data/lib/puppet/data_providers/function_module_data_provider.rb +1 -0
- data/lib/puppet/data_providers/hiera_config.rb +1 -0
- data/lib/puppet/data_providers/hiera_env_data_provider.rb +1 -0
- data/lib/puppet/data_providers/hiera_interpolate.rb +1 -0
- data/lib/puppet/data_providers/hiera_module_data_provider.rb +1 -0
- data/lib/puppet/data_providers/hiera_support.rb +1 -2
- data/lib/puppet/data_providers/json_data_provider_factory.rb +2 -0
- data/lib/puppet/data_providers/yaml_data_provider_factory.rb +2 -0
- data/lib/puppet/defaults.rb +20 -1
- data/lib/puppet/environments.rb +5 -2
- data/lib/puppet/face/catalog.rb +1 -1
- data/lib/puppet/face/epp.rb +57 -11
- data/lib/puppet/face/module/install.rb +6 -6
- data/lib/puppet/functions.rb +23 -24
- data/lib/puppet/functions/alert.rb +14 -0
- data/lib/puppet/functions/binary_file.rb +25 -0
- data/lib/puppet/functions/break.rb +22 -0
- data/lib/puppet/functions/contain.rb +33 -0
- data/lib/puppet/functions/crit.rb +14 -0
- data/lib/puppet/functions/debug.rb +14 -0
- data/lib/puppet/functions/emerg.rb +14 -0
- data/lib/puppet/functions/epp.rb +1 -1
- data/lib/puppet/functions/err.rb +14 -0
- data/lib/puppet/functions/find_file.rb +31 -0
- data/lib/puppet/functions/include.rb +21 -0
- data/lib/puppet/functions/info.rb +14 -0
- data/lib/puppet/functions/new.rb +1 -1
- data/lib/puppet/functions/next.rb +23 -0
- data/lib/puppet/functions/notice.rb +14 -0
- data/lib/puppet/functions/regsubst.rb +12 -16
- data/lib/puppet/functions/require.rb +37 -0
- data/lib/puppet/functions/return.rb +22 -0
- data/lib/puppet/functions/strftime.rb +35 -0
- data/lib/puppet/functions/warning.rb +14 -0
- data/lib/puppet/generate/models/type/type.rb +4 -0
- data/lib/puppet/generate/templates/type/pcore.erb +2 -1
- data/lib/puppet/indirector/face.rb +6 -1
- data/lib/puppet/network/http/error.rb +2 -2
- data/lib/puppet/network/http/handler.rb +2 -2
- data/lib/puppet/node/environment.rb +11 -0
- data/lib/puppet/parser/ast.rb +5 -0
- data/lib/puppet/parser/ast/pops_bridge.rb +17 -4
- data/lib/puppet/parser/compiler.rb +29 -1
- data/lib/puppet/parser/functions.rb +6 -0
- data/lib/puppet/parser/functions/assert_type.rb +1 -1
- data/lib/puppet/parser/functions/binary_file.rb +24 -0
- data/lib/puppet/parser/functions/break.rb +39 -0
- data/lib/puppet/parser/functions/contain.rb +7 -15
- data/lib/puppet/parser/functions/defined.rb +2 -2
- data/lib/puppet/parser/functions/dig.rb +1 -1
- data/lib/puppet/parser/functions/each.rb +1 -1
- data/lib/puppet/parser/functions/epp.rb +2 -2
- data/lib/puppet/parser/functions/filter.rb +1 -1
- data/lib/puppet/parser/functions/find_file.rb +28 -0
- data/lib/puppet/parser/functions/hiera.rb +4 -4
- data/lib/puppet/parser/functions/hiera_array.rb +1 -1
- data/lib/puppet/parser/functions/hiera_hash.rb +1 -1
- data/lib/puppet/parser/functions/hiera_include.rb +1 -1
- data/lib/puppet/parser/functions/include.rb +4 -8
- data/lib/puppet/parser/functions/inline_epp.rb +1 -1
- data/lib/puppet/parser/functions/lest.rb +1 -1
- data/lib/puppet/parser/functions/lookup.rb +4 -2
- data/lib/puppet/parser/functions/map.rb +1 -1
- data/lib/puppet/parser/functions/match.rb +1 -1
- data/lib/puppet/parser/functions/new.rb +414 -18
- data/lib/puppet/parser/functions/next.rb +38 -0
- data/lib/puppet/parser/functions/reduce.rb +1 -1
- data/lib/puppet/parser/functions/regsubst.rb +4 -2
- data/lib/puppet/parser/functions/require.rb +4 -27
- data/lib/puppet/parser/functions/return.rb +71 -0
- data/lib/puppet/parser/functions/reverse_each.rb +1 -1
- data/lib/puppet/parser/functions/scanf.rb +13 -8
- data/lib/puppet/parser/functions/slice.rb +1 -1
- data/lib/puppet/parser/functions/split.rb +1 -1
- data/lib/puppet/parser/functions/step.rb +1 -1
- data/lib/puppet/parser/functions/strftime.rb +185 -0
- data/lib/puppet/parser/functions/then.rb +1 -1
- data/lib/puppet/parser/functions/type.rb +1 -1
- data/lib/puppet/parser/functions/with.rb +3 -3
- data/lib/puppet/parser/resource.rb +8 -5
- data/lib/puppet/parser/scope.rb +1 -1
- data/lib/puppet/plugins/configuration.rb +8 -0
- data/lib/puppet/plugins/data_providers.rb +1 -0
- data/lib/puppet/plugins/data_providers/data_provider.rb +7 -28
- data/lib/puppet/plugins/data_providers/registry.rb +1 -0
- data/lib/puppet/pops.rb +4 -0
- data/lib/puppet/pops/evaluator/access_operator.rb +36 -5
- data/lib/puppet/pops/evaluator/closure.rb +81 -12
- data/lib/puppet/pops/evaluator/compare_operator.rb +24 -1
- data/lib/puppet/pops/evaluator/evaluator_impl.rb +29 -5
- data/lib/puppet/pops/evaluator/json_strict_literal_evaluator.rb +1 -1
- data/lib/puppet/pops/evaluator/runtime3_converter.rb +53 -62
- data/lib/puppet/pops/evaluator/runtime3_support.rb +15 -6
- data/lib/puppet/pops/functions/dispatch.rb +9 -2
- data/lib/puppet/pops/functions/dispatcher.rb +3 -1
- data/lib/puppet/pops/functions/function.rb +19 -2
- data/lib/puppet/pops/issues.rb +9 -0
- data/lib/puppet/pops/label_provider.rb +2 -2
- data/lib/puppet/pops/loader/loader.rb +17 -0
- data/lib/puppet/pops/loader/static_loader.rb +0 -41
- data/lib/puppet/pops/lookup.rb +12 -0
- data/lib/puppet/pops/lookup/context.rb +86 -0
- data/lib/puppet/pops/lookup/explainer.rb +46 -6
- data/lib/puppet/pops/lookup/invocation.rb +19 -0
- data/lib/puppet/pops/lookup/sub_lookup.rb +1 -1
- data/lib/puppet/pops/model/factory.rb +20 -8
- data/lib/puppet/pops/model/model_label_provider.rb +3 -0
- data/lib/puppet/pops/model/model_meta.rb +2 -0
- data/lib/puppet/pops/model/model_tree_dumper.rb +14 -0
- data/lib/puppet/pops/parser/egrammar.ra +11 -6
- data/lib/puppet/pops/parser/eparser.rb +1112 -1086
- data/lib/puppet/pops/parser/heredoc_support.rb +1 -2
- data/lib/puppet/pops/pcore.rb +1 -0
- data/lib/puppet/pops/puppet_stack.rb +3 -3
- data/lib/puppet/pops/resource/param.rb +5 -1
- data/lib/puppet/pops/resource/resource_type_impl.rb +8 -4
- data/lib/puppet/pops/resource/resource_type_set.pcore +1 -0
- data/lib/puppet/pops/serialization/abstract_reader.rb +19 -2
- data/lib/puppet/pops/serialization/abstract_writer.rb +16 -3
- data/lib/puppet/pops/serialization/deserializer.rb +5 -1
- data/lib/puppet/pops/serialization/extension.rb +2 -0
- data/lib/puppet/pops/serialization/json.rb +76 -26
- data/lib/puppet/pops/serialization/serializer.rb +5 -1
- data/lib/puppet/pops/serialization/time_factory.rb +2 -1
- data/lib/puppet/pops/time/timespan.rb +718 -0
- data/lib/puppet/pops/time/timestamp.rb +148 -0
- data/lib/puppet/pops/types/p_binary_type.rb +220 -0
- data/lib/puppet/pops/types/p_object_type.rb +12 -6
- data/lib/puppet/pops/types/p_sensitive_type.rb +5 -1
- data/lib/puppet/pops/types/p_timespan_type.rb +141 -0
- data/lib/puppet/pops/types/p_timestamp_type.rb +69 -0
- data/lib/puppet/pops/types/string_converter.rb +62 -0
- data/lib/puppet/pops/types/type_asserter.rb +1 -1
- data/lib/puppet/pops/types/type_calculator.rb +17 -3
- data/lib/puppet/pops/types/type_factory.rb +35 -1
- data/lib/puppet/pops/types/type_formatter.rb +64 -11
- data/lib/puppet/pops/types/type_mismatch_describer.rb +110 -61
- data/lib/puppet/pops/types/type_parser.rb +18 -4
- data/lib/puppet/pops/types/types.rb +98 -63
- data/lib/puppet/pops/validation.rb +9 -1
- data/lib/puppet/pops/validation/checker4_0.rb +7 -0
- data/lib/puppet/property.rb +1 -1
- data/lib/puppet/provider.rb +3 -6
- data/lib/puppet/provider/mcx/mcxcontent.rb +1 -1
- data/lib/puppet/provider/mount/parsed.rb +18 -4
- data/lib/puppet/provider/nameservice/directoryservice.rb +15 -7
- data/lib/puppet/provider/package/gem.rb +6 -1
- data/lib/puppet/provider/package/pip.rb +0 -1
- data/lib/puppet/provider/package/pkg.rb +5 -1
- data/lib/puppet/provider/package/pkgng.rb +1 -1
- data/lib/puppet/provider/package/yum.rb +10 -0
- data/lib/puppet/provider/service/launchd.rb +1 -0
- data/lib/puppet/provider/user/directoryservice.rb +6 -6
- data/lib/puppet/provider/yumrepo/inifile.rb +1 -1
- data/lib/puppet/provider/zpool/zpool.rb +1 -1
- data/lib/puppet/resource.rb +54 -12
- data/lib/puppet/resource/capability_finder.rb +15 -9
- data/lib/puppet/resource/catalog.rb +25 -6
- data/lib/puppet/resource/type.rb +3 -1
- data/lib/puppet/settings.rb +1 -1
- data/lib/puppet/settings/environment_conf.rb +12 -4
- data/lib/puppet/syntax_checkers/base64.rb +41 -0
- data/lib/puppet/syntax_checkers/json.rb +0 -2
- data/lib/puppet/transaction.rb +6 -0
- data/lib/puppet/transaction/additional_resource_generator.rb +5 -0
- data/lib/puppet/transaction/report.rb +7 -2
- data/lib/puppet/type.rb +2 -1
- data/lib/puppet/type/file/checksum.rb +1 -0
- data/lib/puppet/type/file/content.rb +4 -4
- data/lib/puppet/type/mount.rb +44 -0
- data/lib/puppet/type/ssh_authorized_key.rb +1 -1
- data/lib/puppet/type/tidy.rb +3 -0
- data/lib/puppet/type/user.rb +12 -6
- data/lib/puppet/util/log.rb +25 -0
- data/lib/puppet/util/plist.rb +8 -3
- data/lib/puppet/version.rb +1 -1
- data/lib/puppet_x.rb +7 -1
- data/spec/integration/application/apply_spec.rb +118 -0
- data/spec/integration/parser/compiler_spec.rb +28 -0
- data/spec/integration/parser/pcore_resource_spec.rb +40 -3
- data/spec/integration/provider/mount_spec.rb +2 -1
- data/spec/integration/util/windows/principal_spec.rb +2 -2
- data/spec/integration/util/windows/registry_spec.rb +4 -4
- data/spec/lib/puppet_spec/compiler.rb +5 -1
- data/spec/lib/puppet_spec/unindent.rb +5 -0
- data/spec/shared_contexts/types_setup.rb +6 -0
- data/spec/shared_examples/rhel_package_provider.rb +16 -0
- data/spec/spec_helper.rb +1 -0
- data/spec/unit/agent_spec.rb +11 -0
- data/spec/unit/application/lookup_spec.rb +94 -3
- data/spec/unit/capability_spec.rb +22 -0
- data/spec/unit/configurer_spec.rb +8 -0
- data/spec/unit/face/epp_face_spec.rb +22 -3
- data/spec/unit/functions/assert_type_spec.rb +3 -3
- data/spec/unit/functions/binary_file_spec.rb +46 -0
- data/spec/unit/functions/break_spec.rb +89 -0
- data/spec/unit/{parser/functions → functions}/contain_spec.rb +68 -3
- data/spec/unit/functions/find_file_spec.rb +69 -0
- data/spec/unit/functions/include_spec.rb +175 -0
- data/spec/unit/functions/logging_spec.rb +54 -0
- data/spec/unit/functions/lookup_spec.rb +3 -3
- data/spec/unit/functions/new_spec.rb +105 -5
- data/spec/unit/functions/next_spec.rb +93 -0
- data/spec/unit/functions/require_spec.rb +83 -0
- data/spec/unit/functions/return_spec.rb +105 -0
- data/spec/unit/{parser/functions → functions}/shared.rb +14 -11
- data/spec/unit/functions/strftime_spec.rb +152 -0
- data/spec/unit/functions4_spec.rb +22 -0
- data/spec/unit/indirector/face_spec.rb +10 -2
- data/spec/unit/network/http/error_spec.rb +1 -2
- data/spec/unit/network/http/handler_spec.rb +6 -5
- data/spec/unit/parser/functions/hiera_array_spec.rb +1 -1
- data/spec/unit/parser/functions/hiera_hash_spec.rb +1 -1
- data/spec/unit/parser/functions/hiera_include_spec.rb +1 -1
- data/spec/unit/parser/functions/hiera_spec.rb +1 -1
- data/spec/unit/parser/functions/lookup_spec.rb +1 -1
- data/spec/unit/parser/functions/regsubst_spec.rb +1 -1
- data/spec/unit/parser/functions/split_spec.rb +1 -1
- data/spec/unit/pops/evaluator/access_ops_spec.rb +81 -1
- data/spec/unit/pops/evaluator/arithmetic_ops_spec.rb +170 -0
- data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +29 -4
- data/spec/unit/pops/evaluator/runtime3_converter_spec.rb +112 -4
- data/spec/unit/pops/loaders/dependency_loader_spec.rb +12 -0
- data/spec/unit/pops/loaders/static_loader_spec.rb +0 -26
- data/spec/unit/pops/lookup/context_spec.rb +149 -0
- data/spec/unit/pops/parser/parse_functions_spec.rb +19 -0
- data/spec/unit/pops/parser/parse_lambda_spec.rb +19 -0
- data/spec/unit/pops/puppet_stack_spec.rb +1 -1
- data/spec/unit/pops/resource/resource_type_impl_spec.rb +74 -0
- data/spec/unit/pops/serialization/packer_spec.rb +34 -14
- data/spec/unit/pops/serialization/serialization_spec.rb +67 -5
- data/spec/unit/pops/time/timespan_spec.rb +121 -0
- data/spec/unit/pops/types/p_binary_type_spec.rb +243 -0
- data/spec/unit/pops/types/p_object_type_spec.rb +7 -7
- data/spec/unit/pops/types/p_sensitive_type_spec.rb +1 -1
- data/spec/unit/pops/types/p_timespan_type_spec.rb +273 -0
- data/spec/unit/pops/types/p_timestamp_type_spec.rb +311 -0
- data/spec/unit/pops/types/p_type_set_type_spec.rb +13 -13
- data/spec/unit/pops/types/ruby_generator_spec.rb +12 -12
- data/spec/unit/pops/types/string_converter_spec.rb +89 -0
- data/spec/unit/pops/types/type_asserter_spec.rb +3 -3
- data/spec/unit/pops/types/type_calculator_spec.rb +113 -5
- data/spec/unit/pops/types/type_formatter_spec.rb +40 -0
- data/spec/unit/pops/types/type_mismatch_describer_spec.rb +49 -38
- data/spec/unit/pops/types/type_parser_spec.rb +87 -4
- data/spec/unit/pops/types/types_spec.rb +1 -1
- data/spec/unit/pops/validator/validator_spec.rb +23 -0
- data/spec/unit/provider/mount/parsed_spec.rb +47 -29
- data/spec/unit/provider/package/pkg_spec.rb +109 -99
- data/spec/unit/provider/ssh_authorized_key/parsed_spec.rb +1 -0
- data/spec/unit/provider/user/aix_spec.rb +1 -1
- data/spec/unit/provider/user/directoryservice_spec.rb +101 -30
- data/spec/unit/resource/capability_finder_spec.rb +29 -7
- data/spec/unit/resource/catalog_spec.rb +127 -0
- data/spec/unit/ssl/certificate_request_spec.rb +1 -1
- data/spec/unit/transaction/additional_resource_generator_spec.rb +30 -0
- data/spec/unit/transaction/persistence_spec.rb +1 -6
- data/spec/unit/transaction/report_spec.rb +23 -0
- data/spec/unit/transaction_spec.rb +38 -0
- data/spec/unit/type/mount_spec.rb +5 -0
- data/spec/unit/util/plist_spec.rb +14 -2
- metadata +71 -12
- data/spec/integration/parser/functions/require_spec.rb +0 -43
- data/spec/unit/parser/functions/include_spec.rb +0 -55
- data/spec/unit/parser/functions/require_spec.rb +0 -68
data/Gemfile
CHANGED
@@ -53,9 +53,6 @@ group(:development, :test) do
|
|
53
53
|
|
54
54
|
gem 'rdoc', "~> 4.1", :platforms => [:ruby]
|
55
55
|
|
56
|
-
# webmock requires addressable as as of 2.5.0 addressable started
|
57
|
-
# requiring the public_suffix gem which requires Ruby 2
|
58
|
-
gem 'addressable', '< 2.5.0'
|
59
56
|
gem 'webmock', '~> 1.24'
|
60
57
|
gem 'vcr', '~> 2.9'
|
61
58
|
end
|
data/MAINTAINERS
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
{
|
2
|
+
"version": 1,
|
3
|
+
"file_format": "This MAINTAINERS file format is described at https://github.com/puppetlabs/maintainers",
|
4
|
+
"issues": "https://tickets.puppet.com/browse/PUP",
|
5
|
+
"internal_list": "https://groups.google.com/a/puppet.com/forum/?hl=en#!forum/discuss-puppet-maintainers",
|
6
|
+
"people": [
|
7
|
+
{
|
8
|
+
"github": "hlindberg",
|
9
|
+
"email": "henrik.lindberg@puppet.com",
|
10
|
+
"name": "Henrik Lindberg"
|
11
|
+
},
|
12
|
+
{
|
13
|
+
"github": "kylog",
|
14
|
+
"email": "kylo@puppet.com",
|
15
|
+
"name": "Kylo Ginsberg"
|
16
|
+
},
|
17
|
+
{
|
18
|
+
"github": "joshcooper",
|
19
|
+
"email": "josh@puppet.com",
|
20
|
+
"name": "Josh Cooper"
|
21
|
+
},
|
22
|
+
{
|
23
|
+
"github": "MikaelSmith",
|
24
|
+
"email": "michael.smith@puppet.com",
|
25
|
+
"name": "Michael Smith"
|
26
|
+
},
|
27
|
+
{
|
28
|
+
"github": "thallgren",
|
29
|
+
"email": "thomas.hallgren@puppet.com",
|
30
|
+
"name": "Thomas Hallgren"
|
31
|
+
},
|
32
|
+
{
|
33
|
+
"github": "branan",
|
34
|
+
"email": "branan@puppet.com",
|
35
|
+
"name": "Branan Riley"
|
36
|
+
},
|
37
|
+
{
|
38
|
+
"github": "whopper",
|
39
|
+
"email": "whopper@puppet.com",
|
40
|
+
"name": "Will Hopper"
|
41
|
+
},
|
42
|
+
{
|
43
|
+
"github": "Iristyle",
|
44
|
+
"name": "Ethan J. Brown"
|
45
|
+
},
|
46
|
+
{
|
47
|
+
"github": "HAIL9000",
|
48
|
+
"email": "hailee@puppet.com",
|
49
|
+
"name": "Hailee Kenney"
|
50
|
+
},
|
51
|
+
{
|
52
|
+
"github": "er0ck",
|
53
|
+
"email": "eric.thompson@puppet.com",
|
54
|
+
"name": "Eric Thompson"
|
55
|
+
},
|
56
|
+
{
|
57
|
+
"github": "johnduarte",
|
58
|
+
"email": "john.duarte@puppet.com",
|
59
|
+
"name": "John Duarte"
|
60
|
+
},
|
61
|
+
{
|
62
|
+
"github": "adrienthebo",
|
63
|
+
"name": "Adrien Thebo"
|
64
|
+
},
|
65
|
+
{
|
66
|
+
"github": "jtappa",
|
67
|
+
"email": "jorie@puppet.com",
|
68
|
+
"name": "Jorie Tappa"
|
69
|
+
},
|
70
|
+
{
|
71
|
+
"github": "MosesMendoza",
|
72
|
+
"email": "moses@puppet.com",
|
73
|
+
"name": "Moses Mendoza"
|
74
|
+
}
|
75
|
+
]
|
76
|
+
}
|
data/README.md
CHANGED
@@ -72,9 +72,3 @@ Long-term support, including security patches and bug fixes, is available for
|
|
72
72
|
commercial customers. Please see the following page for more details:
|
73
73
|
|
74
74
|
[Puppet Enterprise Support Lifecycle](https://puppetlabs.com/misc/puppet-enterprise-lifecycle)
|
75
|
-
|
76
|
-
Maintainers
|
77
|
-
-------
|
78
|
-
|
79
|
-
* Kylo Ginsberg, kylo@puppet.com, github:kylog, jira:kylo
|
80
|
-
* Henrik Lindberg, henrik.lindberg@puppet.com, github:hlindberg, jira:henrik.lindberg
|
data/Rakefile
CHANGED
@@ -83,8 +83,8 @@ task(:commits) do
|
|
83
83
|
# populated with the range of commits the PR contains. If not available, this
|
84
84
|
# falls back to `master..HEAD` as a next best bet as `master` is unlikely to
|
85
85
|
# ever be absent.
|
86
|
-
commit_range = ENV['TRAVIS_COMMIT_RANGE'].nil? ? 'master..HEAD' : ENV['TRAVIS_COMMIT_RANGE']
|
87
|
-
puts "Checking commits
|
86
|
+
commit_range = ENV['TRAVIS_COMMIT_RANGE'].nil? ? 'master..HEAD' : ENV['TRAVIS_COMMIT_RANGE']
|
87
|
+
puts "Checking commits..."
|
88
88
|
%x{git log --no-merges --pretty=%s #{commit_range}}.each_line do |commit_summary|
|
89
89
|
# This regex tests for the currently supported commit summary tokens: maint, doc, packaging, or pup-<number>.
|
90
90
|
# The exception tries to explain it in more full.
|
data/lib/puppet/agent.rb
CHANGED
@@ -39,7 +39,7 @@ class Puppet::Agent
|
|
39
39
|
block_run = Puppet::Application.controlled_run do
|
40
40
|
splay client_options.fetch :splay, Puppet[:splay]
|
41
41
|
result = run_in_fork(should_fork) do
|
42
|
-
with_client do |client|
|
42
|
+
with_client(client_options[:transaction_uuid]) do |client|
|
43
43
|
begin
|
44
44
|
client_args = client_options.merge(:pluginsync => Puppet::Configurer.should_pluginsync?)
|
45
45
|
lock { client.run(client_args) }
|
@@ -88,9 +88,9 @@ class Puppet::Agent
|
|
88
88
|
|
89
89
|
# Create and yield a client instance, keeping a reference
|
90
90
|
# to it during the yield.
|
91
|
-
def with_client
|
91
|
+
def with_client(transaction_uuid)
|
92
92
|
begin
|
93
|
-
@client = client_class.new
|
93
|
+
@client = client_class.new(Puppet::Configurer::DownloaderFactory.new, transaction_uuid)
|
94
94
|
rescue StandardError => detail
|
95
95
|
Puppet.log_exception(detail, "Could not create instance of #{client_class}: #{detail}")
|
96
96
|
return
|
@@ -328,7 +328,7 @@ Copyright (c) 2011 Puppet Labs, LLC Licensed under the Apache 2.0 License
|
|
328
328
|
set_log_level
|
329
329
|
|
330
330
|
if Puppet[:profile]
|
331
|
-
@profiler = Puppet::Util::Profiler.add_profiler(Puppet::Util::Profiler::Aggregate.new(Puppet.method(:
|
331
|
+
@profiler = Puppet::Util::Profiler.add_profiler(Puppet::Util::Profiler::Aggregate.new(Puppet.method(:info), "apply"))
|
332
332
|
end
|
333
333
|
end
|
334
334
|
|
data/lib/puppet/configurer.rb
CHANGED
@@ -56,12 +56,12 @@ class Puppet::Configurer
|
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
|
-
def initialize(factory = Puppet::Configurer::DownloaderFactory.new)
|
59
|
+
def initialize(factory = Puppet::Configurer::DownloaderFactory.new, transaction_uuid = nil)
|
60
60
|
@running = false
|
61
61
|
@splayed = false
|
62
62
|
@cached_catalog_status = 'not_used'
|
63
63
|
@environment = Puppet[:environment]
|
64
|
-
@transaction_uuid = SecureRandom.uuid
|
64
|
+
@transaction_uuid = transaction_uuid || SecureRandom.uuid
|
65
65
|
@static_catalog = true
|
66
66
|
@checksum_type = Puppet[:supported_checksum_types]
|
67
67
|
@handler = Puppet::Configurer::PluginHandler.new(factory)
|
@@ -8,6 +8,7 @@ module Puppet::DataProviders; end
|
|
8
8
|
# The function is called on demand, and is associated with the compiler via an Adapter. This ensures that the data
|
9
9
|
# is only produced once per compilation.
|
10
10
|
#
|
11
|
+
# @api private
|
11
12
|
class Puppet::DataProviders::FunctionEnvDataProvider < Puppet::Plugins::DataProviders::EnvironmentDataProvider
|
12
13
|
include Puppet::DataProviders::DataFunctionSupport
|
13
14
|
|
@@ -8,6 +8,7 @@ module Puppet::DataProviders; end
|
|
8
8
|
# The function is called on demand, and is associated with the compiler via an Adapter. This ensures that the data
|
9
9
|
# is only produced once per compilation.
|
10
10
|
#
|
11
|
+
# @api private
|
11
12
|
class Puppet::DataProviders::FunctionModuleDataProvider < Puppet::Plugins::DataProviders::ModuleDataProvider
|
12
13
|
include Puppet::DataProviders::DataFunctionSupport
|
13
14
|
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require_relative 'hiera_config'
|
2
2
|
|
3
|
+
# @api private
|
3
4
|
module Puppet::DataProviders::HieraSupport
|
4
5
|
def config_path
|
5
6
|
@hiera_config.nil? ? 'not yet configured' : @hiera_config.config_path
|
@@ -15,8 +16,6 @@ module Puppet::DataProviders::HieraSupport
|
|
15
16
|
# @param key [String] The key to lookup
|
16
17
|
# @param lookup_invocation [Puppet::Pops::Lookup::Invocation] The current lookup invocation
|
17
18
|
# @param merge [Puppet::Pops::MergeStrategy,String,Hash<String,Object>,nil] Merge strategy or hash with strategy and options
|
18
|
-
#
|
19
|
-
# @api public
|
20
19
|
def unchecked_lookup(key, lookup_invocation, merge)
|
21
20
|
lookup_invocation.with(:data_provider, self) do
|
22
21
|
merge_strategy = Puppet::Pops::MergeStrategy.strategy(merge)
|
@@ -3,6 +3,7 @@
|
|
3
3
|
require 'json'
|
4
4
|
|
5
5
|
module Puppet::DataProviders
|
6
|
+
# @api private
|
6
7
|
class JsonDataProviderFactory < Puppet::Plugins::DataProviders::FileBasedDataProviderFactory
|
7
8
|
def create(name, paths, parent_data_provider)
|
8
9
|
JsonDataProvider.new(name, paths, parent_data_provider)
|
@@ -13,6 +14,7 @@ module Puppet::DataProviders
|
|
13
14
|
end
|
14
15
|
end
|
15
16
|
|
17
|
+
# @api private
|
16
18
|
class JsonDataProvider < Puppet::Plugins::DataProviders::PathBasedDataProvider
|
17
19
|
def initialize_data(path, lookup_invocation)
|
18
20
|
JSON.parse(Puppet::FileSystem.read(path, :encoding => 'utf-8'))
|
@@ -3,6 +3,7 @@
|
|
3
3
|
require 'yaml'
|
4
4
|
|
5
5
|
module Puppet::DataProviders
|
6
|
+
# @api private
|
6
7
|
class YamlDataProviderFactory < Puppet::Plugins::DataProviders::FileBasedDataProviderFactory
|
7
8
|
def create(name, paths, parent_data_provider)
|
8
9
|
YamlDataProvider.new(name, paths, parent_data_provider)
|
@@ -13,6 +14,7 @@ module Puppet::DataProviders
|
|
13
14
|
end
|
14
15
|
end
|
15
16
|
|
17
|
+
# @api private
|
16
18
|
class YamlDataProvider < Puppet::Plugins::DataProviders::PathBasedDataProvider
|
17
19
|
def initialize_data(path, lookup_invocation)
|
18
20
|
data = YAML.load_file(path)
|
data/lib/puppet/defaults.rb
CHANGED
@@ -616,7 +616,7 @@ deprecated and has been replaced by 'always_retry_plugins'."
|
|
616
616
|
|
617
617
|
Puppet.define_settings(:module_tool,
|
618
618
|
:module_repository => {
|
619
|
-
:default => 'https://forgeapi.
|
619
|
+
:default => 'https://forgeapi.puppet.com',
|
620
620
|
:desc => "The module repository",
|
621
621
|
},
|
622
622
|
:module_working_dir => {
|
@@ -1926,4 +1926,23 @@ EOT
|
|
1926
1926
|
generate manifest documentation.",
|
1927
1927
|
}
|
1928
1928
|
)
|
1929
|
+
|
1930
|
+
define_settings(
|
1931
|
+
:main,
|
1932
|
+
:rich_data => {
|
1933
|
+
:default => false,
|
1934
|
+
:type => :boolean,
|
1935
|
+
:hook => proc do |value|
|
1936
|
+
envs = Puppet.lookup(:environments) { nil }
|
1937
|
+
envs.clear_all unless envs.nil?
|
1938
|
+
end,
|
1939
|
+
:desc => <<-'EOT'
|
1940
|
+
Enables having extended data in the catalog by adding the key `ext_parameters` to serialized
|
1941
|
+
resources. When enabled, resource containing values of the data types `Binary`, `Regexp`,
|
1942
|
+
`SemVer`, `SemVerRange`, `Timespan` and `Timestamp`, as well as instances of types derived
|
1943
|
+
from `Object` retain their data type and are serialized using Pcore in `ext_parameters`.
|
1944
|
+
EOT
|
1945
|
+
}
|
1946
|
+
)
|
1947
|
+
|
1929
1948
|
end
|
data/lib/puppet/environments.rb
CHANGED
@@ -41,7 +41,10 @@ module Puppet::Environments
|
|
41
41
|
|
42
42
|
def clear_all
|
43
43
|
root = Puppet.lookup(:root_environment) { nil }
|
44
|
-
|
44
|
+
unless root.nil?
|
45
|
+
root.instance_variable_set(:@static_catalogs, nil)
|
46
|
+
root.instance_variable_set(:@rich_data, nil)
|
47
|
+
end
|
45
48
|
end
|
46
49
|
end
|
47
50
|
|
@@ -112,7 +115,7 @@ module Puppet::Environments
|
|
112
115
|
def get_conf(name)
|
113
116
|
env = get(name)
|
114
117
|
if env
|
115
|
-
Puppet::Settings::EnvironmentConf.static_for(env, 0, Puppet[:static_catalogs])
|
118
|
+
Puppet::Settings::EnvironmentConf.static_for(env, 0, Puppet[:static_catalogs], Puppet[:rich_data])
|
116
119
|
else
|
117
120
|
nil
|
118
121
|
end
|
data/lib/puppet/face/catalog.rb
CHANGED
@@ -123,7 +123,7 @@ Puppet::Indirector::Face.define(:catalog, '0.0.1') do
|
|
123
123
|
|
124
124
|
Puppet::Resource::Catalog.indirection.terminus_class = :yaml
|
125
125
|
Puppet::Face[:catalog, "0.0.1"].save(catalog)
|
126
|
-
Puppet.notice "Saved catalog for #{Puppet[:certname]} to
|
126
|
+
Puppet.notice "Saved catalog for #{Puppet[:certname]} to #{Puppet::Resource::Catalog.indirection.terminus.path(Puppet[:certname])}"
|
127
127
|
nil
|
128
128
|
end
|
129
129
|
end
|
data/lib/puppet/face/epp.rb
CHANGED
@@ -62,6 +62,8 @@ Puppet::Face.define(:epp, '0.0.1') do
|
|
62
62
|
EOT
|
63
63
|
when_invoked do |*args|
|
64
64
|
options = args.pop
|
65
|
+
# pass a dummy node, as facts are not needed for validation
|
66
|
+
options[:node] = node = Puppet::Node.new("testnode", :facts => Puppet::Node::Facts.new("facts", {}))
|
65
67
|
compiler = create_compiler(options)
|
66
68
|
|
67
69
|
status = true # no validation error yet
|
@@ -141,6 +143,8 @@ Puppet::Face.define(:epp, '0.0.1') do
|
|
141
143
|
when_invoked do |*args|
|
142
144
|
require 'puppet/pops'
|
143
145
|
options = args.pop
|
146
|
+
# pass a dummy node, as facts are not needed for dump
|
147
|
+
options[:node] = node = Puppet::Node.new("testnode", :facts => Puppet::Node::Facts.new("facts", {}))
|
144
148
|
options[:header] = options[:header].nil? ? true : options[:header]
|
145
149
|
options[:validate] = options[:validate].nil? ? true : options[:validate]
|
146
150
|
|
@@ -224,8 +228,12 @@ Puppet::Face.define(:epp, '0.0.1') do
|
|
224
228
|
showing the name of the template before the output. The header output can be turned off with
|
225
229
|
`--no-header`. This also concatenates the template results without any added newline separators.
|
226
230
|
|
227
|
-
Facts
|
228
|
-
|
231
|
+
Facts from the node where the command is being run are used by default.args Facts can be obtained
|
232
|
+
for other nodes if they have called in, and reported their facts by using the `--node <nodename>`
|
233
|
+
flag.
|
234
|
+
|
235
|
+
Overriding node facts as well as additional facts can be given in a .yaml or .json file and referencing
|
236
|
+
it with the --facts option. (Values can be obtained in yaml format directly from
|
229
237
|
`facter`, or from puppet for a given node). Note that it is not possible to simulate the
|
230
238
|
reserved variable name `$facts` in any other way.
|
231
239
|
|
@@ -278,6 +286,10 @@ Puppet::Face.define(:epp, '0.0.1') do
|
|
278
286
|
$ puppet epp render -e '<% $facts[osfamily] %>' --facts data.yaml
|
279
287
|
EOT
|
280
288
|
|
289
|
+
option("--node <node_name>") do
|
290
|
+
summary "The name of the node for which facts are obtained. Defaults to facts for the local node."
|
291
|
+
end
|
292
|
+
|
281
293
|
option "--e <source>" do
|
282
294
|
default_to { nil }
|
283
295
|
summary "Render one inline epp template given on the command line."
|
@@ -291,8 +303,8 @@ Puppet::Face.define(:epp, '0.0.1') do
|
|
291
303
|
summary "A .pp or .yaml file that is processed to produce a hash of values for the template."
|
292
304
|
end
|
293
305
|
|
294
|
-
option("--facts <
|
295
|
-
summary "A .yaml file containing a hash of facts made available in $facts"
|
306
|
+
option("--facts <facts_file>") do
|
307
|
+
summary "A .yaml or .json file containing a hash of facts made available in $facts and $trusted"
|
296
308
|
end
|
297
309
|
|
298
310
|
option("--[no-]header") do
|
@@ -444,16 +456,50 @@ Puppet::Face.define(:epp, '0.0.1') do
|
|
444
456
|
|
445
457
|
# @api private
|
446
458
|
def create_compiler(options)
|
447
|
-
|
448
|
-
|
459
|
+
if options[:node]
|
460
|
+
node = options[:node]
|
461
|
+
else
|
462
|
+
node = Puppet[:node_name_value]
|
463
|
+
|
464
|
+
# If we want to lookup the node we are currently on
|
465
|
+
# we must returning these settings to their default values
|
466
|
+
Puppet.settings[:facts_terminus] = 'facter'
|
467
|
+
Puppet.settings[:node_cache_terminus] = nil
|
468
|
+
end
|
469
|
+
|
470
|
+
unless node.is_a?(Puppet::Node)
|
471
|
+
node = Puppet::Node.indirection.find(node)
|
472
|
+
# Found node must be given the environment to use in some cases, use the one configured
|
473
|
+
# or given on the command line
|
474
|
+
node.environment = Puppet[:environment]
|
475
|
+
end
|
476
|
+
|
477
|
+
fact_file = options[:facts]
|
478
|
+
|
479
|
+
if fact_file
|
480
|
+
if fact_file.is_a?(Hash) # when used via the Face API
|
481
|
+
given_facts = fact_file
|
482
|
+
elsif fact_file.end_with?("json")
|
483
|
+
given_facts = JSON.parse(Puppet::FileSystem.read(fact_file, :encoding => 'utf-8'))
|
484
|
+
else
|
485
|
+
given_facts = YAML.load(Puppet::FileSystem.read(fact_file, :encoding => 'utf-8'))
|
486
|
+
end
|
487
|
+
|
488
|
+
unless given_facts.instance_of?(Hash)
|
489
|
+
raise "Incorrect formatted data in #{fact_file} given via the --facts flag"
|
490
|
+
end
|
491
|
+
# It is difficult to add to or modify the set of facts once the node is created
|
492
|
+
# as changes does not show up in parameters. Rather than manually patching up
|
493
|
+
# a node and risking future regressions, a new node is created from scratch
|
494
|
+
node = Puppet::Node.new(node.name, :facts => Puppet::Node::Facts.new("facts", node.facts.values.merge(given_facts)))
|
495
|
+
node.environment = Puppet[:environment]
|
496
|
+
node.merge(node.facts.values)
|
497
|
+
end
|
498
|
+
|
449
499
|
compiler = Puppet::Parser::Compiler.new(node)
|
450
500
|
# configure compiler with facts and node related data
|
451
501
|
# Set all global variables from facts
|
452
|
-
|
453
|
-
# Configured trusted data (even if there are none)
|
454
|
-
compiler.topscope.set_trusted(node.trusted_data)
|
455
|
-
# Set the facts hash
|
456
|
-
compiler.topscope.set_facts(fact_values)
|
502
|
+
compiler.send(:set_node_parameters)
|
457
503
|
|
458
504
|
# pretend that the main class (named '') has been evaluated
|
459
505
|
# since it is otherwise not possible to resolve top scope variables
|