puppet 4.2.3-x86-mingw32 → 4.3.0-x86-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
@@ -0,0 +1,356 @@
|
|
1
|
+
require 'puppet/application'
|
2
|
+
require 'puppet/pops'
|
3
|
+
require 'puppet/node'
|
4
|
+
require 'puppet/parser/compiler'
|
5
|
+
|
6
|
+
class Puppet::Application::Lookup < Puppet::Application
|
7
|
+
|
8
|
+
RUN_HELP = "Run 'puppet lookup --help' for more details".freeze
|
9
|
+
DEEP_MERGE_OPTIONS = '--knock-out-prefix, --sort-merged-arrays, --unpack-arrays, and --merge-hash-arrays'.freeze
|
10
|
+
|
11
|
+
run_mode :master
|
12
|
+
|
13
|
+
# Options for lookup
|
14
|
+
option('--merge TYPE') do |arg|
|
15
|
+
if %w{unique hash deep}.include?(arg)
|
16
|
+
options[:merge] = arg
|
17
|
+
else
|
18
|
+
raise "The --merge option only accepts 'unique', 'hash', or 'deep'.\n#{RUN_HELP}"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
option('--debug', '-d')
|
23
|
+
|
24
|
+
option('--verbose', '-v')
|
25
|
+
|
26
|
+
option('--render-as FORMAT') do |format|
|
27
|
+
options[:render_as] = format.downcase.to_sym
|
28
|
+
end
|
29
|
+
|
30
|
+
option('--type TYPE_STRING') do |arg|
|
31
|
+
options[:type] = arg
|
32
|
+
end
|
33
|
+
|
34
|
+
option('--knock-out-prefix PREFIX_STRING') do |arg|
|
35
|
+
options[:prefix] = arg
|
36
|
+
end
|
37
|
+
|
38
|
+
option('--sort-merge-arrays')
|
39
|
+
|
40
|
+
option('--unpack-arrays') do |arg|
|
41
|
+
options[:unpack_arrays] = arg
|
42
|
+
end
|
43
|
+
|
44
|
+
option('--merge-hash-arrays')
|
45
|
+
|
46
|
+
option('--explain')
|
47
|
+
|
48
|
+
option('--default VALUE') do |arg|
|
49
|
+
options[:default_value] = arg
|
50
|
+
end
|
51
|
+
|
52
|
+
# not yet supported
|
53
|
+
option('--trusted')
|
54
|
+
|
55
|
+
# Options for facts/scope
|
56
|
+
option('--node NODE_NAME') do |arg|
|
57
|
+
options[:node] = arg
|
58
|
+
end
|
59
|
+
|
60
|
+
option('--facts FACT_FILE') do |arg|
|
61
|
+
if %w{.yaml .yml .json}.include?(arg.match(/\.[^.]*$/)[0])
|
62
|
+
options[:fact_file] = arg
|
63
|
+
else
|
64
|
+
raise "The --fact file only accepts yaml and json files.\n#{RUN_HELP}"
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
# Sets up the 'node_cache_terminus' default to use the Write Only Yaml terminus :write_only_yaml.
|
69
|
+
# If this is not wanted, the setting ´node_cache_terminus´ should be set to nil.
|
70
|
+
# @see Puppet::Node::WriteOnlyYaml
|
71
|
+
# @see #setup_node_cache
|
72
|
+
# @see puppet issue 16753
|
73
|
+
#
|
74
|
+
def app_defaults
|
75
|
+
super.merge({
|
76
|
+
:node_cache_terminus => :write_only_yaml,
|
77
|
+
:facts_terminus => 'yaml'
|
78
|
+
})
|
79
|
+
end
|
80
|
+
|
81
|
+
def setup_logs
|
82
|
+
# This sets up logging based on --debug or --verbose if they are set in `options`
|
83
|
+
set_log_level
|
84
|
+
|
85
|
+
# This uses console for everything that is not a compilation
|
86
|
+
Puppet::Util::Log.newdestination(:console)
|
87
|
+
end
|
88
|
+
|
89
|
+
def setup_terminuses
|
90
|
+
require 'puppet/file_serving/content'
|
91
|
+
require 'puppet/file_serving/metadata'
|
92
|
+
|
93
|
+
Puppet::FileServing::Content.indirection.terminus_class = :file_server
|
94
|
+
Puppet::FileServing::Metadata.indirection.terminus_class = :file_server
|
95
|
+
|
96
|
+
Puppet::FileBucket::File.indirection.terminus_class = :file
|
97
|
+
end
|
98
|
+
|
99
|
+
def setup_ssl
|
100
|
+
# Configure all of the SSL stuff.
|
101
|
+
if Puppet::SSL::CertificateAuthority.ca?
|
102
|
+
Puppet::SSL::Host.ca_location = :local
|
103
|
+
Puppet.settings.use :ca
|
104
|
+
Puppet::SSL::CertificateAuthority.instance
|
105
|
+
else
|
106
|
+
Puppet::SSL::Host.ca_location = :none
|
107
|
+
end
|
108
|
+
# These lines are not on stable (seems like a copy was made from master)
|
109
|
+
#
|
110
|
+
# Puppet::SSL::Oids.register_puppet_oids
|
111
|
+
# Puppet::SSL::Oids.load_custom_oid_file(Puppet[:trusted_oid_mapping_file])
|
112
|
+
end
|
113
|
+
|
114
|
+
# Sets up a special node cache "write only yaml" that collects and stores node data in yaml
|
115
|
+
# but never finds or reads anything (this since a real cache causes stale data to be served
|
116
|
+
# in circumstances when the cache can not be cleared).
|
117
|
+
# @see puppet issue 16753
|
118
|
+
# @see Puppet::Node::WriteOnlyYaml
|
119
|
+
# @return [void]
|
120
|
+
def setup_node_cache
|
121
|
+
Puppet::Node.indirection.cache_class = Puppet[:node_cache_terminus]
|
122
|
+
end
|
123
|
+
|
124
|
+
def setup
|
125
|
+
setup_logs
|
126
|
+
|
127
|
+
exit(Puppet.settings.print_configs ? 0 : 1) if Puppet.settings.print_configs?
|
128
|
+
|
129
|
+
Puppet.settings.use :main, :master, :ssl, :metrics
|
130
|
+
|
131
|
+
setup_terminuses
|
132
|
+
|
133
|
+
# TODO: Do we need this in lookup? It sets up a write only cache
|
134
|
+
setup_node_cache
|
135
|
+
|
136
|
+
setup_ssl
|
137
|
+
end
|
138
|
+
|
139
|
+
def help
|
140
|
+
<<-'HELP'
|
141
|
+
|
142
|
+
puppet-lookup(8) -- Data in modules lookup function
|
143
|
+
========
|
144
|
+
|
145
|
+
SYNOPSIS
|
146
|
+
--------
|
147
|
+
The lookup command is used for debugging and testing a given data
|
148
|
+
configuration. For a given data key, lookup will produce either a
|
149
|
+
value or an explanation of how that value was obtained on the standard
|
150
|
+
output stream with the specified rendering format. Lookup is designed
|
151
|
+
to be run on a puppet master or a node in a masterless setup.
|
152
|
+
|
153
|
+
USAGE
|
154
|
+
-----
|
155
|
+
puppet lookup [--help] [--type <TYPESTRING>] [--merge unique|hash|deep]
|
156
|
+
[--knock-out-prefix <PREFIX-STRING>] [--sort-merged-arrays]
|
157
|
+
[--unpack-arrays <STRING-VALUE>] [--merge-hash-arrays] [--explain]
|
158
|
+
[--default <VALUE>] [--node <NODE-NAME>] [--facts <FILE>]
|
159
|
+
[--render-as s|json|yaml|binary|msgpack] <keys>
|
160
|
+
|
161
|
+
DESCRIPTION
|
162
|
+
-----------
|
163
|
+
The lookup command is a CLI interface for the puppet lookup function.
|
164
|
+
When given one or more keys, the lookup command will return the first
|
165
|
+
value found when run from the puppet master or a masterless node.
|
166
|
+
|
167
|
+
When an explanation has not been requested and
|
168
|
+
lookup is simply looking up a value, the application will exit with 0
|
169
|
+
if a value was found and 1 otherwise. When an explanation is requested,
|
170
|
+
lookup will always exit with 0 unless there is a major error.
|
171
|
+
|
172
|
+
The other options are as passed into the lookup function, and the effect
|
173
|
+
they have on the lookup is described in more detail in the header
|
174
|
+
for the lookup function:
|
175
|
+
|
176
|
+
http://links.puppetlabs.com/lookup-docs
|
177
|
+
|
178
|
+
OPTIONS
|
179
|
+
-------
|
180
|
+
These options and their effects are decribed in more detail in
|
181
|
+
the puppet lookup function linked to above.
|
182
|
+
|
183
|
+
* --help:
|
184
|
+
Print this help message.
|
185
|
+
|
186
|
+
* --type <TYPESTRING>:
|
187
|
+
Assert that the value has the specified type.
|
188
|
+
|
189
|
+
* --merge unique|hash|deep:
|
190
|
+
Specify the merge strategy. 'hash' performs a simple hash-merge by
|
191
|
+
overwriting keys of lower lookup priority. 'unique' appends everything
|
192
|
+
to an array containing no nested arrays and where all duplicates have been
|
193
|
+
removed. 'deep' Performs a deep merge on values of Array and Hash type. There
|
194
|
+
are additional option flags that can be used with 'deep'.
|
195
|
+
|
196
|
+
* --knock_out_prefix <PREFIX-STRING>
|
197
|
+
Can be used with the 'deep' merge strategy. Specify string value to signify
|
198
|
+
prefix which deletes elements from existing element.
|
199
|
+
|
200
|
+
* --sort_merged_arrays
|
201
|
+
Can be used with the 'deep' merge strategy. When this flag is used all
|
202
|
+
merged arrays will be sorted.
|
203
|
+
|
204
|
+
* --unpack_arrays <STRING-VALUE>
|
205
|
+
Can be used with the 'deep' merge strategy. Specify a string value used
|
206
|
+
as a deliminator to join all array values and then split them again.
|
207
|
+
|
208
|
+
* --merge_hash_arrays
|
209
|
+
Can be used with the 'deep' merge strategy. When this flag is used arrays
|
210
|
+
and hashes will be merged.
|
211
|
+
|
212
|
+
* --explain
|
213
|
+
Print an explanation for the details of how the lookup performed rather
|
214
|
+
than the value returned for the key. The explaination will describe how
|
215
|
+
the result was obtained or why lookup failed to obtain the result.
|
216
|
+
|
217
|
+
* --default <VALUE>
|
218
|
+
A value produced if no value was found in the lookup.
|
219
|
+
|
220
|
+
* --node <NODE-NAME>
|
221
|
+
Specify node which defines the scope in which the lookup will be performed.
|
222
|
+
If a node is not given, lookup will default to the machine from which the
|
223
|
+
lookup is being run (which should be the master).
|
224
|
+
|
225
|
+
* --facts <FILE>
|
226
|
+
Specify a .json, or .yaml file holding key => value mappings that will
|
227
|
+
override the facts for the current node. Any facts not specified by the
|
228
|
+
user will maintain their original value.
|
229
|
+
|
230
|
+
* --render-as s|json|yaml|binary|msgpack
|
231
|
+
Determines how the results will be rendered to the standard output where
|
232
|
+
s means plain text. The default when lookup is producing a value is yaml
|
233
|
+
and the default when producing an explanation is s.
|
234
|
+
|
235
|
+
EXAMPLE
|
236
|
+
-------
|
237
|
+
If you wanted to lookup 'key_name' within the scope of the master, you would
|
238
|
+
call lookup like this:
|
239
|
+
$ puppet lookup key_name
|
240
|
+
|
241
|
+
If you wanted to lookup 'key_name' within the scope of the agent.local node,
|
242
|
+
you would call lookup like this:
|
243
|
+
$ puppet lookup --node agent.local key_name
|
244
|
+
|
245
|
+
If you wanted to get the first value found for 'key_name_one' and 'key_name_two'
|
246
|
+
within the scope of the agent.local node while merging values and knocking out
|
247
|
+
the prefix 'foo' while merging, you would call lookup like this:
|
248
|
+
$ puppet lookup --node agent.local --merge deep --knock_out_prefix foo key_name_one key_name_two
|
249
|
+
|
250
|
+
If you wanted to lookup 'key_name' within the scope of the agent.local node,
|
251
|
+
and return a default value of 'bar' if nothing was found, you would call
|
252
|
+
lookup like this:
|
253
|
+
$ puppet lookup --node agent.local --default bar key_name
|
254
|
+
|
255
|
+
If you wanted to see an explanation of how the value for 'key_name' would be
|
256
|
+
obtained in the context of the agent.local node, you would call lookup like this:
|
257
|
+
$ puppet lookup --node agent.local --explain key_name
|
258
|
+
|
259
|
+
COPYRIGHT
|
260
|
+
---------
|
261
|
+
Copyright (c) 2015 Puppet Labs, LLC Licensed under the Apache 2.0 License
|
262
|
+
|
263
|
+
|
264
|
+
HELP
|
265
|
+
end
|
266
|
+
|
267
|
+
def main
|
268
|
+
keys = command_line.args
|
269
|
+
raise 'No keys were given to lookup.' if keys.empty?
|
270
|
+
|
271
|
+
#unless options[:node]
|
272
|
+
# raise "No node was given via the '--node' flag for the scope of the lookup.\n#{RUN_HELP}"
|
273
|
+
#end
|
274
|
+
|
275
|
+
if (options[:sort_merge_arrays] || options[:merge_hash_arrays] || options[:prefix] || options[:unpack_arrays]) && options[:merge] != 'deep'
|
276
|
+
raise "The options #{DEEP_MERGE_OPTIONS} are only available with '--merge deep'\n#{RUN_HELP}"
|
277
|
+
end
|
278
|
+
|
279
|
+
use_default_value = !options[:default_value].nil?
|
280
|
+
merge_options = nil
|
281
|
+
|
282
|
+
if options[:merge]
|
283
|
+
if options[:merge] == 'deep'
|
284
|
+
merge_options = {'strategy' => 'deep',
|
285
|
+
'sort_merge_arrays' => !options[:sort_merge_arrays].nil?,
|
286
|
+
'merge_hash_arrays' => !options[:merge_hash_arrays].nil?}
|
287
|
+
|
288
|
+
if options[:prefix]
|
289
|
+
merge_options.merge({'prefix' => options[:prefix]})
|
290
|
+
end
|
291
|
+
|
292
|
+
if options[:unpack_arrays]
|
293
|
+
merge_options.merge({'unpack_arrays' => options[:unpack_arrays]})
|
294
|
+
end
|
295
|
+
|
296
|
+
else
|
297
|
+
merge_options = {'strategy' => options[:merge]}
|
298
|
+
end
|
299
|
+
end
|
300
|
+
|
301
|
+
explain = !!options[:explain]
|
302
|
+
|
303
|
+
# Format defaults to text (:s) when producing an explanation and :yaml when producing the value
|
304
|
+
format = options[:render_as] || (explain ? :s : :yaml)
|
305
|
+
renderer = Puppet::Network::FormatHandler.format(format == :json ? :pson : format)
|
306
|
+
raise "Unknown rendering format '#{format}'" if renderer.nil?
|
307
|
+
|
308
|
+
type = options.include?(:type) ? Puppet::Pops::Types::TypeParser.new.parse(options[:type]) : nil
|
309
|
+
|
310
|
+
generate_scope do |scope|
|
311
|
+
lookup_invocation = Puppet::Pops::Lookup::Invocation.new(scope, {}, {}, explain)
|
312
|
+
begin
|
313
|
+
result = Puppet::Pops::Lookup.lookup(keys, type, options[:default_value], use_default_value, merge_options, lookup_invocation)
|
314
|
+
puts renderer.render(result) unless explain
|
315
|
+
rescue Puppet::DataBinding::LookupError
|
316
|
+
exit(1) unless explain
|
317
|
+
end
|
318
|
+
puts format == :s ? lookup_invocation.explainer.to_s : renderer.render(lookup_invocation.explainer.to_hash) if explain
|
319
|
+
end
|
320
|
+
end
|
321
|
+
|
322
|
+
def generate_scope
|
323
|
+
if options[:node]
|
324
|
+
node = options[:node]
|
325
|
+
else
|
326
|
+
node = Puppet[:node_name_value]
|
327
|
+
|
328
|
+
# If we want to lookup the node we are currently on
|
329
|
+
# we must returning these settings to their default values
|
330
|
+
Puppet.settings[:facts_terminus] = 'facter'
|
331
|
+
Puppet.settings[:node_cache_terminus] = nil
|
332
|
+
end
|
333
|
+
|
334
|
+
node = Puppet::Node.indirection.find(node) unless node.is_a?(Puppet::Node) # to allow unit tests to pass a node instance
|
335
|
+
|
336
|
+
fact_file = options[:fact_file]
|
337
|
+
|
338
|
+
if fact_file
|
339
|
+
original_facts = node.facts.values
|
340
|
+
if fact_file.end_with?("json")
|
341
|
+
given_facts = JSON.parse(File.read(fact_file))
|
342
|
+
else
|
343
|
+
given_facts = YAML.load(File.read(fact_file))
|
344
|
+
end
|
345
|
+
|
346
|
+
unless given_facts.instance_of?(Hash)
|
347
|
+
raise "Incorrect formatted data in #{fact_file} given via the --facts flag"
|
348
|
+
end
|
349
|
+
|
350
|
+
node.facts.values = original_facts.merge(given_facts)
|
351
|
+
end
|
352
|
+
|
353
|
+
compiler = Puppet::Parser::Compiler.new(node)
|
354
|
+
compiler.compile { |catalog| yield(compiler.topscope); catalog }
|
355
|
+
end
|
356
|
+
end
|
@@ -295,6 +295,9 @@ Copyright (c) 2012 Puppet Labs, LLC Licensed under the Apache 2.0 License
|
|
295
295
|
daemon.server = Puppet::Network::Server.new(Puppet[:bindaddress], Puppet[:masterport])
|
296
296
|
daemon.daemonize if Puppet[:daemonize]
|
297
297
|
|
298
|
+
# Setup signal traps immediately after daemonization so we clean up the daemon
|
299
|
+
daemon.set_signal_traps
|
300
|
+
|
298
301
|
announce_start_of_master
|
299
302
|
|
300
303
|
daemon.start
|
data/lib/puppet/configurer.rb
CHANGED
@@ -154,12 +154,14 @@ class Puppet::Configurer
|
|
154
154
|
query_options = get_facts(options)
|
155
155
|
end
|
156
156
|
|
157
|
+
configured_environment = Puppet[:environment] if Puppet.settings.set_by_config?(:environment)
|
158
|
+
|
157
159
|
# We only need to find out the environment to run in if we don't already have a catalog
|
158
160
|
unless options[:catalog]
|
159
161
|
begin
|
160
162
|
if node = Puppet::Node.indirection.find(Puppet[:node_name_value],
|
161
163
|
:environment => Puppet::Node::Environment.remote(@environment),
|
162
|
-
:configured_environment =>
|
164
|
+
:configured_environment => configured_environment,
|
163
165
|
:ignore_cache => true,
|
164
166
|
:transaction_uuid => @transaction_uuid,
|
165
167
|
:fail_on_404 => true)
|
@@ -171,10 +173,12 @@ class Puppet::Configurer
|
|
171
173
|
end
|
172
174
|
|
173
175
|
if node.environment.to_s != @environment
|
174
|
-
Puppet.notice "Local environment:
|
176
|
+
Puppet.notice "Local environment: '#{@environment}' doesn't match server specified node environment '#{node.environment}', switching agent to '#{node.environment}'."
|
175
177
|
@environment = node.environment.to_s
|
176
178
|
report.environment = @environment
|
177
179
|
query_options = nil
|
180
|
+
else
|
181
|
+
Puppet.info "Using configured environment '#{@environment}'"
|
178
182
|
end
|
179
183
|
end
|
180
184
|
rescue StandardError => detail
|
@@ -197,7 +201,7 @@ class Puppet::Configurer
|
|
197
201
|
|
198
202
|
query_options = get_facts(options) unless query_options
|
199
203
|
query_options[:transaction_uuid] = @transaction_uuid
|
200
|
-
query_options[:configured_environment] =
|
204
|
+
query_options[:configured_environment] = configured_environment
|
201
205
|
|
202
206
|
unless catalog = prepare_and_retrieve_catalog(options, query_options)
|
203
207
|
return nil
|
@@ -212,13 +216,13 @@ class Puppet::Configurer
|
|
212
216
|
if tries > 3
|
213
217
|
raise Puppet::Error, "Catalog environment didn't stabilize after #{tries} fetches, aborting run"
|
214
218
|
end
|
215
|
-
Puppet.notice "Local environment:
|
219
|
+
Puppet.notice "Local environment: '#{@environment}' doesn't match server specified environment '#{catalog.environment}', restarting agent run with environment '#{catalog.environment}'"
|
216
220
|
@environment = catalog.environment
|
217
221
|
report.environment = @environment
|
218
222
|
|
219
223
|
query_options = get_facts(options)
|
220
224
|
query_options[:transaction_uuid] = @transaction_uuid
|
221
|
-
query_options[:configured_environment] =
|
225
|
+
query_options[:configured_environment] = configured_environment
|
222
226
|
|
223
227
|
return nil unless catalog = prepare_and_retrieve_catalog(options, query_options)
|
224
228
|
tries += 1
|
data/lib/puppet/context.rb
CHANGED
@@ -20,6 +20,7 @@ class Puppet::Context
|
|
20
20
|
# @api private
|
21
21
|
def initialize(initial_bindings)
|
22
22
|
@table = initial_bindings
|
23
|
+
@ignores = []
|
23
24
|
@description = "root"
|
24
25
|
@id = 0
|
25
26
|
@rollbacks = {}
|
@@ -45,7 +46,7 @@ class Puppet::Context
|
|
45
46
|
|
46
47
|
# @api private
|
47
48
|
def lookup(name, &block)
|
48
|
-
if @table.include?(name)
|
49
|
+
if @table.include?(name) && !@ignores.include?(name)
|
49
50
|
value = @table[name]
|
50
51
|
value.is_a?(Proc) ? (@table[name] = value.call) : value
|
51
52
|
elsif block
|
@@ -66,6 +67,20 @@ class Puppet::Context
|
|
66
67
|
rollback(mark_point)
|
67
68
|
end
|
68
69
|
|
70
|
+
# @api private
|
71
|
+
def ignore(name)
|
72
|
+
@ignores << name
|
73
|
+
end
|
74
|
+
|
75
|
+
# @api private
|
76
|
+
def restore(name)
|
77
|
+
if @ignores.include?(name)
|
78
|
+
@ignores.delete(name)
|
79
|
+
else
|
80
|
+
raise UndefinedBindingError, "no '#{name}' in ignores #{@ignores.inspect} at top of #{@stack.inspect}"
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
69
84
|
# Mark a place on the context stack to later return to with {rollback}.
|
70
85
|
#
|
71
86
|
# @param name [Object] The identifier for the mark
|