puppet 4.2.3-x64-mingw32 → 4.3.0-x64-mingw32
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 +3 -0
- data/README.md +1 -1
- data/ext/debian/puppet.init +0 -1
- data/ext/debian/puppet.logrotate +14 -5
- data/ext/osx/puppet.plist +0 -2
- data/ext/redhat/client.init +13 -5
- data/ext/redhat/logrotate +15 -3
- data/ext/redhat/puppet.spec.erb +5 -1
- data/ext/redhat/server.init +1 -1
- data/ext/systemd/puppet.service +1 -0
- data/lib/puppet.rb +12 -0
- data/lib/puppet/agent.rb +4 -4
- data/lib/puppet/agent/locker.rb +11 -2
- data/lib/puppet/application/agent.rb +5 -1
- data/lib/puppet/application/apply.rb +4 -0
- data/lib/puppet/application/filebucket.rb +78 -4
- data/lib/puppet/application/lookup.rb +356 -0
- data/lib/puppet/application/master.rb +3 -0
- data/lib/puppet/configurer.rb +9 -5
- data/lib/puppet/context.rb +16 -1
- data/lib/puppet/context/trusted_information.rb +21 -1
- data/lib/puppet/daemon.rb +17 -13
- data/lib/puppet/data_binding.rb +4 -2
- data/lib/puppet/data_providers.rb +12 -13
- data/lib/puppet/data_providers/data_adapter.rb +7 -68
- data/lib/puppet/data_providers/data_function_support.rb +5 -26
- data/lib/puppet/data_providers/function_env_data_provider.rb +0 -10
- data/lib/puppet/data_providers/function_module_data_provider.rb +0 -22
- data/lib/puppet/data_providers/hiera_config.rb +106 -0
- data/lib/puppet/data_providers/hiera_env_data_provider.rb +18 -0
- data/lib/puppet/data_providers/hiera_interpolate.rb +97 -0
- data/lib/puppet/data_providers/hiera_module_data_provider.rb +23 -0
- data/lib/puppet/data_providers/hiera_support.rb +37 -0
- data/lib/puppet/data_providers/json_data_provider_factory.rb +31 -0
- data/lib/puppet/data_providers/lookup_adapter.rb +200 -0
- data/lib/puppet/data_providers/yaml_data_provider_factory.rb +32 -0
- data/lib/puppet/defaults.rb +12 -2
- data/lib/puppet/error.rb +4 -0
- data/lib/puppet/face/module/changes.rb +2 -1
- data/lib/puppet/feature/cfacter.rb +1 -0
- data/lib/puppet/file_bucket/dipper.rb +58 -2
- data/lib/puppet/functions.rb +2 -4
- data/lib/puppet/functions/assert_type.rb +48 -12
- data/lib/puppet/functions/defined.rb +79 -48
- data/lib/puppet/functions/each.rb +85 -27
- data/lib/puppet/functions/filter.rb +58 -23
- data/lib/puppet/functions/hiera.rb +76 -3
- data/lib/puppet/functions/hiera_array.rb +65 -3
- data/lib/puppet/functions/hiera_hash.rb +74 -2
- data/lib/puppet/functions/hiera_include.rb +75 -2
- data/lib/puppet/functions/lookup.rb +19 -17
- data/lib/puppet/functions/map.rb +56 -21
- data/lib/puppet/functions/match.rb +29 -12
- data/lib/puppet/functions/reduce.rb +95 -58
- data/lib/puppet/functions/versioncmp.rb +36 -0
- data/lib/puppet/functions/with.rb +15 -7
- data/lib/puppet/indirector/catalog/compiler.rb +3 -3
- data/lib/puppet/indirector/catalog/static_compiler.rb +46 -30
- data/lib/puppet/indirector/data_binding/none.rb +4 -1
- data/lib/puppet/indirector/file_bucket_file/file.rb +58 -1
- data/lib/puppet/indirector/hiera.rb +4 -0
- data/lib/puppet/indirector/json.rb +1 -1
- data/lib/puppet/indirector/msgpack.rb +1 -1
- data/lib/puppet/indirector/request.rb +7 -8
- data/lib/puppet/indirector/resource_type/parser.rb +5 -3
- data/lib/puppet/info_service.rb +7 -0
- data/lib/puppet/info_service/class_information_service.rb +111 -0
- data/lib/puppet/module_tool/metadata.rb +32 -9
- data/lib/puppet/module_tool/skeleton/templates/generator/README.md.erb +42 -38
- data/lib/puppet/network/authconfig.rb +21 -1
- data/lib/puppet/network/authorization.rb +8 -1
- data/lib/puppet/network/http/api/master/v3.rb +7 -1
- data/lib/puppet/network/http/api/master/v3/environment.rb +59 -0
- data/lib/puppet/node/environment.rb +9 -2
- data/lib/puppet/parser.rb +3 -0
- data/lib/puppet/parser/ast/pops_bridge.rb +39 -1
- data/lib/puppet/parser/compiler.rb +302 -12
- data/lib/puppet/parser/compiler/catalog_validator.rb +33 -0
- data/lib/puppet/parser/compiler/catalog_validator/env_relationship_validator.rb +64 -0
- data/lib/puppet/parser/compiler/catalog_validator/relationship_validator.rb +38 -0
- data/lib/puppet/parser/compiler/catalog_validator/site_validator.rb +20 -0
- data/lib/puppet/parser/environment_compiler.rb +165 -0
- data/lib/puppet/parser/functions/assert_type.rb +46 -16
- data/lib/puppet/parser/functions/defined.rb +105 -68
- data/lib/puppet/parser/functions/each.rb +85 -27
- data/lib/puppet/parser/functions/filter.rb +59 -23
- data/lib/puppet/parser/functions/hiera.rb +83 -27
- data/lib/puppet/parser/functions/hiera_array.rb +71 -28
- data/lib/puppet/parser/functions/hiera_hash.rb +81 -30
- data/lib/puppet/parser/functions/hiera_include.rb +81 -40
- data/lib/puppet/parser/functions/map.rb +55 -20
- data/lib/puppet/parser/functions/match.rb +27 -12
- data/lib/puppet/parser/functions/reduce.rb +97 -60
- data/lib/puppet/parser/functions/with.rb +16 -8
- data/lib/puppet/parser/resource.rb +98 -19
- data/lib/puppet/plugins/configuration.rb +3 -2
- data/lib/puppet/plugins/data_providers.rb +12 -60
- data/lib/puppet/plugins/data_providers/data_provider.rb +283 -0
- data/lib/puppet/plugins/data_providers/registry.rb +84 -0
- data/lib/puppet/pops.rb +19 -17
- data/lib/puppet/pops/adapters.rb +12 -0
- data/lib/puppet/pops/binder/binder.rb +2 -2
- data/lib/puppet/pops/binder/bindings_checker.rb +1 -1
- data/lib/puppet/pops/binder/bindings_label_provider.rb +3 -1
- data/lib/puppet/pops/binder/bindings_loader.rb +6 -2
- data/lib/puppet/pops/binder/bindings_model_meta.rb +2 -2
- data/lib/puppet/pops/binder/config/binder_config.rb +1 -1
- data/lib/puppet/pops/binder/injector.rb +4 -4
- data/lib/puppet/pops/binder/key_factory.rb +3 -9
- data/lib/puppet/pops/binder/scheme_handler/module_scheme.rb +68 -9
- data/lib/puppet/pops/evaluator/access_operator.rb +27 -60
- data/lib/puppet/pops/evaluator/closure.rb +8 -8
- data/lib/puppet/pops/evaluator/collectors/abstract_collector.rb +1 -1
- data/lib/puppet/pops/evaluator/evaluator_impl.rb +5 -5
- data/lib/puppet/pops/evaluator/literal_evaluator.rb +87 -0
- data/lib/puppet/pops/evaluator/relationship_operator.rb +7 -1
- data/lib/puppet/pops/functions/dispatcher.rb +3 -3
- data/lib/puppet/pops/issues.rb +1 -1
- data/lib/puppet/pops/label_provider.rb +1 -1
- data/lib/puppet/pops/lookup.rb +25 -47
- data/lib/puppet/pops/lookup/explainer.rb +402 -0
- data/lib/puppet/pops/lookup/invocation.rb +117 -0
- data/lib/puppet/pops/merge_strategy.rb +73 -5
- data/lib/puppet/pops/model/factory.rb +34 -0
- data/lib/puppet/pops/model/model_label_provider.rb +10 -1
- data/lib/puppet/pops/model/model_meta.rb +15 -0
- data/lib/puppet/pops/model/model_tree_dumper.rb +18 -0
- data/lib/puppet/pops/parser/code_merger.rb +13 -1
- data/lib/puppet/pops/parser/egrammar.ra +56 -3
- data/lib/puppet/pops/parser/eparser.rb +1549 -1352
- data/lib/puppet/pops/parser/lexer2.rb +31 -6
- data/lib/puppet/pops/parser/locator.rb +1 -1
- data/lib/puppet/pops/parser/parser_support.rb +25 -13
- data/lib/puppet/pops/types/enumeration.rb +1 -2
- data/lib/puppet/pops/types/type_asserter.rb +16 -15
- data/lib/puppet/pops/types/type_assertion_error.rb +1 -0
- data/lib/puppet/pops/types/type_calculator.rb +171 -1020
- data/lib/puppet/pops/types/type_factory.rb +87 -148
- data/lib/puppet/pops/types/type_mismatch_describer.rb +743 -0
- data/lib/puppet/pops/types/type_parser.rb +116 -127
- data/lib/puppet/pops/types/types.rb +1394 -255
- data/lib/puppet/pops/types/types_meta.rb +0 -234
- data/lib/puppet/pops/validation.rb +7 -2
- data/lib/puppet/pops/validation/checker4_0.rb +28 -0
- data/lib/puppet/provider/augeas/augeas.rb +50 -0
- data/lib/puppet/provider/group/directoryservice.rb +10 -0
- data/lib/puppet/provider/package/dnf.rb +41 -0
- data/lib/puppet/provider/package/gem.rb +7 -2
- data/lib/puppet/provider/package/rpm.rb +1 -0
- data/lib/puppet/provider/package/windows/exe_package.rb +10 -8
- data/lib/puppet/provider/package/windows/msi_package.rb +4 -3
- data/lib/puppet/provider/package/windows/package.rb +9 -1
- data/lib/puppet/provider/package/yum.rb +14 -9
- data/lib/puppet/provider/service/bsd.rb +1 -1
- data/lib/puppet/provider/service/debian.rb +21 -0
- data/lib/puppet/provider/service/init.rb +6 -0
- data/lib/puppet/provider/service/rcng.rb +51 -0
- data/lib/puppet/provider/service/redhat.rb +2 -1
- data/lib/puppet/provider/service/smf.rb +43 -2
- data/lib/puppet/provider/service/src.rb +27 -0
- data/lib/puppet/provider/service/systemd.rb +15 -3
- data/lib/puppet/provider/sshkey/parsed.rb +19 -9
- data/lib/puppet/reference/report.rb +9 -12
- data/lib/puppet/reports.rb +5 -1
- data/lib/puppet/resource.rb +50 -73
- data/lib/puppet/resource/capability_finder.rb +95 -0
- data/lib/puppet/resource/catalog.rb +47 -7
- data/lib/puppet/resource/status.rb +0 -2
- data/lib/puppet/resource/type.rb +238 -44
- data/lib/puppet/resource/type_collection.rb +60 -2
- data/lib/puppet/settings.rb +2 -2
- data/lib/puppet/ssl/certificate_authority/interface.rb +2 -2
- data/lib/puppet/ssl/oids.rb +9 -1
- data/lib/puppet/transaction.rb +4 -1
- data/lib/puppet/transaction/additional_resource_generator.rb +71 -8
- data/lib/puppet/transaction/resource_harness.rb +9 -4
- data/lib/puppet/type.rb +74 -3
- data/lib/puppet/type/augeas.rb +8 -0
- data/lib/puppet/type/file/source.rb +14 -12
- data/lib/puppet/type/user.rb +4 -2
- data/lib/puppet/util/windows/security.rb +4 -1
- data/lib/puppet/util/windows/taskscheduler.rb +1 -1
- data/lib/puppet/version.rb +1 -1
- data/spec/fixtures/unit/application/environments/production/data/common.yaml +3 -0
- data/spec/fixtures/unit/application/environments/production/environment.conf +1 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_bad_syntax_json/data/bad.json +3 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_bad_syntax_json/environment.conf +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_bad_syntax_json/hiera.yaml +5 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_bad_syntax_json/manifests/site.pp +5 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_bad_syntax_yaml/data/bad.yaml +3 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_bad_syntax_yaml/environment.conf +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_bad_syntax_yaml/hiera.yaml +5 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_bad_syntax_yaml/manifests/site.pp +5 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_defaults/data/common.yaml +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_defaults/environment.conf +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_defaults/manifests/site.pp +1 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_defaults/modules/one/data/common.yaml +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_defaults/modules/one/manifests/init.pp +5 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_defaults/modules/one/metadata.json +9 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_env_config/data1/first.json +3 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_env_config/data1/name.yaml +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_env_config/data1/second.json +3 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_env_config/data1/single.yaml +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_env_config/data2/single.yaml +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_env_config/environment.conf +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_env_config/hiera.yaml +18 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_env_config/manifests/site.pp +5 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_misc/data/common.yaml +46 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_misc/environment.conf +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_misc/manifests/site.pp +1 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_misc/modules/one/data/common.yaml +30 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_misc/modules/one/manifests/init.pp +13 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_misc/modules/one/metadata.json +9 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/environment.conf +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/manifests/site.pp +1 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/modules/one/data1/first.json +3 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/modules/one/data1/name.yaml +1 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/modules/one/data1/second.json +3 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/modules/one/data1/single.yaml +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/modules/one/data2/single.yaml +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/modules/one/hiera.yaml +18 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/modules/one/manifests/init.pp +5 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/modules/one/metadata.json +9 -0
- data/spec/fixtures/unit/data_providers/environments/sample/modules/dataprovider/lib/puppet_x/helindbe/sample_env_data.rb +1 -0
- data/spec/fixtures/unit/data_providers/environments/sample/modules/dataprovider/lib/puppet_x/helindbe/sample_module_data.rb +1 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/hieraprovider/data/first.json +3 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/hieraprovider/hiera.yaml +8 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/hieraprovider/manifests/init.pp +5 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/hieraprovider/metadata.json +9 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/meta/lib/puppet/functions/meta/data.rb +9 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/meta/manifests/init.pp +3 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/meta/metadata.json +9 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/metawcp/lib/puppet/bindings/metawcp/default.rb +10 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/metawcp/lib/puppet_x/thallgren/sample_module_data.rb +23 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/metawcp/manifests/init.pp +3 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/metawcp/metadata.json +9 -0
- data/spec/fixtures/unit/provider/package/yum/yum-check-update-security.txt +184 -0
- data/spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_get/should_yield_to_the_block.yml +24 -0
- data/spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_head/should_yield_to_the_block.yml +24 -0
- data/spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_post/should_yield_to_the_block.yml +24 -0
- data/spec/integration/data_binding_spec.rb +229 -0
- data/spec/integration/file_bucket/file_spec.rb +2 -2
- data/spec/integration/parser/compiler_spec.rb +23 -19
- data/spec/integration/parser/resource_expressions_spec.rb +4 -4
- data/spec/integration/parser/undef_param_spec.rb +1 -1
- data/spec/integration/resource/catalog_spec.rb +1 -1
- data/spec/integration/type/package_spec.rb +2 -0
- data/spec/integration/util/windows/security_spec.rb +18 -0
- data/spec/lib/matchers/include_in_order.rb +2 -2
- data/spec/shared_behaviours/iterative_functions.rb +8 -8
- data/spec/spec_helper.rb +7 -0
- data/spec/unit/agent/locker_spec.rb +4 -4
- data/spec/unit/agent_spec.rb +0 -8
- data/spec/unit/application/agent_spec.rb +5 -0
- data/spec/unit/application/apply_spec.rb +8 -0
- data/spec/unit/application/filebucket_spec.rb +87 -1
- data/spec/unit/application/lookup_spec.rb +195 -0
- data/spec/unit/appmgmt_spec.rb +657 -0
- data/spec/unit/capability_spec.rb +414 -0
- data/spec/unit/configurer_spec.rb +7 -1
- data/spec/unit/context/trusted_information_spec.rb +24 -1
- data/spec/unit/daemon_spec.rb +18 -8
- data/spec/unit/data_providers/hiera_data_provider_spec.rb +201 -0
- data/spec/unit/file_bucket/dipper_spec.rb +210 -1
- data/spec/unit/functions/assert_type_spec.rb +5 -7
- data/spec/unit/functions/defined_spec.rb +2 -2
- data/spec/unit/functions/epp_spec.rb +2 -2
- data/spec/unit/functions/lookup_spec.rb +200 -9
- data/spec/unit/functions/regsubst_spec.rb +17 -8
- data/spec/unit/functions/scanf_spec.rb +1 -1
- data/spec/unit/functions/split_spec.rb +2 -2
- data/spec/unit/functions/versioncmp_spec.rb +36 -0
- data/spec/unit/functions4_spec.rb +58 -72
- data/spec/unit/indirector/catalog/compiler_spec.rb +28 -8
- data/spec/unit/indirector/catalog/static_compiler_spec.rb +38 -20
- data/spec/unit/indirector/data_binding/none_spec.rb +2 -2
- data/spec/unit/indirector/file_bucket_file/file_spec.rb +52 -1
- data/spec/unit/indirector/request_spec.rb +8 -8
- data/spec/unit/info_service_spec.rb +236 -0
- data/spec/unit/module_tool/metadata_spec.rb +31 -2
- data/spec/unit/network/authconfig_spec.rb +62 -32
- data/spec/unit/network/authorization_spec.rb +30 -2
- data/spec/unit/network/http/connection_spec.rb +14 -19
- data/spec/unit/parser/compiler_spec.rb +86 -2
- data/spec/unit/parser/functions/create_resources_spec.rb +1 -1
- data/spec/unit/parser/resource_spec.rb +2 -20
- data/spec/unit/pops/binder/config/binder_config_spec.rb +1 -1
- data/spec/unit/pops/binder/injector_spec.rb +3 -3
- data/spec/unit/pops/evaluator/access_ops_spec.rb +13 -11
- data/spec/unit/pops/evaluator/basic_expressions_spec.rb +1 -2
- data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +19 -11
- data/spec/unit/pops/evaluator/literal_evaluator_spec.rb +43 -0
- data/spec/unit/pops/label_provider_spec.rb +5 -1
- data/spec/unit/pops/parser/lexer2_spec.rb +33 -7
- data/spec/unit/pops/parser/parse_application_spec.rb +40 -0
- data/spec/unit/pops/parser/parse_basic_expressions_spec.rb +4 -0
- data/spec/unit/pops/parser/parse_capabilities_spec.rb +47 -0
- data/spec/unit/pops/parser/parse_site_spec.rb +38 -0
- data/spec/unit/pops/parser/parser_rspec_helper.rb +5 -0
- data/spec/unit/pops/parser/parser_spec.rb +18 -0
- data/spec/unit/pops/types/type_calculator_spec.rb +427 -444
- data/spec/unit/pops/types/type_factory_spec.rb +12 -12
- data/spec/unit/pops/types/type_parser_spec.rb +7 -12
- data/spec/unit/pops/validator/validator_spec.rb +25 -0
- data/spec/unit/provider/augeas/augeas_spec.rb +50 -0
- data/spec/unit/provider/group/directoryservice_spec.rb +33 -0
- data/spec/unit/provider/group/windows_adsi_spec.rb +3 -0
- data/spec/unit/provider/package/dnf_spec.rb +92 -0
- data/spec/unit/provider/package/gem_spec.rb +7 -0
- data/spec/unit/provider/package/rpm_spec.rb +25 -2
- data/spec/unit/provider/package/windows/package_spec.rb +41 -0
- data/spec/unit/provider/package/yum_spec.rb +21 -13
- data/spec/unit/provider/scheduled_task/win32_taskscheduler_spec.rb +10 -0
- data/spec/unit/provider/service/debian_spec.rb +27 -0
- data/spec/unit/provider/service/rcng_spec.rb +41 -0
- data/spec/unit/provider/service/redhat_spec.rb +8 -1
- data/spec/unit/provider/service/smf_spec.rb +30 -5
- data/spec/unit/provider/service/src_spec.rb +19 -4
- data/spec/unit/provider/service/systemd_spec.rb +78 -29
- data/spec/unit/provider/sshkey/parsed_spec.rb +23 -0
- data/spec/unit/reports_spec.rb +10 -0
- data/spec/unit/resource/capability_finder_spec.rb +56 -0
- data/spec/unit/resource/catalog_spec.rb +31 -8
- data/spec/unit/resource/type_collection_spec.rb +23 -2
- data/spec/unit/resource/type_spec.rb +1 -1
- data/spec/unit/resource_spec.rb +22 -4
- data/spec/unit/settings_spec.rb +90 -1
- data/spec/unit/ssl/certificate_authority/interface_spec.rb +4 -3
- data/spec/unit/ssl/oids_spec.rb +8 -0
- data/spec/unit/transaction/additional_resource_generator_spec.rb +78 -5
- data/spec/unit/transaction/report_spec.rb +24 -1
- data/spec/unit/type/package_spec.rb +1 -0
- data/spec/unit/type/user_spec.rb +14 -7
- data/spec/unit/type_spec.rb +1 -1
- metadata +169 -5
- data/lib/puppet/pops/evaluator/callable_mismatch_describer.rb +0 -175
- data/spec/integration/data_binding.rb +0 -104
@@ -5,19 +5,16 @@ report = Puppet::Util::Reference.newreference :report, :doc => "All available tr
|
|
5
5
|
end
|
6
6
|
|
7
7
|
report.header = "
|
8
|
-
Puppet
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
to collect. See [Reports and Reporting](http://docs.puppetlabs.com/guides/reporting.html) for more information on how to use reports.
|
8
|
+
Puppet can generate a report after applying a catalog. This report includes
|
9
|
+
events, log messages, resource statuses, and metrics and metadata about the run.
|
10
|
+
Puppet agent sends its report to a Puppet master server, and Puppet apply
|
11
|
+
processes its own reports.
|
13
12
|
|
14
|
-
|
15
|
-
|
13
|
+
Puppet master and Puppet apply will handle every report with a set of report
|
14
|
+
processors, configurable with the `reports` setting in puppet.conf. This page
|
15
|
+
documents the built-in report processors.
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
reports entirely.
|
20
|
-
|
21
|
-
Puppet provides multiple report handlers that will process client reports:
|
17
|
+
See [About Reporting](https://docs.puppetlabs.com/puppet/latest/reference/reporting_about.html)
|
18
|
+
for more details.
|
22
19
|
|
23
20
|
"
|
data/lib/puppet/reports.rb
CHANGED
@@ -54,7 +54,11 @@ class Puppet::Reports
|
|
54
54
|
def self.register_report(name, options = {}, &block)
|
55
55
|
name = name.intern
|
56
56
|
|
57
|
-
mod = genmodule(name,
|
57
|
+
mod = genmodule(name,
|
58
|
+
:extend => Puppet::Util::Docs,
|
59
|
+
:hash => instance_hash(:report),
|
60
|
+
:overwrite => true,
|
61
|
+
:block => block)
|
58
62
|
|
59
63
|
mod.useyaml = true if options[:useyaml]
|
60
64
|
|
data/lib/puppet/resource.rb
CHANGED
@@ -11,9 +11,12 @@ class Puppet::Resource
|
|
11
11
|
include Puppet::Util::Tagging
|
12
12
|
|
13
13
|
include Enumerable
|
14
|
-
attr_accessor :file, :line, :catalog, :exported, :virtual, :
|
14
|
+
attr_accessor :file, :line, :catalog, :exported, :virtual, :strict
|
15
15
|
attr_reader :type, :title
|
16
16
|
|
17
|
+
# @deprecated
|
18
|
+
attr_accessor :validate_parameters
|
19
|
+
|
17
20
|
require 'puppet/indirector'
|
18
21
|
extend Puppet::Indirector
|
19
22
|
indirects :resource, :terminus_class => :ral
|
@@ -274,6 +277,29 @@ class Puppet::Resource
|
|
274
277
|
catalog ? catalog.resource(to_s) : nil
|
275
278
|
end
|
276
279
|
|
280
|
+
# A resource is an application component if it exports or consumes
|
281
|
+
# one or more capabilities, or if it requires a capability resource
|
282
|
+
def is_application_component?
|
283
|
+
return true if ! export.empty? || self[:consume]
|
284
|
+
# Array(self[:require]) does not work for Puppet::Resource instances
|
285
|
+
req = self[:require] || []
|
286
|
+
req = [ req ] unless req.is_a?(Array)
|
287
|
+
req.any? { |r| r.is_capability? }
|
288
|
+
end
|
289
|
+
|
290
|
+
# A resource is a capability (instance) if its underlying type is a
|
291
|
+
# capability type
|
292
|
+
def is_capability?
|
293
|
+
resource_type and resource_type.is_capability?
|
294
|
+
end
|
295
|
+
|
296
|
+
# Returns the value of the 'export' metaparam as an Array
|
297
|
+
# @api private
|
298
|
+
def export
|
299
|
+
v = self[:export] || []
|
300
|
+
v.is_a?(Array) ? v : [ v ]
|
301
|
+
end
|
302
|
+
|
277
303
|
# The resource's type implementation
|
278
304
|
# @return [Puppet::Type, Puppet::Resource::Type]
|
279
305
|
# @api private
|
@@ -281,8 +307,14 @@ class Puppet::Resource
|
|
281
307
|
@rstype ||= case type
|
282
308
|
when "Class"; environment.known_resource_types.hostclass(title == :main ? "" : title)
|
283
309
|
when "Node"; environment.known_resource_types.node(title)
|
310
|
+
when "Site"; environment.known_resource_types.site(nil)
|
284
311
|
else
|
285
|
-
Puppet::Type.type(type)
|
312
|
+
result = Puppet::Type.type(type)
|
313
|
+
if !result
|
314
|
+
krt = environment.known_resource_types
|
315
|
+
result = krt.definition(type) || krt.application(type)
|
316
|
+
end
|
317
|
+
result
|
286
318
|
end
|
287
319
|
end
|
288
320
|
|
@@ -364,7 +396,8 @@ class Puppet::Resource
|
|
364
396
|
" %-#{attr_max}s => %s,\n" % [k, Puppet::Parameter.format_value_for_display(v)]
|
365
397
|
}.join
|
366
398
|
|
367
|
-
|
399
|
+
escaped = self.title.gsub(/'/,"\\\\'")
|
400
|
+
"%s { '%s':\n%s}" % [self.type.to_s.downcase, escaped, attributes]
|
368
401
|
end
|
369
402
|
|
370
403
|
def to_ref
|
@@ -393,74 +426,11 @@ class Puppet::Resource
|
|
393
426
|
end
|
394
427
|
private :missing_arguments
|
395
428
|
|
396
|
-
#
|
397
|
-
#
|
398
|
-
#
|
399
|
-
# Example:
|
400
|
-
#
|
401
|
-
# class foo($port=0){ ... }
|
402
|
-
#
|
403
|
-
# We make a request to the backend for the key 'foo::port' not 'foo'
|
404
|
-
#
|
405
|
-
def lookup_external_default_for(param, scope)
|
406
|
-
# Only lookup parameters for host classes
|
407
|
-
return nil unless resource_type.type == :hostclass
|
408
|
-
|
409
|
-
name = "#{resource_type.name}::#{param}"
|
410
|
-
in_global = lambda { lookup_with_databinding(name, scope) }
|
411
|
-
in_env = lambda { lookup_in_environment(name, scope) }
|
412
|
-
in_module = lambda { lookup_in_module(name, scope) }
|
413
|
-
search(in_global, in_env, in_module)
|
414
|
-
end
|
415
|
-
|
416
|
-
def search(*search_functions)
|
417
|
-
search_functions.each {|f| x = f.call(); return x unless x.nil? }
|
418
|
-
nil
|
419
|
-
end
|
420
|
-
|
421
|
-
private :lookup_external_default_for
|
422
|
-
|
423
|
-
def lookup_with_databinding(name, scope)
|
424
|
-
begin
|
425
|
-
found = false
|
426
|
-
value = catch(:no_such_key) do
|
427
|
-
v = Puppet::DataBinding.indirection.find(
|
428
|
-
name,
|
429
|
-
:environment => scope.environment.to_s,
|
430
|
-
:variables => scope)
|
431
|
-
found = true
|
432
|
-
v
|
433
|
-
end
|
434
|
-
found ? value : nil
|
435
|
-
rescue Puppet::DataBinding::LookupError => e
|
436
|
-
raise Puppet::Error.new("Error from DataBinding '#{Puppet[:data_binding_terminus]}' while looking up '#{name}': #{e.message}", e)
|
437
|
-
end
|
438
|
-
end
|
439
|
-
private :lookup_with_databinding
|
440
|
-
|
441
|
-
def lookup_in_environment(name, scope)
|
442
|
-
found = false
|
443
|
-
value = catch(:no_such_key) do
|
444
|
-
v = Puppet::DataProviders.lookup_in_environment(name, scope, nil)
|
445
|
-
found = true
|
446
|
-
v
|
447
|
-
end
|
448
|
-
found ? value : nil
|
449
|
-
end
|
450
|
-
private :lookup_in_environment
|
451
|
-
|
452
|
-
def lookup_in_module(name, scope)
|
453
|
-
found = false
|
454
|
-
value = catch(:no_such_key) do
|
455
|
-
v = Puppet::DataProviders.lookup_in_module(name, scope, nil)
|
456
|
-
found = true
|
457
|
-
v
|
458
|
-
end
|
459
|
-
found ? value : nil
|
460
|
-
end
|
461
|
-
private :lookup_in_module
|
462
|
-
|
429
|
+
# @deprecated Not used by Puppet
|
430
|
+
# @api private
|
463
431
|
def set_default_parameters(scope)
|
432
|
+
Puppet.deprecation_warning('The method Puppet::Resource.set_default_parameters is deprecated and will be removed in the next major release of Puppet.')
|
433
|
+
|
464
434
|
return [] unless resource_type and resource_type.respond_to?(:arguments)
|
465
435
|
|
466
436
|
unless is_a?(Puppet::Parser::Resource)
|
@@ -468,7 +438,9 @@ class Puppet::Resource
|
|
468
438
|
end
|
469
439
|
|
470
440
|
missing_arguments.collect do |param, default|
|
471
|
-
|
441
|
+
# Using 'send' since this private method moved from here to type. The caller method is deprecated
|
442
|
+
# and doesn't really motivate making the callee public
|
443
|
+
external_value = resource_type.send(:lookup_external_default_for, param, scope)
|
472
444
|
|
473
445
|
if external_value.nil? && default.nil?
|
474
446
|
next
|
@@ -495,7 +467,12 @@ class Puppet::Resource
|
|
495
467
|
# have been provided with defaults.
|
496
468
|
# Must be called after 'set_default_parameters'. We can't join the methods
|
497
469
|
# because Type#set_parameters needs specifically ordered behavior.
|
470
|
+
#
|
471
|
+
# @deprecated Not used by Puppet
|
472
|
+
# @api private
|
498
473
|
def validate_complete
|
474
|
+
Puppet.deprecation_warning('The method Puppet::Resource.validate_complete is deprecated and will be removed in the next major release of Puppet.')
|
475
|
+
|
499
476
|
return unless resource_type and resource_type.respond_to?(:arguments)
|
500
477
|
|
501
478
|
resource_type.arguments.each do |param, default|
|
@@ -510,14 +487,14 @@ class Puppet::Resource
|
|
510
487
|
next unless t = arg_types[name.to_s] # untyped, and parameters are symbols here (aargh, strings in the type)
|
511
488
|
unless Puppet::Pops::Types::TypeCalculator.instance?(t, value.value)
|
512
489
|
inferred_type = Puppet::Pops::Types::TypeCalculator.infer_set(value.value)
|
513
|
-
actual =
|
490
|
+
actual = inferred_type.generalize()
|
514
491
|
fail Puppet::ParseError, "Expected parameter '#{name}' of '#{self}' to have type #{t.to_s}, got #{actual.to_s}"
|
515
492
|
end
|
516
493
|
end
|
517
494
|
end
|
518
495
|
|
519
496
|
def validate_parameter(name)
|
520
|
-
raise
|
497
|
+
raise Puppet::ParseError.new("no parameter named '#{name}'", file, line) unless valid_parameter?(name)
|
521
498
|
end
|
522
499
|
|
523
500
|
def prune_parameters(options = {})
|
@@ -0,0 +1,95 @@
|
|
1
|
+
#
|
2
|
+
# A helper module to look a capability up from PuppetDB
|
3
|
+
#
|
4
|
+
# @todo lutter 2015-03-10: determine whether this should be based on
|
5
|
+
# Puppet::Pops::Evaluator::Collectors, or at least use
|
6
|
+
# Puppet::Util::Puppetdb::Http
|
7
|
+
|
8
|
+
require 'net/http'
|
9
|
+
require 'cgi'
|
10
|
+
require 'json'
|
11
|
+
|
12
|
+
# @api private
|
13
|
+
module Puppet::Resource::CapabilityFinder
|
14
|
+
|
15
|
+
# Looks the capability resource from PuppetDB.
|
16
|
+
# @param environment [String] environment name
|
17
|
+
# @param code_id [String,nil] code_id of the catalog
|
18
|
+
# @param cap [Puppet::Type] the capability resource type instance
|
19
|
+
# @return [Puppet::Resource,nil] The found capability resource or `nil` if it could not be found
|
20
|
+
def self.find(environment, code_id, cap)
|
21
|
+
unless Puppet::Util.const_defined?('Puppetdb')
|
22
|
+
raise Puppet::DevError, 'PuppetDB is not available'
|
23
|
+
end
|
24
|
+
|
25
|
+
query_terms = [
|
26
|
+
'and',
|
27
|
+
['=', 'type', cap.type.capitalize],
|
28
|
+
['=', 'title', cap.title.to_s],
|
29
|
+
['=', 'tag', "producer:#{environment}"]
|
30
|
+
]
|
31
|
+
|
32
|
+
unless code_id.nil?
|
33
|
+
query_terms << ['in', 'certname',
|
34
|
+
['extract', 'certname',
|
35
|
+
['select_catalogs',
|
36
|
+
['=', 'code_id', code_id]]]]
|
37
|
+
end
|
38
|
+
query = query_terms.to_json
|
39
|
+
|
40
|
+
Puppet.notice "Capability lookup #{cap}]: #{query}"
|
41
|
+
|
42
|
+
http = Puppet::Util.const_get('Puppetdb').const_get('Http')
|
43
|
+
response = http.action("/pdb/query/v4/resources?query=#{CGI.escape(query)}") do |conn, uri|
|
44
|
+
conn.get(uri, { 'Accept' => 'application/json'})
|
45
|
+
end
|
46
|
+
json = response.body
|
47
|
+
|
48
|
+
# The format of the response body is documented at
|
49
|
+
# http://docs.puppetlabs.com/puppetdb/3.0/api/query/v4/resources.html#response-format
|
50
|
+
# In a nutshell, we expect to get an array of resources back. If the
|
51
|
+
# array is empty, the lookup failed and we return +nil+, if it
|
52
|
+
# contains exactly one, we turn that resource back into a Puppet
|
53
|
+
# ::Resource. If the array contains more than one entry, we have a
|
54
|
+
# bug in the overall system, as we allowed multiple capabilities with
|
55
|
+
# the same type and title to be produced in this environment.
|
56
|
+
begin
|
57
|
+
data = JSON.parse(json)
|
58
|
+
rescue JSON::JSONError => e
|
59
|
+
raise Puppet::DevError,
|
60
|
+
"Invalid JSON from PuppetDB when looking up #{cap}\n#{e}\nRaw JSON was:\n#{json}"
|
61
|
+
end
|
62
|
+
unless data.is_a?(Array)
|
63
|
+
raise Puppet::DevError,
|
64
|
+
"Unexpected response from PuppetDB when looking up #{cap}: " +
|
65
|
+
"expected an Array but got #{data.inspect}"
|
66
|
+
end
|
67
|
+
if data.size > 1
|
68
|
+
raise Puppet::DevError,
|
69
|
+
"Unexpected response from PuppetDB when looking up #{cap}:\n" +
|
70
|
+
"expected exactly one resource but got #{data.size};\n" +
|
71
|
+
"returned data is:\n#{data.inspect}"
|
72
|
+
end
|
73
|
+
|
74
|
+
unless data.empty?
|
75
|
+
resource_hash = data.first
|
76
|
+
resource = Puppet::Resource.new(resource_hash['type'],
|
77
|
+
resource_hash['title'])
|
78
|
+
real_type = Puppet::Type.type(resource.type)
|
79
|
+
if real_type.nil?
|
80
|
+
fail Puppet::ParseError,
|
81
|
+
"Could not find resource type #{resource.type} returned from PuppetDB"
|
82
|
+
end
|
83
|
+
real_type.parameters.each do |param|
|
84
|
+
param = param.to_s
|
85
|
+
next if param == 'name'
|
86
|
+
if value = resource_hash['parameters'][param]
|
87
|
+
resource[param] = value
|
88
|
+
else
|
89
|
+
Puppet.debug "No capability value for #{resource}->#{param}"
|
90
|
+
end
|
91
|
+
end
|
92
|
+
return resource
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
@@ -4,6 +4,8 @@ require 'puppet/transaction'
|
|
4
4
|
require 'puppet/util/tagging'
|
5
5
|
require 'puppet/graph'
|
6
6
|
|
7
|
+
require 'puppet/resource/capability_finder'
|
8
|
+
|
7
9
|
# This class models a node catalog. It is the thing meant to be passed
|
8
10
|
# from server to client, and it contains all of the information in the
|
9
11
|
# catalog, including the resources and the relationships between them.
|
@@ -27,6 +29,9 @@ class Puppet::Resource::Catalog < Puppet::Graph::SimpleGraph
|
|
27
29
|
# is up to date.
|
28
30
|
attr_accessor :version
|
29
31
|
|
32
|
+
# The id of the code input to the compiler.
|
33
|
+
attr_accessor :code_id
|
34
|
+
|
30
35
|
# How long this catalog took to retrieve. Used for reporting stats.
|
31
36
|
attr_accessor :retrieval_duration
|
32
37
|
|
@@ -71,6 +76,25 @@ class Puppet::Resource::Catalog < Puppet::Graph::SimpleGraph
|
|
71
76
|
return a
|
72
77
|
end
|
73
78
|
|
79
|
+
def add_resource_before(other, *resources)
|
80
|
+
resources.each do |resource|
|
81
|
+
other_title_key = title_key_for_ref(other.ref)
|
82
|
+
idx = @resources.index(other_title_key)
|
83
|
+
raise ArgumentError, "Cannot add resource #{resource.ref} before #{other.ref} because #{other.ref} is not yet in the catalog" if idx.nil?
|
84
|
+
add_one_resource(resource, idx)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
def add_resource_after(other, *resources)
|
89
|
+
resources.each do |resource|
|
90
|
+
other_title_key = title_key_for_ref(other.ref)
|
91
|
+
idx = @resources.index(other_title_key)
|
92
|
+
raise ArgumentError, "Cannot add resource #{resource.ref} after #{other.ref} because #{other.ref} is not yet in the catalog" if idx.nil?
|
93
|
+
add_one_resource(resource, idx+1)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
|
74
98
|
def add_resource(*resources)
|
75
99
|
resources.each do |resource|
|
76
100
|
add_one_resource(resource)
|
@@ -84,13 +108,13 @@ class Puppet::Resource::Catalog < Puppet::Graph::SimpleGraph
|
|
84
108
|
adjacent(resource, :direction => :in)[0]
|
85
109
|
end
|
86
110
|
|
87
|
-
def add_one_resource(resource)
|
111
|
+
def add_one_resource(resource, idx=-1)
|
88
112
|
title_key = title_key_for_ref(resource.ref)
|
89
113
|
if @resource_table[title_key]
|
90
114
|
fail_on_duplicate_type_and_title(resource, title_key)
|
91
115
|
end
|
92
116
|
|
93
|
-
add_resource_to_table(resource, title_key)
|
117
|
+
add_resource_to_table(resource, title_key, idx)
|
94
118
|
create_resource_aliases(resource)
|
95
119
|
|
96
120
|
resource.catalog = self if resource.respond_to?(:catalog=)
|
@@ -98,9 +122,9 @@ class Puppet::Resource::Catalog < Puppet::Graph::SimpleGraph
|
|
98
122
|
end
|
99
123
|
private :add_one_resource
|
100
124
|
|
101
|
-
def add_resource_to_table(resource, title_key)
|
125
|
+
def add_resource_to_table(resource, title_key, idx)
|
102
126
|
@resource_table[title_key] = resource
|
103
|
-
@resources
|
127
|
+
@resources.insert(idx, title_key)
|
104
128
|
end
|
105
129
|
private :add_resource_to_table
|
106
130
|
|
@@ -245,7 +269,7 @@ class Puppet::Resource::Catalog < Puppet::Graph::SimpleGraph
|
|
245
269
|
host_config
|
246
270
|
end
|
247
271
|
|
248
|
-
def initialize(name = nil, environment = Puppet::Node::Environment::NONE)
|
272
|
+
def initialize(name = nil, environment = Puppet::Node::Environment::NONE, code_id = nil)
|
249
273
|
super()
|
250
274
|
@name = name
|
251
275
|
@classes = []
|
@@ -256,6 +280,7 @@ class Puppet::Resource::Catalog < Puppet::Graph::SimpleGraph
|
|
256
280
|
@host_config = true
|
257
281
|
@environment_instance = environment
|
258
282
|
@environment = environment.to_s
|
283
|
+
@code_id = code_id
|
259
284
|
|
260
285
|
@aliases = {}
|
261
286
|
|
@@ -293,7 +318,8 @@ class Puppet::Resource::Catalog < Puppet::Graph::SimpleGraph
|
|
293
318
|
remove_vertex!(resource) if vertex?(resource)
|
294
319
|
@relationship_graph.remove_vertex!(resource) if @relationship_graph and @relationship_graph.vertex?(resource)
|
295
320
|
@resources.delete(title_key)
|
296
|
-
|
321
|
+
# Only Puppet::Type kind of resources respond to :remove, not Puppet::Resource
|
322
|
+
resource.remove if resource.respond_to?(:remove)
|
297
323
|
end
|
298
324
|
end
|
299
325
|
|
@@ -313,7 +339,15 @@ class Puppet::Resource::Catalog < Puppet::Graph::SimpleGraph
|
|
313
339
|
res.catalog = self
|
314
340
|
title_key = [res.type, res.title.to_s]
|
315
341
|
uniqueness_key = [res.type, res.uniqueness_key].flatten
|
316
|
-
@resource_table[title_key] || @resource_table[uniqueness_key]
|
342
|
+
result = @resource_table[title_key] || @resource_table[uniqueness_key]
|
343
|
+
if ! result && res.resource_type && res.resource_type.is_capability?
|
344
|
+
# @todo lutter 2015-03-10: this assumes that it is legal to just
|
345
|
+
# mention a capability resource in code and have it automatically
|
346
|
+
# made available, even if the current component does not require it
|
347
|
+
result = Puppet::Resource::CapabilityFinder.find(environment, code_id, res)
|
348
|
+
add_resource(result) if result
|
349
|
+
end
|
350
|
+
result
|
317
351
|
end
|
318
352
|
|
319
353
|
def resource_refs
|
@@ -341,6 +375,10 @@ class Puppet::Resource::Catalog < Puppet::Graph::SimpleGraph
|
|
341
375
|
result.version = version
|
342
376
|
end
|
343
377
|
|
378
|
+
if code_id = data['code_id']
|
379
|
+
result.code_id = code_id
|
380
|
+
end
|
381
|
+
|
344
382
|
if environment = data['environment']
|
345
383
|
result.environment = environment
|
346
384
|
result.environment_instance = Puppet::Node::Environment.remote(environment.to_sym)
|
@@ -381,6 +419,7 @@ class Puppet::Resource::Catalog < Puppet::Graph::SimpleGraph
|
|
381
419
|
'tags' => tags,
|
382
420
|
'name' => name,
|
383
421
|
'version' => version,
|
422
|
+
'code_id' => code_id,
|
384
423
|
'environment' => environment.to_s,
|
385
424
|
'resources' => @resources.collect { |v| @resource_table[v].to_data_hash },
|
386
425
|
'edges' => edges. collect { |e| e.to_data_hash },
|
@@ -496,6 +535,7 @@ class Puppet::Resource::Catalog < Puppet::Graph::SimpleGraph
|
|
496
535
|
result = self.class.new(self.name, self.environment_instance)
|
497
536
|
|
498
537
|
result.version = self.version
|
538
|
+
result.code_id = self.code_id
|
499
539
|
|
500
540
|
map = {}
|
501
541
|
resources.each do |resource|
|