puppet 4.2.0 → 4.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CONTRIBUTING.md +1 -1
- data/Gemfile +5 -7
- data/README.md +1 -1
- data/Rakefile +20 -0
- data/ext/debian/puppet.init +0 -1
- data/ext/debian/puppet.logrotate +14 -5
- data/ext/osx/puppet.plist +2 -4
- data/ext/project_data.yaml +1 -1
- data/ext/redhat/client.init +65 -12
- data/ext/redhat/logrotate +15 -3
- data/ext/redhat/puppet.spec.erb +5 -1
- data/ext/redhat/server.init +1 -1
- data/ext/solaris/smf/puppet +44 -0
- data/ext/solaris/smf/puppet.xml +44 -0
- data/ext/suse/client.init +27 -27
- data/ext/suse/server.init +2 -2
- data/ext/systemd/puppet.service +1 -0
- data/install.rb +21 -39
- data/lib/hiera/puppet_function.rb +5 -5
- data/lib/puppet/agent/locker.rb +11 -2
- data/lib/puppet/agent.rb +4 -4
- data/lib/puppet/application/agent.rb +28 -14
- data/lib/puppet/application/apply.rb +17 -4
- data/lib/puppet/application/cert.rb +16 -0
- data/lib/puppet/application/filebucket.rb +78 -4
- data/lib/puppet/application/lookup.rb +356 -0
- data/lib/puppet/application/master.rb +5 -1
- data/lib/puppet/configurer.rb +9 -5
- data/lib/puppet/context/trusted_information.rb +21 -1
- data/lib/puppet/context.rb +16 -1
- data/lib/puppet/daemon.rb +17 -13
- data/lib/puppet/data_binding.rb +4 -2
- 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/data_providers.rb +12 -13
- data/lib/puppet/defaults.rb +14 -3
- data/lib/puppet/environments.rb +94 -6
- 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/file_system/windows.rb +3 -1
- 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/epp.rb +29 -37
- data/lib/puppet/functions/filter.rb +60 -25
- 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 +77 -4
- data/lib/puppet/functions/inline_epp.rb +44 -71
- 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/functions.rb +2 -4
- 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/indirection.rb +6 -1
- 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/class_information_service.rb +111 -0
- data/lib/puppet/info_service.rb +7 -0
- data/lib/puppet/module_tool/applications/unpacker.rb +1 -1
- 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/module_tool/skeleton/templates/generator/manifests/init.pp.erb +25 -18
- data/lib/puppet/network/authconfig.rb +21 -1
- data/lib/puppet/network/authorization.rb +8 -1
- data/lib/puppet/network/http/api/master/v3/environment.rb +59 -0
- data/lib/puppet/network/http/api/master/v3.rb +7 -1
- data/lib/puppet/node/environment.rb +9 -2
- data/lib/puppet/node.rb +11 -5
- data/lib/puppet/parser/ast/pops_bridge.rb +39 -1
- 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/compiler/catalog_validator.rb +33 -0
- data/lib/puppet/parser/compiler.rb +300 -12
- 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/epp.rb +29 -37
- 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/inline_epp.rb +35 -60
- data/lib/puppet/parser/functions/inline_template.rb +2 -2
- 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 +103 -21
- data/lib/puppet/parser.rb +3 -0
- data/lib/puppet/plugins/configuration.rb +3 -2
- data/lib/puppet/plugins/data_providers/data_provider.rb +283 -0
- data/lib/puppet/plugins/data_providers/registry.rb +84 -0
- data/lib/puppet/plugins/data_providers.rb +12 -60
- 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 +10 -6
- 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 +11 -3
- data/lib/puppet/pops/label_provider.rb +1 -1
- data/lib/puppet/pops/lookup/explainer.rb +402 -0
- data/lib/puppet/pops/lookup/invocation.rb +117 -0
- data/lib/puppet/pops/lookup.rb +25 -47
- data/lib/puppet/pops/merge_strategy.rb +73 -5
- data/lib/puppet/pops/model/factory.rb +38 -3
- data/lib/puppet/pops/model/model_label_provider.rb +10 -1
- data/lib/puppet/pops/model/model_meta.rb +19 -1
- 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 +65 -2
- data/lib/puppet/pops/parser/eparser.rb +1569 -1241
- data/lib/puppet/pops/parser/lexer2.rb +32 -1
- data/lib/puppet/pops/parser/locator.rb +1 -1
- data/lib/puppet/pops/parser/parser_support.rb +25 -13
- data/lib/puppet/pops/patterns.rb +3 -0
- 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 +118 -129
- data/lib/puppet/pops/types/types.rb +1394 -255
- data/lib/puppet/pops/types/types_meta.rb +0 -234
- data/lib/puppet/pops/validation/checker4_0.rb +49 -1
- data/lib/puppet/pops/validation/validator_factory_4_0.rb +3 -1
- data/lib/puppet/pops/validation.rb +7 -2
- data/lib/puppet/pops.rb +19 -17
- data/lib/puppet/provider/augeas/augeas.rb +50 -0
- data/lib/puppet/provider/exec.rb +6 -1
- 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/nim.rb +1 -1
- 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 +20 -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/launchd.rb +36 -7
- 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 +25 -5
- data/lib/puppet/provider/sshkey/parsed.rb +19 -9
- data/lib/puppet/provider/zone/solaris.rb +2 -2
- data/lib/puppet/reference/configuration.rb +10 -4
- data/lib/puppet/reference/report.rb +9 -12
- data/lib/puppet/reports.rb +5 -1
- 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/resource.rb +50 -73
- data/lib/puppet/settings/file_setting.rb +10 -9
- 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/additional_resource_generator.rb +71 -8
- data/lib/puppet/transaction/resource_harness.rb +9 -4
- data/lib/puppet/transaction.rb +8 -1
- data/lib/puppet/type/augeas.rb +8 -0
- data/lib/puppet/type/file/source.rb +14 -12
- data/lib/puppet/type/package.rb +9 -6
- data/lib/puppet/type/user.rb +4 -2
- data/lib/puppet/type.rb +78 -7
- data/lib/puppet/util/command_line.rb +4 -0
- data/lib/puppet/util/execution.rb +18 -2
- data/lib/puppet/util/tagging.rb +7 -1
- data/lib/puppet/util/windows/adsi.rb +5 -2
- data/lib/puppet/util/windows/security.rb +4 -1
- data/lib/puppet/util/windows/taskscheduler.rb +1 -1
- data/lib/puppet/util.rb +9 -1
- data/lib/puppet/version.rb +1 -1
- data/lib/puppet.rb +12 -0
- 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 +30 -24
- data/spec/integration/parser/resource_expressions_spec.rb +4 -4
- data/spec/integration/parser/undef_param_spec.rb +1 -1
- data/spec/integration/provider/package_spec.rb +3 -1
- data/spec/integration/resource/catalog_spec.rb +1 -1
- data/spec/integration/ssl/certificate_authority_spec.rb +0 -1
- data/spec/integration/ssl/certificate_request_spec.rb +0 -1
- data/spec/integration/ssl/certificate_revocation_list_spec.rb +0 -1
- data/spec/integration/ssl/host_spec.rb +0 -1
- data/spec/integration/type/package_spec.rb +2 -0
- data/spec/integration/util/rdoc/parser_spec.rb +1 -1
- 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 +9 -1
- data/spec/unit/application/filebucket_spec.rb +88 -2
- data/spec/unit/application/lookup_spec.rb +195 -0
- data/spec/unit/application/master_spec.rb +2 -2
- data/spec/unit/application_spec.rb +3 -3
- 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/environments_spec.rb +2 -0
- data/spec/unit/face/node_spec.rb +1 -1
- data/spec/unit/file_bucket/dipper_spec.rb +210 -1
- data/spec/unit/file_serving/configuration_spec.rb +1 -1
- data/spec/unit/file_system_spec.rb +20 -0
- 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/filter_spec.rb +18 -0
- data/spec/unit/functions/hiera_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/graph/sequential_prioritizer_spec.rb +1 -1
- 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/indirection_spec.rb +13 -2
- data/spec/unit/indirector/request_spec.rb +8 -8
- data/spec/unit/indirector/ssl_file_spec.rb +1 -1
- data/spec/unit/indirector/yaml_spec.rb +1 -1
- data/spec/unit/info_service_spec.rb +236 -0
- data/spec/unit/module_tool/application_spec.rb +1 -1
- data/spec/unit/module_tool/applications/builder_spec.rb +1 -1
- 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/authstore_spec.rb +1 -1
- data/spec/unit/network/http/compression_spec.rb +1 -1
- data/spec/unit/network/http/connection_spec.rb +14 -19
- data/spec/unit/network/http/handler_spec.rb +0 -5
- data/spec/unit/network/rights_spec.rb +3 -3
- data/spec/unit/node_spec.rb +27 -0
- data/spec/unit/parser/ast/leaf_spec.rb +1 -1
- 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 +20 -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 +39 -0
- 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 +15 -12
- data/spec/unit/pops/validator/validator_spec.rb +68 -0
- data/spec/unit/property_spec.rb +1 -1
- 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/nim_spec.rb +6 -6
- 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 +35 -12
- data/spec/unit/provider/scheduled_task/win32_taskscheduler_spec.rb +10 -0
- data/spec/unit/provider/service/debian_spec.rb +28 -0
- data/spec/unit/provider/service/gentoo_spec.rb +1 -0
- data/spec/unit/provider/service/init_spec.rb +6 -0
- data/spec/unit/provider/service/launchd_spec.rb +85 -10
- data/spec/unit/provider/service/openrc_spec.rb +1 -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 +20 -4
- data/spec/unit/provider/service/systemd_spec.rb +79 -29
- data/spec/unit/provider/ssh_authorized_key/parsed_spec.rb +1 -1
- data/spec/unit/provider/sshkey/parsed_spec.rb +23 -0
- data/spec/unit/provider/user/windows_adsi_spec.rb +2 -1
- data/spec/unit/provider/zone/solaris_spec.rb +19 -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 +23 -5
- data/spec/unit/settings/file_setting_spec.rb +31 -0
- data/spec/unit/settings_spec.rb +91 -2
- data/spec/unit/ssl/certificate_authority/interface_spec.rb +4 -3
- data/spec/unit/ssl/certificate_authority_spec.rb +5 -3
- data/spec/unit/ssl/host_spec.rb +2 -2
- 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/transaction_spec.rb +7 -0
- data/spec/unit/type/exec_spec.rb +16 -8
- data/spec/unit/type/host_spec.rb +4 -4
- data/spec/unit/type/package_spec.rb +1 -0
- data/spec/unit/type/tidy_spec.rb +4 -4
- data/spec/unit/type/user_spec.rb +14 -7
- data/spec/unit/type/vlan_spec.rb +1 -1
- data/spec/unit/type_spec.rb +1 -1
- data/spec/unit/util/ldap/generator_spec.rb +1 -1
- data/spec/unit/util/network_device/cisco/device_spec.rb +1 -1
- data/spec/unit/util/network_device/transport/ssh_spec.rb +1 -1
- data/spec/unit/util/network_device_spec.rb +1 -1
- data/spec/unit/util/storage_spec.rb +5 -1
- data/spec/unit/util/windows/adsi_spec.rb +13 -0
- data/spec/unit/util_spec.rb +21 -2
- metadata +173 -7
- data/lib/puppet/pops/evaluator/callable_mismatch_describer.rb +0 -175
- data/spec/integration/data_binding.rb +0 -104
|
@@ -11,16 +11,22 @@ class Puppet::Resource::TypeCollection
|
|
|
11
11
|
def clear
|
|
12
12
|
@hostclasses.clear
|
|
13
13
|
@definitions.clear
|
|
14
|
+
@applications.clear
|
|
14
15
|
@nodes.clear
|
|
15
16
|
@notfound.clear
|
|
17
|
+
@capability_mappings.clear
|
|
18
|
+
@sites.clear
|
|
16
19
|
end
|
|
17
20
|
|
|
18
21
|
def initialize(env)
|
|
19
22
|
@environment = env
|
|
20
23
|
@hostclasses = {}
|
|
21
24
|
@definitions = {}
|
|
25
|
+
@capability_mappings = {}
|
|
26
|
+
@applications = {}
|
|
22
27
|
@nodes = {}
|
|
23
28
|
@notfound = {}
|
|
29
|
+
@sites = []
|
|
24
30
|
|
|
25
31
|
# So we can keep a list and match the first-defined regex
|
|
26
32
|
@node_list = []
|
|
@@ -33,7 +39,14 @@ class Puppet::Resource::TypeCollection
|
|
|
33
39
|
end
|
|
34
40
|
|
|
35
41
|
def inspect
|
|
36
|
-
"TypeCollection" + {
|
|
42
|
+
"TypeCollection" + {
|
|
43
|
+
:hostclasses => @hostclasses.keys,
|
|
44
|
+
:definitions => @definitions.keys,
|
|
45
|
+
:nodes => @nodes.keys,
|
|
46
|
+
:capability_mappings => @capability_mappings.keys,
|
|
47
|
+
:applications => @applications.keys,
|
|
48
|
+
:site => @sites[0] # todo, could be just a binary, this dumps the entire body (good while developing)
|
|
49
|
+
}.inspect
|
|
37
50
|
end
|
|
38
51
|
|
|
39
52
|
def <<(thing)
|
|
@@ -55,6 +68,7 @@ class Puppet::Resource::TypeCollection
|
|
|
55
68
|
def add_hostclass(instance)
|
|
56
69
|
dupe_check(instance, @hostclasses) { |dupe| "Class '#{instance.name}' is already defined#{dupe.error_context}; cannot redefine" }
|
|
57
70
|
dupe_check(instance, @definitions) { |dupe| "Definition '#{instance.name}' is already defined#{dupe.error_context}; cannot be redefined as a class" }
|
|
71
|
+
dupe_check(instance, @applications) { |dupe| "Application '#{instance.name}' is already defined#{dupe.error_context}; cannot be redefined as a class" }
|
|
58
72
|
|
|
59
73
|
@hostclasses[instance.name] = instance
|
|
60
74
|
instance
|
|
@@ -72,6 +86,16 @@ class Puppet::Resource::TypeCollection
|
|
|
72
86
|
instance
|
|
73
87
|
end
|
|
74
88
|
|
|
89
|
+
def add_site(instance)
|
|
90
|
+
dupe_check_singleton(instance, @sites) { |dupe| "Site is already defined#{dupe.error_context}; cannot redefine" }
|
|
91
|
+
@sites << instance
|
|
92
|
+
instance
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def site(_)
|
|
96
|
+
@sites[0]
|
|
97
|
+
end
|
|
98
|
+
|
|
75
99
|
def loader
|
|
76
100
|
@loader ||= Puppet::Parser::TypeLoader.new(environment)
|
|
77
101
|
end
|
|
@@ -101,17 +125,38 @@ class Puppet::Resource::TypeCollection
|
|
|
101
125
|
def add_definition(instance)
|
|
102
126
|
dupe_check(instance, @hostclasses) { |dupe| "'#{instance.name}' is already defined#{dupe.error_context} as a class; cannot redefine as a definition" }
|
|
103
127
|
dupe_check(instance, @definitions) { |dupe| "Definition '#{instance.name}' is already defined#{dupe.error_context}; cannot be redefined" }
|
|
128
|
+
dupe_check(instance, @applications) { |dupe| "'#{instance.name}' is already defined#{dupe.error_context} as an application; cannot be redefined" }
|
|
104
129
|
@definitions[instance.name] = instance
|
|
105
130
|
end
|
|
106
131
|
|
|
132
|
+
def add_capability_mapping(instance)
|
|
133
|
+
dupe_check(instance, @capability_mappings) { |dupe| "'#{instance.name}' is already defined#{dupe.error_context} as a class; cannot redefine as a mapping" }
|
|
134
|
+
@capability_mappings[instance.name] = instance
|
|
135
|
+
end
|
|
136
|
+
|
|
107
137
|
def definition(name)
|
|
108
138
|
@definitions[munge_name(name)]
|
|
109
139
|
end
|
|
110
140
|
|
|
141
|
+
def add_application(instance)
|
|
142
|
+
dupe_check(instance, @hostclasses) { |dupe| "'#{instance.name}' is already defined#{dupe.error_context} as a class; cannot redefine as an application" }
|
|
143
|
+
dupe_check(instance, @definitions) { |dupe| "'#{instance.name}' is already defined#{dupe.error_context} as a definition; cannot redefine as an application" }
|
|
144
|
+
dupe_check(instance, @applications) { |dupe| "'#{instance.name}' is already defined#{dupe.error_context} as an application; cannot be redefined" }
|
|
145
|
+
@applications[instance.name] = instance
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
def application(name)
|
|
149
|
+
@applications[munge_name(name)]
|
|
150
|
+
end
|
|
151
|
+
|
|
111
152
|
def find_node(name)
|
|
112
153
|
@nodes[munge_name(name)]
|
|
113
154
|
end
|
|
114
155
|
|
|
156
|
+
def find_site()
|
|
157
|
+
@sites[0]
|
|
158
|
+
end
|
|
159
|
+
|
|
115
160
|
def find_hostclass(name)
|
|
116
161
|
find_or_load(name, :hostclass)
|
|
117
162
|
end
|
|
@@ -120,7 +165,14 @@ class Puppet::Resource::TypeCollection
|
|
|
120
165
|
find_or_load(name, :definition)
|
|
121
166
|
end
|
|
122
167
|
|
|
123
|
-
|
|
168
|
+
def find_application(name)
|
|
169
|
+
find_or_load(name, :application)
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
# TODO: This implementation is wasteful as it creates a copy on each request
|
|
173
|
+
#
|
|
174
|
+
[:hostclasses, :nodes, :definitions, :capability_mappings,
|
|
175
|
+
:applications].each do |m|
|
|
124
176
|
define_method(m) do
|
|
125
177
|
instance_variable_get("@#{m}").dup
|
|
126
178
|
end
|
|
@@ -180,4 +232,10 @@ class Puppet::Resource::TypeCollection
|
|
|
180
232
|
message = yield dupe
|
|
181
233
|
instance.fail Puppet::ParseError, message
|
|
182
234
|
end
|
|
235
|
+
|
|
236
|
+
def dupe_check_singleton(instance, set)
|
|
237
|
+
return if set.empty?
|
|
238
|
+
message = yield set[0]
|
|
239
|
+
instance.fail Puppet::ParseError, message
|
|
240
|
+
end
|
|
183
241
|
end
|
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 = {})
|
|
@@ -219,15 +219,16 @@ class Puppet::Settings::FileSetting < Puppet::Settings::StringSetting
|
|
|
219
219
|
Puppet::Util::SUIDManager.asuser(*chown) do
|
|
220
220
|
# Update the umask to make non-executable files
|
|
221
221
|
Puppet::Util.withumask(File.umask ^ 0111) do
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
222
|
+
yielded_value = case self.mode
|
|
223
|
+
when String
|
|
224
|
+
self.mode.to_i(8)
|
|
225
|
+
when NilClass
|
|
226
|
+
0640
|
|
227
|
+
else
|
|
228
|
+
self.mode
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
yield yielded_value
|
|
231
232
|
end
|
|
232
233
|
end
|
|
233
234
|
end
|
data/lib/puppet/settings.rb
CHANGED
|
@@ -828,9 +828,9 @@ class Puppet::Settings
|
|
|
828
828
|
|
|
829
829
|
# Allow later inspection to determine if the setting was set by user
|
|
830
830
|
# config, rather than a default setting.
|
|
831
|
-
def set_by_config?(param)
|
|
831
|
+
def set_by_config?(param, environment = nil, run_mode = preferred_run_mode)
|
|
832
832
|
param = param.to_sym
|
|
833
|
-
configsearchpath.any? do |source|
|
|
833
|
+
configsearchpath(environment, run_mode).any? do |source|
|
|
834
834
|
if vals = searchpath_values(source)
|
|
835
835
|
vals.lookup(param)
|
|
836
836
|
end
|
|
@@ -140,7 +140,7 @@ module Puppet
|
|
|
140
140
|
if value = ca.print(host)
|
|
141
141
|
puts value
|
|
142
142
|
else
|
|
143
|
-
|
|
143
|
+
raise ArgumentError, "Could not find certificate for #{host}"
|
|
144
144
|
end
|
|
145
145
|
end
|
|
146
146
|
end
|
|
@@ -151,7 +151,7 @@ module Puppet
|
|
|
151
151
|
if cert = (Puppet::SSL::Certificate.indirection.find(host) || Puppet::SSL::CertificateRequest.indirection.find(host))
|
|
152
152
|
puts "#{host} #{cert.digest(@digest)}"
|
|
153
153
|
else
|
|
154
|
-
|
|
154
|
+
raise ArgumentError, "Could not find certificate for #{host}"
|
|
155
155
|
end
|
|
156
156
|
end
|
|
157
157
|
end
|
data/lib/puppet/ssl/oids.rb
CHANGED
|
@@ -48,7 +48,15 @@ module Puppet::SSL::Oids
|
|
|
48
48
|
["1.3.6.1.4.1.34380.1.1.15", 'pp_department', 'Puppet Node Department Name'],
|
|
49
49
|
["1.3.6.1.4.1.34380.1.1.16", 'pp_cluster', 'Puppet Node Cluster Name'],
|
|
50
50
|
["1.3.6.1.4.1.34380.1.1.17", 'pp_provisioner', 'Puppet Node Provisioner Name'],
|
|
51
|
-
|
|
51
|
+
["1.3.6.1.4.1.34380.1.1.18", 'pp_region', 'Puppet Node Region Name'],
|
|
52
|
+
["1.3.6.1.4.1.34380.1.1.19", 'pp_datacenter', 'Puppet Node Datacenter Name'],
|
|
53
|
+
["1.3.6.1.4.1.34380.1.1.20", 'pp_zone', 'Puppet Node Zone Name'],
|
|
54
|
+
["1.3.6.1.4.1.34380.1.1.21", 'pp_network', 'Puppet Node Network Name'],
|
|
55
|
+
["1.3.6.1.4.1.34380.1.1.22", 'pp_securitypolicy', 'Puppet Node Security Policy Name'],
|
|
56
|
+
["1.3.6.1.4.1.34380.1.1.23", 'pp_cloudplatform', 'Puppet Node Cloud Platform Name'],
|
|
57
|
+
["1.3.6.1.4.1.34380.1.1.24", 'pp_apptier', 'Puppet Node Application Tier'],
|
|
58
|
+
["1.3.6.1.4.1.34380.1.1.25", 'pp_hostname', 'Puppet Node Hostname'],
|
|
59
|
+
|
|
52
60
|
["1.3.6.1.4.1.34380.1.2", 'ppPrivCertExt', 'Puppet Private Certificate Extension'],
|
|
53
61
|
]
|
|
54
62
|
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
#
|
|
6
6
|
# @api private
|
|
7
7
|
class Puppet::Transaction::AdditionalResourceGenerator
|
|
8
|
+
attr_writer :relationship_graph
|
|
9
|
+
|
|
8
10
|
def initialize(catalog, relationship_graph, prioritizer)
|
|
9
11
|
@catalog = catalog
|
|
10
12
|
@relationship_graph = relationship_graph
|
|
@@ -22,11 +24,19 @@ class Puppet::Transaction::AdditionalResourceGenerator
|
|
|
22
24
|
generated = [generated] unless generated.is_a?(Array)
|
|
23
25
|
generated.collect do |res|
|
|
24
26
|
@catalog.resource(res.ref) || res
|
|
25
|
-
end.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
end.reverse_each do |res|
|
|
28
|
+
# This is reversed becuase PUP-1963 changed how generated
|
|
29
|
+
# resources were added to the catalog. It exists for backwards
|
|
30
|
+
# compatibility only, and can probably be removed in Puppet 5
|
|
31
|
+
#
|
|
32
|
+
# Previously, resources were given sequential priorities in the
|
|
33
|
+
# relationship graph. Post-1963, resources are added to the
|
|
34
|
+
# catalog one by one adjacent to the parent resource. This
|
|
35
|
+
# causes an implicit reversal of their application order from
|
|
36
|
+
# the old code. The reverse makes it all work like it did.
|
|
37
|
+
add_resource(res, resource)
|
|
38
|
+
|
|
39
|
+
add_generated_directed_dependency(resource, res)
|
|
30
40
|
generate_additional_resources(res)
|
|
31
41
|
end
|
|
32
42
|
end
|
|
@@ -102,16 +112,69 @@ class Puppet::Transaction::AdditionalResourceGenerator
|
|
|
102
112
|
end
|
|
103
113
|
end
|
|
104
114
|
|
|
105
|
-
def add_resource(res, parent_resource, priority)
|
|
115
|
+
def add_resource(res, parent_resource, priority=nil)
|
|
106
116
|
if @catalog.resource(res.ref).nil?
|
|
107
117
|
res.tag(*parent_resource.tags)
|
|
108
|
-
|
|
109
|
-
|
|
118
|
+
if parent_resource.depthfirst?
|
|
119
|
+
@catalog.add_resource_before(parent_resource, res)
|
|
120
|
+
else
|
|
121
|
+
@catalog.add_resource_after(parent_resource, res)
|
|
122
|
+
end
|
|
110
123
|
@catalog.add_edge(@catalog.container_of(parent_resource), res)
|
|
124
|
+
if @relationship_graph && priority
|
|
125
|
+
# If we have a relationship_graph we should add the resource
|
|
126
|
+
# to it (this is an eval_generate). If we don't, then the
|
|
127
|
+
# relationship_graph has not yet been created and we can skip
|
|
128
|
+
# adding it.
|
|
129
|
+
@relationship_graph.add_vertex(res, priority)
|
|
130
|
+
end
|
|
111
131
|
res.finish
|
|
112
132
|
end
|
|
113
133
|
end
|
|
114
134
|
|
|
135
|
+
# add correct edge for depth- or breadth- first traversal of
|
|
136
|
+
# generated resource. Skip generating the edge if there is already
|
|
137
|
+
# some sort of edge between the two resources.
|
|
138
|
+
def add_generated_directed_dependency(parent, child, label=nil)
|
|
139
|
+
if parent.depthfirst?
|
|
140
|
+
source = child
|
|
141
|
+
target = parent.to_resource
|
|
142
|
+
else
|
|
143
|
+
source = parent
|
|
144
|
+
target = child.to_resource
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
# For each potential relationship metaparam, check if parent or
|
|
148
|
+
# child references the other. If there are none, we should add our
|
|
149
|
+
# edge.
|
|
150
|
+
edge_exists = Puppet::Type.relationship_params.any? { |param|
|
|
151
|
+
param_sym = param.name.to_sym
|
|
152
|
+
|
|
153
|
+
if parent[param_sym]
|
|
154
|
+
parent_contains = parent[param_sym].any? { |res|
|
|
155
|
+
res.ref == child.ref
|
|
156
|
+
}
|
|
157
|
+
else
|
|
158
|
+
parent_contains = false
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
if child[param_sym]
|
|
162
|
+
child_contains = child[param_sym].any? { |res|
|
|
163
|
+
res.ref == parent.ref
|
|
164
|
+
}
|
|
165
|
+
else
|
|
166
|
+
child_contains = false
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
parent_contains || child_contains
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
if not edge_exists
|
|
173
|
+
source[:before] ||= []
|
|
174
|
+
source[:before] << target
|
|
175
|
+
end
|
|
176
|
+
end
|
|
177
|
+
|
|
115
178
|
# Copy an important relationships from the parent to the newly-generated
|
|
116
179
|
# child resource.
|
|
117
180
|
def add_conditional_directed_dependency(parent, child, label=nil)
|
|
@@ -99,10 +99,15 @@ class Puppet::Transaction::ResourceHarness
|
|
|
99
99
|
def allow_changes?(resource)
|
|
100
100
|
if resource.purging? and resource.deleting? and deps = relationship_graph.dependents(resource) \
|
|
101
101
|
and ! deps.empty? and deps.detect { |d| ! d.deleting? }
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
102
|
+
real_deps = deps.reject { |r| r.class.name == :whit }
|
|
103
|
+
if real_deps.empty?
|
|
104
|
+
true
|
|
105
|
+
else
|
|
106
|
+
deplabel = real_deps.collect { |r| r.ref }.join(",")
|
|
107
|
+
plurality = real_deps.length > 1 ? "":"s"
|
|
108
|
+
resource.warning "#{deplabel} still depend#{plurality} on me -- not purging"
|
|
109
|
+
false
|
|
110
|
+
end
|
|
106
111
|
else
|
|
107
112
|
true
|
|
108
113
|
end
|
data/lib/puppet/transaction.rb
CHANGED
|
@@ -79,7 +79,7 @@ class Puppet::Transaction
|
|
|
79
79
|
# necessary events.
|
|
80
80
|
def evaluate(&block)
|
|
81
81
|
block ||= method(:eval_resource)
|
|
82
|
-
generator = AdditionalResourceGenerator.new(@catalog,
|
|
82
|
+
generator = AdditionalResourceGenerator.new(@catalog, nil, @prioritizer)
|
|
83
83
|
@catalog.vertices.each { |resource| generator.generate_additional_resources(resource) }
|
|
84
84
|
|
|
85
85
|
perform_pre_run_checks
|
|
@@ -135,6 +135,9 @@ class Puppet::Transaction
|
|
|
135
135
|
end
|
|
136
136
|
end
|
|
137
137
|
|
|
138
|
+
# Generate the relationship graph, set up our generator to use it
|
|
139
|
+
# for eval_generate, then kick off our traversal.
|
|
140
|
+
generator.relationship_graph = relationship_graph
|
|
138
141
|
relationship_graph.traverse(:while => continue_while,
|
|
139
142
|
:pre_process => pre_process,
|
|
140
143
|
:overly_deferred_resource_handler => overly_deferred_resource_handler,
|
|
@@ -372,6 +375,10 @@ class Puppet::Transaction
|
|
|
372
375
|
not resource.tagged?(*tags)
|
|
373
376
|
end
|
|
374
377
|
|
|
378
|
+
def split_qualified_tags?
|
|
379
|
+
false
|
|
380
|
+
end
|
|
381
|
+
|
|
375
382
|
# These two methods are only made public to enable the existing spec tests to run
|
|
376
383
|
# under rspec 3 (apparently rspec 2 didn't enforce access controls?). Please do not
|
|
377
384
|
# treat these as part of a public API.
|
data/lib/puppet/type/augeas.rb
CHANGED
|
@@ -73,9 +73,17 @@ Puppet::Type.newtype(:augeas) do
|
|
|
73
73
|
|
|
74
74
|
newparam (:onlyif) do
|
|
75
75
|
desc "Optional augeas command and comparisons to control the execution of this type.
|
|
76
|
+
|
|
77
|
+
Note: `values` is not an actual augeas API command. It calls `match` to retrieve an array of paths
|
|
78
|
+
in <MATCH_PATH> and then `get` to retrieve the values from each of the returned paths.
|
|
79
|
+
|
|
76
80
|
Supported onlyif syntax:
|
|
77
81
|
|
|
78
82
|
* `get <AUGEAS_PATH> <COMPARATOR> <STRING>`
|
|
83
|
+
* `values <MATCH_PATH> include <STRING>`
|
|
84
|
+
* `values <MATCH_PATH> not_include <STRING>`
|
|
85
|
+
* `values <MATCH_PATH> == <AN_ARRAY>`
|
|
86
|
+
* `values <MATCH_PATH> != <AN_ARRAY>`
|
|
79
87
|
* `match <MATCH_PATH> size <COMPARATOR> <INT>`
|
|
80
88
|
* `match <MATCH_PATH> include <STRING>`
|
|
81
89
|
* `match <MATCH_PATH> not_include <STRING>`
|
|
@@ -12,22 +12,24 @@ module Puppet
|
|
|
12
12
|
|
|
13
13
|
attr_accessor :source, :local
|
|
14
14
|
desc <<-'EOT'
|
|
15
|
-
A source file, which will be copied into place on the local system.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
Windows mapped drives). This attribute is mutually exclusive with
|
|
19
|
-
`content` and `target`.
|
|
15
|
+
A source file, which will be copied into place on the local system. This
|
|
16
|
+
attribute is mutually exclusive with `content` and `target`. Allowed
|
|
17
|
+
values are:
|
|
20
18
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
* `puppet:` URIs, which point to files in modules or Puppet file server
|
|
20
|
+
mount points.
|
|
21
|
+
* Fully qualified paths to locally available files (including files on NFS
|
|
22
|
+
shares or Windows mapped drives).
|
|
23
|
+
* `file:` URIs, which behave the same as local file paths.
|
|
24
24
|
|
|
25
|
-
`puppet
|
|
25
|
+
The normal form of a `puppet:` URI is:
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
`puppet:///modules/<MODULE NAME>/<FILE PATH>`
|
|
28
|
+
|
|
29
|
+
This will fetch a file from a module on the Puppet master (or from a
|
|
30
|
+
local module when using Puppet apply). Given a `modulepath` of
|
|
29
31
|
`/etc/puppetlabs/code/modules`, the example above would resolve to
|
|
30
|
-
`/etc/puppetlabs/code/modules
|
|
32
|
+
`/etc/puppetlabs/code/modules/<MODULE NAME>/files/<FILE PATH>`.
|
|
31
33
|
|
|
32
34
|
Unlike `content`, the `source` attribute can be used to recursively copy
|
|
33
35
|
directories if the `recurse` attribute is set to `true` or `remote`. If
|
data/lib/puppet/type/package.rb
CHANGED
|
@@ -404,8 +404,9 @@ module Puppet
|
|
|
404
404
|
end
|
|
405
405
|
|
|
406
406
|
newparam(:configfiles) do
|
|
407
|
-
desc "Whether
|
|
408
|
-
|
|
407
|
+
desc "Whether to keep or replace modified config files when installing or
|
|
408
|
+
upgrading a package. This only affects the `apt` and `dpkg` providers.
|
|
409
|
+
Defaults to `keep`."
|
|
409
410
|
|
|
410
411
|
defaultto :keep
|
|
411
412
|
|
|
@@ -456,10 +457,12 @@ module Puppet
|
|
|
456
457
|
key and value pair are interpreted in a provider specific way. Each
|
|
457
458
|
option will automatically be quoted when passed to the install command.
|
|
458
459
|
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
460
|
+
With Windows packages, note that file paths in an install option must
|
|
461
|
+
use backslashes. (Since install options are passed directly to the
|
|
462
|
+
installation command, forward slashes won't be automatically converted
|
|
463
|
+
like they are in `file` resources.) Note also that backslashes in
|
|
464
|
+
double-quoted strings _must_ be escaped and backslashes in single-quoted
|
|
465
|
+
strings _can_ be escaped.
|
|
463
466
|
EOT
|
|
464
467
|
end
|
|
465
468
|
|
data/lib/puppet/type/user.rb
CHANGED
|
@@ -170,8 +170,10 @@ module Puppet
|
|
|
170
170
|
|
|
171
171
|
newproperty(:comment) do
|
|
172
172
|
desc "A description of the user. Generally the user's full name."
|
|
173
|
-
|
|
174
|
-
|
|
173
|
+
if RUBY_VERSION < "2.1.0"
|
|
174
|
+
munge do |v|
|
|
175
|
+
v.respond_to?(:force_encoding) ? v.force_encoding(Encoding::ASCII_8BIT) : v
|
|
176
|
+
end
|
|
175
177
|
end
|
|
176
178
|
end
|
|
177
179
|
|