puppet 4.7.1-universal-darwin → 4.8.0-universal-darwin
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
@@ -358,13 +358,18 @@ class Puppet::Resource::Catalog < Puppet::Graph::SimpleGraph
|
|
358
358
|
result = @resource_table[title_key]
|
359
359
|
if result.nil?
|
360
360
|
# an instance has to be created in order to construct the unique key used when
|
361
|
-
# searching for aliases
|
362
|
-
|
361
|
+
# searching for aliases, or when app_management is active and nothing is found in
|
362
|
+
# which case it is needed by the CapabilityFinder.
|
363
|
+
res = nil
|
364
|
+
app_mgnt = Puppet[:app_management]
|
365
|
+
if app_mgnt || !@aliases.empty?
|
363
366
|
res = Puppet::Resource.new(type, title, { :environment => @environment_instance })
|
364
|
-
|
367
|
+
|
368
|
+
# No need to build the uniqueness key unless there are aliases
|
369
|
+
result = @resource_table[[type_name, res.uniqueness_key].flatten] unless @aliases.empty?
|
365
370
|
end
|
366
371
|
|
367
|
-
if result.nil? &&
|
372
|
+
if result.nil? && app_mgnt
|
368
373
|
resource_type = res.resource_type
|
369
374
|
if resource_type && resource_type.is_capability?
|
370
375
|
# @todo lutter 2015-03-10: this assumes that it is legal to just
|
@@ -419,8 +424,13 @@ class Puppet::Resource::Catalog < Puppet::Graph::SimpleGraph
|
|
419
424
|
end
|
420
425
|
|
421
426
|
if resources = data['resources']
|
427
|
+
# TODO: The deserializer needs a loader in order to deserialize types defined using the puppet language.
|
428
|
+
json_deserializer = nil
|
429
|
+
if Puppet[:rich_data] || result.environment_instance && result.environment_instance.rich_data?
|
430
|
+
json_deserializer = Puppet::Pops::Serialization::Deserializer.new(Puppet::Pops::Serialization::JSON::Reader.new([]), nil)
|
431
|
+
end
|
422
432
|
result.add_resource(*resources.collect do |res|
|
423
|
-
Puppet::Resource.from_data_hash(res)
|
433
|
+
Puppet::Resource.from_data_hash(res, json_deserializer)
|
424
434
|
end)
|
425
435
|
end
|
426
436
|
|
@@ -472,6 +482,15 @@ class Puppet::Resource::Catalog < Puppet::Graph::SimpleGraph
|
|
472
482
|
h
|
473
483
|
end
|
474
484
|
|
485
|
+
resources = if @resources.empty?
|
486
|
+
[]
|
487
|
+
elsif environment_instance.rich_data?
|
488
|
+
json_serializer = Puppet::Pops::Serialization::Serializer.new(Puppet::Pops::Serialization::JSON::Writer.new(''))
|
489
|
+
@resources.collect { |v| @resource_table[v].to_data_hash(json_serializer) }
|
490
|
+
else
|
491
|
+
@resources.collect { |v| @resource_table[v].to_data_hash }
|
492
|
+
end
|
493
|
+
|
475
494
|
{
|
476
495
|
'tags' => tags,
|
477
496
|
'name' => name,
|
@@ -480,7 +499,7 @@ class Puppet::Resource::Catalog < Puppet::Graph::SimpleGraph
|
|
480
499
|
'catalog_uuid' => catalog_uuid,
|
481
500
|
'catalog_format' => catalog_format,
|
482
501
|
'environment' => environment.to_s,
|
483
|
-
'resources' =>
|
502
|
+
'resources' => resources,
|
484
503
|
'edges' => edges. collect { |e| e.to_data_hash },
|
485
504
|
'classes' => classes,
|
486
505
|
}.merge(metadata_hash.empty? ? {} : {'metadata' => metadata_hash})
|
data/lib/puppet/resource/type.rb
CHANGED
@@ -130,7 +130,9 @@ class Puppet::Resource::Type
|
|
130
130
|
if blueprint.nil?
|
131
131
|
raise Puppet::ParseError, "Resource type #{resource.type} does not produce #{ex.type}"
|
132
132
|
end
|
133
|
-
|
133
|
+
t = ex.type
|
134
|
+
t = Puppet::Pops::Evaluator::Runtime3ResourceSupport.find_resource_type(scope, t) unless t == 'class' || t == 'node'
|
135
|
+
produced_resource = Puppet::Parser::Resource.new(t, ex.title, :scope => scope, :source => self)
|
134
136
|
|
135
137
|
produced_resource.resource_type.parameters.each do |name|
|
136
138
|
next if name == :name
|
data/lib/puppet/settings.rb
CHANGED
@@ -1430,7 +1430,7 @@ Generated on #{Time.now}.
|
|
1430
1430
|
end
|
1431
1431
|
|
1432
1432
|
def conf
|
1433
|
-
@conf ||= if environments = Puppet.lookup(:environments)
|
1433
|
+
@conf ||= if environments = Puppet.lookup(:environments) { nil }
|
1434
1434
|
environments.get_conf(@environment_name)
|
1435
1435
|
end
|
1436
1436
|
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
class Puppet::Settings::EnvironmentConf
|
4
4
|
|
5
5
|
ENVIRONMENT_CONF_ONLY_SETTINGS = [:modulepath, :manifest, :config_version].freeze
|
6
|
-
VALID_SETTINGS = (ENVIRONMENT_CONF_ONLY_SETTINGS + [:environment_timeout, :environment_data_provider, :static_catalogs]).freeze
|
6
|
+
VALID_SETTINGS = (ENVIRONMENT_CONF_ONLY_SETTINGS + [:environment_timeout, :environment_data_provider, :static_catalogs, :rich_data]).freeze
|
7
7
|
|
8
8
|
# Given a path to a directory environment, attempts to load and parse an
|
9
9
|
# environment.conf in ini format, and return an EnvironmentConf instance.
|
@@ -39,8 +39,8 @@ class Puppet::Settings::EnvironmentConf
|
|
39
39
|
# Configuration values are exactly those returned by the environment object,
|
40
40
|
# without interpolation. This is a special case for the default configured
|
41
41
|
# environment returned by the Puppet::Environments::StaticPrivate loader.
|
42
|
-
def self.static_for(environment, environment_timeout = 0, static_catalogs = false)
|
43
|
-
Static.new(environment, environment_timeout, static_catalogs)
|
42
|
+
def self.static_for(environment, environment_timeout = 0, static_catalogs = false, rich_data = false)
|
43
|
+
Static.new(environment, environment_timeout, static_catalogs, 'none', rich_data)
|
44
44
|
end
|
45
45
|
|
46
46
|
attr_reader :section, :path_to_env, :global_modulepath
|
@@ -108,6 +108,12 @@ class Puppet::Settings::EnvironmentConf
|
|
108
108
|
end
|
109
109
|
end
|
110
110
|
|
111
|
+
def rich_data
|
112
|
+
get_setting(:rich_data, Puppet.settings.value(:rich_data)) do |value|
|
113
|
+
value
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
111
117
|
def static_catalogs
|
112
118
|
get_setting(:static_catalogs, Puppet.settings.value(:static_catalogs)) do |value|
|
113
119
|
value
|
@@ -167,13 +173,15 @@ class Puppet::Settings::EnvironmentConf
|
|
167
173
|
class Static
|
168
174
|
attr_reader :environment_timeout
|
169
175
|
attr_reader :environment_data_provider
|
176
|
+
attr_reader :rich_data
|
170
177
|
attr_reader :static_catalogs
|
171
178
|
|
172
|
-
def initialize(environment, environment_timeout, static_catalogs, environment_data_provider = 'none')
|
179
|
+
def initialize(environment, environment_timeout, static_catalogs, environment_data_provider = 'none', rich_data = false)
|
173
180
|
@environment = environment
|
174
181
|
@environment_timeout = environment_timeout
|
175
182
|
@static_catalogs = static_catalogs
|
176
183
|
@environment_data_provider = environment_data_provider
|
184
|
+
@rich_data = rich_data
|
177
185
|
end
|
178
186
|
|
179
187
|
def manifest
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# A syntax checker for Base64.
|
2
|
+
# @api public
|
3
|
+
require 'puppet/syntax_checkers'
|
4
|
+
require 'base64'
|
5
|
+
class Puppet::SyntaxCheckers::Base64 < Puppet::Plugins::SyntaxCheckers::SyntaxChecker
|
6
|
+
|
7
|
+
# Checks the text for BASE64 syntax issues and reports them to the given acceptor.
|
8
|
+
# This checker allows the most relaxed form of Base64, including newlines and missing padding.
|
9
|
+
# It also accept URLsafe input.
|
10
|
+
#
|
11
|
+
# @param text [String] The text to check
|
12
|
+
# @param syntax [String] The syntax identifier in mime style (e.g. 'base64', 'text/xxx+base64')
|
13
|
+
# @param acceptor [#accept] A Diagnostic acceptor
|
14
|
+
# @param source_pos [Puppet::Pops::Adapters::SourcePosAdapter] A source pos adapter with location information
|
15
|
+
# @api public
|
16
|
+
#
|
17
|
+
def check(text, syntax, acceptor, source_pos)
|
18
|
+
raise ArgumentError.new("Base64 syntax checker: the text to check must be a String.") unless text.is_a?(String)
|
19
|
+
raise ArgumentError.new("Base64 syntax checker: the syntax identifier must be a String, e.g. json, data+json") unless syntax.is_a?(String)
|
20
|
+
raise ArgumentError.new("Base64 syntax checker: invalid Acceptor, got: '#{acceptor.class.name}'.") unless acceptor.is_a?(Puppet::Pops::Validation::Acceptor)
|
21
|
+
cleaned_text = text.gsub(/[\r?\n[:blank:]]/, '')
|
22
|
+
begin
|
23
|
+
# Do a strict decode64 on text with all whitespace stripped since the non strict version
|
24
|
+
# simply skips all non base64 characters
|
25
|
+
Base64.strict_decode64(cleaned_text)
|
26
|
+
rescue => e
|
27
|
+
if (cleaned_text.bytes.to_a.size * 8) % 6 != 0
|
28
|
+
msg2 = "padding is not correct"
|
29
|
+
else
|
30
|
+
msg2 = "contains letters outside strict base 64 range (or whitespace)"
|
31
|
+
end
|
32
|
+
msg = "Base64 syntax checker: Cannot parse invalid Base64 string - #{msg2}"
|
33
|
+
|
34
|
+
# TODO: improve the pops API to allow simpler diagnostic creation while still maintaining capabilities
|
35
|
+
# and the issue code. (In this case especially, where there is only a single error message being issued).
|
36
|
+
#
|
37
|
+
issue = Puppet::Pops::Issues::issue(:ILLEGAL_BASE64) { msg }
|
38
|
+
acceptor.accept(Puppet::Pops::Validation::Diagnostic.new(:error, issue, source_pos.locator.file, source_pos, {}))
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -4,8 +4,6 @@ require 'puppet/syntax_checkers'
|
|
4
4
|
class Puppet::SyntaxCheckers::Json < Puppet::Plugins::SyntaxCheckers::SyntaxChecker
|
5
5
|
|
6
6
|
# Checks the text for JSON syntax issues and reports them to the given acceptor.
|
7
|
-
# This implementation is abstract, it raises {NotImplementedError} since a subclass should have implemented the
|
8
|
-
# method.
|
9
7
|
#
|
10
8
|
# Error messages from the checker are capped at 100 chars from the source text.
|
11
9
|
#
|
data/lib/puppet/transaction.rb
CHANGED
@@ -165,6 +165,12 @@ class Puppet::Transaction
|
|
165
165
|
end
|
166
166
|
end
|
167
167
|
|
168
|
+
# if one or more resources has attempted and failed to generate resources,
|
169
|
+
# report it
|
170
|
+
if generator.resources_failed_to_generate
|
171
|
+
report.resources_failed_to_generate = true
|
172
|
+
end
|
173
|
+
|
168
174
|
Puppet.debug "Finishing transaction #{object_id}"
|
169
175
|
end
|
170
176
|
|
@@ -6,11 +6,14 @@
|
|
6
6
|
# @api private
|
7
7
|
class Puppet::Transaction::AdditionalResourceGenerator
|
8
8
|
attr_writer :relationship_graph
|
9
|
+
# [boolean] true if any resource has attempted and failed to generate resources
|
10
|
+
attr_reader :resources_failed_to_generate
|
9
11
|
|
10
12
|
def initialize(catalog, relationship_graph, prioritizer)
|
11
13
|
@catalog = catalog
|
12
14
|
@relationship_graph = relationship_graph
|
13
15
|
@prioritizer = prioritizer
|
16
|
+
@resources_failed_to_generate = false
|
14
17
|
end
|
15
18
|
|
16
19
|
def generate_additional_resources(resource)
|
@@ -18,6 +21,7 @@ class Puppet::Transaction::AdditionalResourceGenerator
|
|
18
21
|
begin
|
19
22
|
generated = resource.generate
|
20
23
|
rescue => detail
|
24
|
+
@resources_failed_to_generate = true
|
21
25
|
resource.log_exception(detail, "Failed to generate additional resources using 'generate': #{detail}")
|
22
26
|
end
|
23
27
|
return unless generated
|
@@ -52,6 +56,7 @@ class Puppet::Transaction::AdditionalResourceGenerator
|
|
52
56
|
generated = replace_duplicates_with_catalog_resources(resource.eval_generate)
|
53
57
|
return false if generated.empty?
|
54
58
|
rescue => detail
|
59
|
+
@resources_failed_to_generate = true
|
55
60
|
resource.log_exception(detail, "Failed to generate additional resources using 'eval_generate': #{detail}")
|
56
61
|
return false
|
57
62
|
end
|
@@ -127,6 +127,11 @@ class Puppet::Transaction::Report
|
|
127
127
|
# corrective changes.
|
128
128
|
attr_reader :corrective_change
|
129
129
|
|
130
|
+
# @return [Boolean] true if one or more resources attempted to generate
|
131
|
+
# resources and failed
|
132
|
+
#
|
133
|
+
attr_accessor :resources_failed_to_generate
|
134
|
+
|
130
135
|
def self.from_data_hash(data)
|
131
136
|
obj = self.allocate
|
132
137
|
obj.initialize_from_hash(data)
|
@@ -167,7 +172,7 @@ class Puppet::Transaction::Report
|
|
167
172
|
|
168
173
|
# @api private
|
169
174
|
def compute_status(resource_metrics, change_metric)
|
170
|
-
if (resource_metrics["failed"] || 0) > 0
|
175
|
+
if resources_failed_to_generate || (resource_metrics["failed"] || 0) > 0
|
171
176
|
'failed'
|
172
177
|
elsif change_metric > 0
|
173
178
|
'changed'
|
@@ -381,7 +386,7 @@ class Puppet::Transaction::Report
|
|
381
386
|
# @api private
|
382
387
|
#
|
383
388
|
def to_yaml_properties
|
384
|
-
super - [:@external_times]
|
389
|
+
super - [:@external_times, :@resources_failed_to_generate]
|
385
390
|
end
|
386
391
|
|
387
392
|
def self.supported_formats
|
data/lib/puppet/type.rb
CHANGED
@@ -45,13 +45,13 @@ module Puppet
|
|
45
45
|
munge do |value|
|
46
46
|
if value == :absent
|
47
47
|
value
|
48
|
-
elsif checksum?(value)
|
48
|
+
elsif value.is_a?(String) && checksum?(value)
|
49
49
|
# XXX This is potentially dangerous because it means users can't write a file whose
|
50
|
-
# entire contents are a plain checksum
|
50
|
+
# entire contents are a plain checksum unless it is a Binary content.
|
51
51
|
value
|
52
52
|
else
|
53
|
-
@actual_content = value
|
54
|
-
resource.parameter(:checksum).sum(
|
53
|
+
@actual_content = value.is_a?(Puppet::Pops::Types::PBinaryType::Binary) ? value.binary_buffer : value
|
54
|
+
resource.parameter(:checksum).sum(@actual_content)
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
data/lib/puppet/type/mount.rb
CHANGED
@@ -176,6 +176,50 @@ module Puppet
|
|
176
176
|
appear in fstab. For many platforms this is a comma delimited string.
|
177
177
|
Consult the fstab(5) man page for system-specific details."
|
178
178
|
|
179
|
+
def insync?(is)
|
180
|
+
|
181
|
+
if @resource[:ensure] == :mounted && !provider.property_hash[:live_options].nil?
|
182
|
+
|
183
|
+
# The mount options according to /etc/fstab. It is possible for puppet to
|
184
|
+
# update this file to reflect new options even if the remount to update
|
185
|
+
# the options has actually failed
|
186
|
+
fstab_options = provider.property_hash[:options] || ''
|
187
|
+
# The mount options according to the output of the 'mount' command. These will
|
188
|
+
# always reflect the options of the actual mounted device
|
189
|
+
mount_options = provider.property_hash[:live_options] || ''
|
190
|
+
# The desired mount options that have been specified in the puppet manifest
|
191
|
+
resource_options = @resource[:options] || ''
|
192
|
+
|
193
|
+
mount_list = mount_options.split(',')
|
194
|
+
resource_list = resource_options.split(',')
|
195
|
+
# Remove the string 'defaults' from the list of resources, because when
|
196
|
+
# we are comparing against the mount command output 'defaults' will be
|
197
|
+
# expanded into the full list of default options for the OS and file system
|
198
|
+
resource_list.delete('defaults')
|
199
|
+
|
200
|
+
# Do the options in fstab match the options that the user has defined?
|
201
|
+
if fstab_options != resource_options
|
202
|
+
return false
|
203
|
+
end
|
204
|
+
|
205
|
+
# Do the options provided by the 'mount' command match the options that
|
206
|
+
# the user has defined? We have to check this too because fstab could provide
|
207
|
+
# a false positive if a remount has failed
|
208
|
+
#
|
209
|
+
# We want to see if the mount command options contain the list of user
|
210
|
+
# specified options from the manifest. The reason we cannot do a 1:1
|
211
|
+
# comparison is because the expanded list of default options may be included
|
212
|
+
# in the mount output. These vary between OS and file system so since we don't
|
213
|
+
# have a good way to find out what they are, just check for the specific options
|
214
|
+
# the user has specified
|
215
|
+
if !(resource_list - mount_list).empty?
|
216
|
+
return false
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
super
|
221
|
+
end
|
222
|
+
|
179
223
|
validate do |value|
|
180
224
|
raise Puppet::Error, "options must not contain whitespace: #{value}" if value =~ /\s/
|
181
225
|
raise Puppet::Error, "options must not be an empty string" if value.empty?
|
@@ -151,7 +151,7 @@ module Puppet
|
|
151
151
|
end
|
152
152
|
|
153
153
|
# regular expression suitable for use by a ParsedFile based provider
|
154
|
-
REGEX = /^(?:(.+)
|
154
|
+
REGEX = /^(?:(.+)\s+)?(ssh-dss|ssh-ed25519|ssh-rsa|ecdsa-sha2-nistp256|ecdsa-sha2-nistp384|ecdsa-sha2-nistp521)\s+([^ ]+)\s*(.*)$/
|
155
155
|
def self.keyline_regex
|
156
156
|
REGEX
|
157
157
|
end
|
data/lib/puppet/type/tidy.rb
CHANGED
data/lib/puppet/type/user.rb
CHANGED
@@ -16,9 +16,10 @@ module Puppet
|
|
16
16
|
about them. It does not directly modify `/etc/passwd` or anything.
|
17
17
|
|
18
18
|
**Autorequires:** If Puppet is managing the user's primary group (as
|
19
|
-
provided in the `gid` attribute)
|
20
|
-
|
21
|
-
|
19
|
+
provided in the `gid` attribute) or any group listed in the `groups`
|
20
|
+
attribute then the user resource will autorequire that group. If Puppet
|
21
|
+
is managing any role accounts corresponding to the user's roles, the
|
22
|
+
user resource will autorequire those role accounts."
|
22
23
|
|
23
24
|
feature :allows_duplicates,
|
24
25
|
"The provider supports duplicate users with the same UID."
|
@@ -323,9 +324,14 @@ module Puppet
|
|
323
324
|
end
|
324
325
|
|
325
326
|
newparam(:membership) do
|
326
|
-
desc "
|
327
|
-
|
328
|
-
the user
|
327
|
+
desc "If `minimum` is specified, Puppet will ensure that the user is a
|
328
|
+
member of all specified groups, but will not remove any other groups
|
329
|
+
that the user is a part of.
|
330
|
+
|
331
|
+
If `inclusive` is specified, Puppet will ensure that the user is a
|
332
|
+
member of **only** specified groups.
|
333
|
+
|
334
|
+
Defaults to `minimum`."
|
329
335
|
|
330
336
|
newvalues(:inclusive, :minimum)
|
331
337
|
|
data/lib/puppet/util/log.rb
CHANGED
@@ -245,6 +245,31 @@ class Puppet::Util::Log
|
|
245
245
|
obj
|
246
246
|
end
|
247
247
|
|
248
|
+
# Log output using scope and level
|
249
|
+
#
|
250
|
+
# @param [Puppet::Parser::Scope] scope
|
251
|
+
# @param [Symbol] level log level
|
252
|
+
# @param [Array<Object>] vals the values to log (will be converted to string and joined with space)
|
253
|
+
#
|
254
|
+
def self.log_func(scope, level, vals)
|
255
|
+
# NOTE: 3x, does this: vals.join(" ")
|
256
|
+
# New implementation uses the evaluator to get proper formatting per type
|
257
|
+
vals = vals.map { |v| Puppet::Pops::Evaluator::EvaluatorImpl.new.string(v, scope) }
|
258
|
+
|
259
|
+
# Bypass Puppet.<level> call since it picks up source from "self" which is not applicable in the 4x
|
260
|
+
# Function API.
|
261
|
+
# TODO: When a function can obtain the file, line, pos of the call merge those in (3x supports
|
262
|
+
# options :file, :line. (These were never output when calling the 3x logging functions since
|
263
|
+
# 3x scope does not know about the calling location at that detailed level, nor do they
|
264
|
+
# appear in a report to stdout/error when included). Now, the output simply uses scope (like 3x)
|
265
|
+
# as this is good enough, but does not reflect the true call-stack, but is a rough estimate
|
266
|
+
# of where the logging call originates from).
|
267
|
+
#
|
268
|
+
Puppet::Util::Log.create({:level => level, :source => scope, :message => vals.join(" ")})
|
269
|
+
nil
|
270
|
+
end
|
271
|
+
|
272
|
+
|
248
273
|
attr_accessor :time, :remote, :file, :line, :pos, :source, :issue_code, :environment, :node, :backtrace
|
249
274
|
attr_reader :level, :message
|
250
275
|
|
data/lib/puppet/util/plist.rb
CHANGED
@@ -54,9 +54,14 @@ module Puppet::Util::Plist
|
|
54
54
|
# Read plist text using the CFPropertyList gem.
|
55
55
|
def parse_plist(plist_data, file_path = '')
|
56
56
|
bad_xml_doctype = /^.*<!DOCTYPE plist PUBLIC -\/\/Apple Computer.*$/
|
57
|
-
|
58
|
-
plist_data
|
59
|
-
|
57
|
+
begin
|
58
|
+
if plist_data =~ bad_xml_doctype
|
59
|
+
plist_data.gsub!( bad_xml_doctype, plist_xml_doctype )
|
60
|
+
Puppet.debug("Had to fix plist with incorrect DOCTYPE declaration: #{file_path}")
|
61
|
+
end
|
62
|
+
rescue ArgumentError => e
|
63
|
+
Puppet.debug "Failed with #{e.class} on #{file_path}: #{e.inspect}"
|
64
|
+
return nil
|
60
65
|
end
|
61
66
|
|
62
67
|
begin
|