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
@@ -68,4 +68,27 @@ describe "sshkey parsed provider" do
|
|
68
68
|
end
|
69
69
|
end
|
70
70
|
end
|
71
|
+
|
72
|
+
context 'default ssh_known_hosts target path' do
|
73
|
+
['9.10', '9.11', '10.10'].each do |version|
|
74
|
+
it 'should be `/etc/ssh_known_hosts` when OSX version 10.10 or older`' do
|
75
|
+
Facter.expects(:value).with(:operatingsystem).returns('Darwin')
|
76
|
+
Facter.expects(:value).with(:macosx_productversion_major).returns(version)
|
77
|
+
expect(subject.default_target).to eq('/etc/ssh_known_hosts')
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
['10.11', '10.13', '11.0', '11.11'].each do |version|
|
82
|
+
it 'should be `/etc/ssh/ssh_known_hosts` when OSX version 10.11 or newer`' do
|
83
|
+
Facter.expects(:value).with(:operatingsystem).returns('Darwin')
|
84
|
+
Facter.expects(:value).with(:macosx_productversion_major).returns(version)
|
85
|
+
expect(subject.default_target).to eq('/etc/ssh/ssh_known_hosts')
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
it 'should be `/etc/ssh/ssh_known_hosts` on other operating systems' do
|
90
|
+
Facter.expects(:value).with(:operatingsystem).returns('RedHat')
|
91
|
+
expect(subject.default_target).to eq('/etc/ssh/ssh_known_hosts')
|
92
|
+
end
|
93
|
+
end
|
71
94
|
end
|
data/spec/unit/reports_spec.rb
CHANGED
@@ -43,6 +43,16 @@ describe Puppet::Reports, " when registering report types" do
|
|
43
43
|
Puppet::Reports.register_report(:testing) { }
|
44
44
|
end
|
45
45
|
|
46
|
+
it "should allow a successful report to be reloaded" do
|
47
|
+
Puppet::Reports.register_report(:testing) { }
|
48
|
+
Puppet::Reports.register_report(:testing) { }
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should allow a failed report to be reloaded and show the correct exception both times" do
|
52
|
+
expect { Puppet::Reports.register_report(:testing) { raise TypeError, 'failed report' } }.to raise_error(TypeError)
|
53
|
+
expect { Puppet::Reports.register_report(:testing) { raise TypeError, 'failed report' } }.to raise_error(TypeError)
|
54
|
+
end
|
55
|
+
|
46
56
|
it "should extend the report type with the Puppet::Util::Docs module" do
|
47
57
|
mod = stub 'module', :define_method => true
|
48
58
|
|
@@ -0,0 +1,56 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
require 'spec_helper'
|
3
|
+
require_relative '../pops/parser/parser_rspec_helper'
|
4
|
+
require 'puppet/resource/capability_finder'
|
5
|
+
|
6
|
+
describe Puppet::Resource::CapabilityFinder do
|
7
|
+
context 'when PuppetDB is not configured' do
|
8
|
+
it 'should error' do
|
9
|
+
Puppet::Util.expects(:const_defined?).with('Puppetdb').returns false
|
10
|
+
expect { Puppet::Resource::CapabilityFinder.find('production', nil, nil) }.to raise_error(/PuppetDB is not available/)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
context 'when PuppetDB is configured' do
|
15
|
+
around(:each) do |example|
|
16
|
+
mock_pdb = !Puppet::Util.const_defined?('Puppetdb')
|
17
|
+
if mock_pdb
|
18
|
+
class Puppet::Util::Puppetdb
|
19
|
+
class Http; end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
begin
|
23
|
+
make_cap_type
|
24
|
+
example.run
|
25
|
+
ensure
|
26
|
+
Puppet::Util.send(:remove_const, 'Puppetdb') if mock_pdb
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
class MockResponse
|
31
|
+
def body
|
32
|
+
'[{"type": "Cap", "title": "cap", "parameters": { "host" : "ahost" }}]'
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def make_cap_type
|
37
|
+
Puppet::Type.newtype :cap, :is_capability => true do
|
38
|
+
newparam :name
|
39
|
+
newparam :host
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'should call Puppet::Util::PuppetDB::Http.action' do
|
44
|
+
Puppet::Util::Puppetdb::Http.expects(:action).returns(MockResponse.new)
|
45
|
+
result = Puppet::Resource::CapabilityFinder.find('production', nil, Puppet::Resource.new('Cap', 'cap'))
|
46
|
+
expect(result['host']).to eq('ahost')
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'should use pass code_id in query to Puppet::Util::PuppetDB::Http.action' do
|
50
|
+
code_id = 'b59e5df0578ef411f773ee6c33d8073c50e7b8fe'
|
51
|
+
Puppet::Util::Puppetdb::Http.expects(:action).with(regexp_matches(Regexp.new(CGI.escape('"=","code_id","' + code_id + "")))).returns(MockResponse.new)
|
52
|
+
result = Puppet::Resource::CapabilityFinder.find('production', code_id, Puppet::Resource.new('Cap', 'cap'))
|
53
|
+
expect(result['host']).to eq('ahost')
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -86,6 +86,11 @@ describe Puppet::Resource::Catalog, "when compiling" do
|
|
86
86
|
expect(@catalog.server_version).to eq(5)
|
87
87
|
end
|
88
88
|
|
89
|
+
it "defaults code_id to nil" do
|
90
|
+
catalog = Puppet::Resource::Catalog.new("host")
|
91
|
+
expect(catalog.code_id).to be_nil
|
92
|
+
end
|
93
|
+
|
89
94
|
describe "when compiling" do
|
90
95
|
it "should accept tags" do
|
91
96
|
config = Puppet::Resource::Catalog.new("mynode")
|
@@ -253,6 +258,16 @@ describe Puppet::Resource::Catalog, "when compiling" do
|
|
253
258
|
r == @r1
|
254
259
|
end.edge?(@r1,@r2)).not_to be
|
255
260
|
end
|
261
|
+
|
262
|
+
it "copies the version" do
|
263
|
+
@original.version = '123'
|
264
|
+
expect(@original.filter.version).to eq(@original.version)
|
265
|
+
end
|
266
|
+
|
267
|
+
it 'copies the code_id' do
|
268
|
+
@original.code_id = 'b59e5df0578ef411f773ee6c33d8073c50e7b8fe'
|
269
|
+
expect(@original.filter.code_id).to eq(@original.code_id)
|
270
|
+
end
|
256
271
|
end
|
257
272
|
|
258
273
|
describe "when functioning as a resource container" do
|
@@ -782,17 +797,23 @@ describe Puppet::Resource::Catalog, "when converting to pson" do
|
|
782
797
|
@catalog = Puppet::Resource::Catalog.new("myhost")
|
783
798
|
end
|
784
799
|
|
785
|
-
|
786
|
-
|
800
|
+
{ :name => 'myhost',
|
801
|
+
:version => 42,
|
802
|
+
:code_id => 'b59e5df0578ef411f773ee6c33d8073c50e7b8fe'
|
803
|
+
}.each do |param, value|
|
804
|
+
it "emits a #{param} equal to #{value.inspect}" do
|
805
|
+
@catalog.send(param.to_s + "=", value)
|
806
|
+
pson = PSON.parse(@catalog.to_pson)
|
807
|
+
|
808
|
+
expect(pson[param.to_s]).to eq(@catalog.send(param))
|
809
|
+
end
|
787
810
|
end
|
788
811
|
|
789
|
-
|
790
|
-
|
791
|
-
|
812
|
+
it "emits an array of classes" do
|
813
|
+
@catalog.add_class('foo')
|
814
|
+
pson = PSON.parse(@catalog.to_pson)
|
792
815
|
|
793
|
-
|
794
|
-
Puppet::Resource::Catalog.from_data_hash PSON.parse @catalog.to_pson
|
795
|
-
end
|
816
|
+
expect(pson['classes']).to eq(['foo'])
|
796
817
|
end
|
797
818
|
|
798
819
|
it "should convert its resources to a PSON-encoded array and store it as the 'resources' data" do
|
@@ -831,6 +852,7 @@ describe Puppet::Resource::Catalog, "when converting from pson" do
|
|
831
852
|
|
832
853
|
it "should create it with the provided name" do
|
833
854
|
@data['version'] = 50
|
855
|
+
@data['code_id'] = 'b59e5df0578ef411f773ee6c33d8073c50e7b8fe'
|
834
856
|
@data['tags'] = %w{one two}
|
835
857
|
@data['classes'] = %w{one two}
|
836
858
|
@data['edges'] = [Puppet::Relationship.new("File[/foo]", "File[/bar]",
|
@@ -844,6 +866,7 @@ describe Puppet::Resource::Catalog, "when converting from pson" do
|
|
844
866
|
|
845
867
|
expect(catalog.name).to eq('myhost')
|
846
868
|
expect(catalog.version).to eq(@data['version'])
|
869
|
+
expect(catalog.code_id).to eq(@data['code_id'])
|
847
870
|
expect(catalog).to be_tagged("one")
|
848
871
|
expect(catalog).to be_tagged("two")
|
849
872
|
|
@@ -76,16 +76,18 @@ describe Puppet::Resource::TypeCollection do
|
|
76
76
|
end.to raise_error(Puppet::ParseError, /cannot be redefined/)
|
77
77
|
end
|
78
78
|
|
79
|
-
it "should remove all nodes, classes, and
|
79
|
+
it "should remove all nodes, classes, definitions, and applications when cleared" do
|
80
80
|
loader = Puppet::Resource::TypeCollection.new(environment)
|
81
81
|
loader.add Puppet::Resource::Type.new(:hostclass, "class")
|
82
82
|
loader.add Puppet::Resource::Type.new(:definition, "define")
|
83
83
|
loader.add Puppet::Resource::Type.new(:node, "node")
|
84
|
+
loader.add Puppet::Resource::Type.new(:application, "application")
|
84
85
|
|
85
86
|
loader.clear
|
86
87
|
expect(loader.hostclass("class")).to be_nil
|
87
88
|
expect(loader.definition("define")).to be_nil
|
88
89
|
expect(loader.node("node")).to be_nil
|
90
|
+
expect(loader.node("application")).to be_nil
|
89
91
|
end
|
90
92
|
|
91
93
|
describe "when looking up names" do
|
@@ -153,7 +155,8 @@ describe Puppet::Resource::TypeCollection do
|
|
153
155
|
end
|
154
156
|
end
|
155
157
|
|
156
|
-
%w{hostclass node definition}
|
158
|
+
KINDS = %w{hostclass node definition application}
|
159
|
+
KINDS.each do |data|
|
157
160
|
describe "behavior of add for #{data}" do
|
158
161
|
|
159
162
|
it "should return the added #{data}" do
|
@@ -175,6 +178,24 @@ describe Puppet::Resource::TypeCollection do
|
|
175
178
|
it "should return nil when asked for a #{data} that has not been added" do
|
176
179
|
expect(Puppet::Resource::TypeCollection.new(environment).send(data, "foo")).to be_nil
|
177
180
|
end
|
181
|
+
|
182
|
+
if data != "node"
|
183
|
+
it "should fail if an application with the same name is added" do
|
184
|
+
loader = Puppet::Resource::TypeCollection.new(environment)
|
185
|
+
instance = Puppet::Resource::Type.new(data, "foo")
|
186
|
+
application = Puppet::Resource::Type.new(:application, "foo")
|
187
|
+
loader.add(instance)
|
188
|
+
expect { loader.add(application) }.to raise_error(Puppet::ParseError, /redefine/)
|
189
|
+
end
|
190
|
+
|
191
|
+
it "should fail if there is an application with the same name" do
|
192
|
+
loader = Puppet::Resource::TypeCollection.new(environment)
|
193
|
+
application = Puppet::Resource::Type.new(:application, "foo")
|
194
|
+
instance = Puppet::Resource::Type.new(data, "foo")
|
195
|
+
loader.add(instance)
|
196
|
+
expect { loader.add(application) }.to raise_error(Puppet::ParseError, /redefine/)
|
197
|
+
end
|
198
|
+
end
|
178
199
|
end
|
179
200
|
end
|
180
201
|
|
@@ -766,7 +766,7 @@ describe Puppet::Resource::Type do
|
|
766
766
|
source = Puppet::Resource::Type.new(:hostclass, "foo", :code => scode)
|
767
767
|
|
768
768
|
dest.merge(source)
|
769
|
-
expect(dest.code.children.
|
769
|
+
expect(dest.code.children.map { |c| c.value }).to eq(%w{dest source})
|
770
770
|
end
|
771
771
|
end
|
772
772
|
end
|
data/spec/unit/resource_spec.rb
CHANGED
@@ -331,13 +331,15 @@ describe Puppet::Resource do
|
|
331
331
|
end
|
332
332
|
|
333
333
|
it "should query the data_binding terminus using a namespaced key" do
|
334
|
+
Puppet::DataBinding.indirection.expects(:find).with('lookup_options', any_parameters).throws(:no_such_key)
|
334
335
|
Puppet::DataBinding.indirection.expects(:find).with(
|
335
336
|
'apache::port', all_of(has_key(:environment), has_key(:variables)))
|
336
337
|
resource.set_default_parameters(scope)
|
337
338
|
end
|
338
339
|
|
339
340
|
it "should use the value from the data_binding terminus" do
|
340
|
-
Puppet::DataBinding.indirection.expects(:find).
|
341
|
+
Puppet::DataBinding.indirection.expects(:find).with('lookup_options', any_parameters).throws(:no_such_key)
|
342
|
+
Puppet::DataBinding.indirection.expects(:find).with('apache::port', any_parameters).returns('443')
|
341
343
|
|
342
344
|
resource.set_default_parameters(scope)
|
343
345
|
|
@@ -345,7 +347,8 @@ describe Puppet::Resource do
|
|
345
347
|
end
|
346
348
|
|
347
349
|
it "should use the default value if the data_binding terminus returns nil" do
|
348
|
-
Puppet::DataBinding.indirection.expects(:find).
|
350
|
+
Puppet::DataBinding.indirection.expects(:find).with('lookup_options', any_parameters).throws(:no_such_key)
|
351
|
+
Puppet::DataBinding.indirection.expects(:find).with('apache::port', any_parameters).returns(nil)
|
349
352
|
|
350
353
|
resource.set_default_parameters(scope)
|
351
354
|
|
@@ -353,7 +356,8 @@ describe Puppet::Resource do
|
|
353
356
|
end
|
354
357
|
|
355
358
|
it "should fail with error message about data binding on a hiera failure" do
|
356
|
-
Puppet::DataBinding.indirection.expects(:find).
|
359
|
+
Puppet::DataBinding.indirection.expects(:find).with('lookup_options', any_parameters).throws(:no_such_key)
|
360
|
+
Puppet::DataBinding.indirection.expects(:find).with('apache::port', any_parameters).raises(Puppet::DataBinding::LookupError, 'Forgettabotit')
|
357
361
|
expect {
|
358
362
|
resource.set_default_parameters(scope)
|
359
363
|
}.to raise_error(Puppet::Error, /Error from DataBinding 'hiera' while looking up 'apache::port':.*Forgettabotit/)
|
@@ -428,7 +432,7 @@ describe Puppet::Resource do
|
|
428
432
|
end
|
429
433
|
|
430
434
|
it "should fail if invalid parameters are used" do
|
431
|
-
expect { Puppet::Resource.new("file", "/path", :strict => true, :parameters => {:nosuchparam => "bar"}) }.to raise_error(
|
435
|
+
expect { Puppet::Resource.new("file", "/path", :strict => true, :parameters => {:nosuchparam => "bar"}) }.to raise_error(Puppet::Error, /no parameter named 'nosuchparam'/)
|
432
436
|
end
|
433
437
|
|
434
438
|
it "should fail if the resource type cannot be resolved" do
|
@@ -657,6 +661,20 @@ describe Puppet::Resource do
|
|
657
661
|
)
|
658
662
|
end
|
659
663
|
|
664
|
+
it "should escape internal single quotes in a title" do
|
665
|
+
singlequote_resource = Puppet::Resource.new("one::two", "/my/file'b'a'r",
|
666
|
+
:parameters => {
|
667
|
+
:ensure => 'present',
|
668
|
+
}
|
669
|
+
)
|
670
|
+
expect(singlequote_resource.to_manifest).to eq <<-HEREDOC.gsub(/^\s{8}/, '').gsub(/\n$/, '')
|
671
|
+
one::two { '/my/file\\'b\\'a\\'r':
|
672
|
+
ensure => 'present',
|
673
|
+
}
|
674
|
+
HEREDOC
|
675
|
+
|
676
|
+
end
|
677
|
+
|
660
678
|
it "should align, sort and add trailing commas to attributes with ensure first" do
|
661
679
|
expect(@resource.to_manifest).to eq <<-HEREDOC.gsub(/^\s{8}/, '').gsub(/\n$/, '')
|
662
680
|
one::two { '/my/file':
|
data/spec/unit/settings_spec.rb
CHANGED
@@ -287,6 +287,95 @@ describe Puppet::Settings do
|
|
287
287
|
expect(@settings.set_by_cli?(:myval)).to be_falsey
|
288
288
|
end
|
289
289
|
|
290
|
+
it "should find no configured settings by default" do
|
291
|
+
expect(@settings.set_by_config?(:myval)).to be_falsey
|
292
|
+
end
|
293
|
+
|
294
|
+
it "should identify configured settings in memory" do
|
295
|
+
@settings.instance_variable_get(:@value_sets)[:memory].expects(:lookup).with(:myval).returns('foo')
|
296
|
+
expect(@settings.set_by_config?(:myval)).to be_truthy
|
297
|
+
end
|
298
|
+
|
299
|
+
it "should identify configured settings from CLI" do
|
300
|
+
@settings.instance_variable_get(:@value_sets)[:cli].expects(:lookup).with(:myval).returns('foo')
|
301
|
+
expect(@settings.set_by_config?(:myval)).to be_truthy
|
302
|
+
end
|
303
|
+
|
304
|
+
it "should not identify configured settings from environment by default" do
|
305
|
+
Puppet.lookup(:environments).expects(:get_conf).with(Puppet[:environment].to_sym).never
|
306
|
+
expect(@settings.set_by_config?(:manifest)).to be_falsey
|
307
|
+
end
|
308
|
+
|
309
|
+
it "should identify configured settings from environment by when an environment is specified" do
|
310
|
+
foo = mock('environment', :manifest => 'foo')
|
311
|
+
Puppet.lookup(:environments).expects(:get_conf).with(Puppet[:environment].to_sym).returns(foo)
|
312
|
+
expect(@settings.set_by_config?(:manifest, Puppet[:environment])).to be_truthy
|
313
|
+
end
|
314
|
+
|
315
|
+
it "should identify configured settings from the preferred run mode" do
|
316
|
+
user_config_text = "[#{@settings.preferred_run_mode}]\nmyval = foo"
|
317
|
+
seq = sequence "config_file_sequence"
|
318
|
+
|
319
|
+
Puppet.features.stubs(:root?).returns(false)
|
320
|
+
Puppet::FileSystem.expects(:exist?).
|
321
|
+
with(user_config_file_default_location).
|
322
|
+
returns(true).in_sequence(seq)
|
323
|
+
@settings.expects(:read_file).
|
324
|
+
with(user_config_file_default_location).
|
325
|
+
returns(user_config_text).in_sequence(seq)
|
326
|
+
|
327
|
+
@settings.send(:parse_config_files)
|
328
|
+
expect(@settings.set_by_config?(:myval)).to be_truthy
|
329
|
+
end
|
330
|
+
|
331
|
+
it "should identify configured settings from the specified run mode" do
|
332
|
+
user_config_text = "[master]\nmyval = foo"
|
333
|
+
seq = sequence "config_file_sequence"
|
334
|
+
|
335
|
+
Puppet.features.stubs(:root?).returns(false)
|
336
|
+
Puppet::FileSystem.expects(:exist?).
|
337
|
+
with(user_config_file_default_location).
|
338
|
+
returns(true).in_sequence(seq)
|
339
|
+
@settings.expects(:read_file).
|
340
|
+
with(user_config_file_default_location).
|
341
|
+
returns(user_config_text).in_sequence(seq)
|
342
|
+
|
343
|
+
@settings.send(:parse_config_files)
|
344
|
+
expect(@settings.set_by_config?(:myval, nil, :master)).to be_truthy
|
345
|
+
end
|
346
|
+
|
347
|
+
it "should not identify configured settings from an unspecified run mode" do
|
348
|
+
user_config_text = "[zaz]\nmyval = foo"
|
349
|
+
seq = sequence "config_file_sequence"
|
350
|
+
|
351
|
+
Puppet.features.stubs(:root?).returns(false)
|
352
|
+
Puppet::FileSystem.expects(:exist?).
|
353
|
+
with(user_config_file_default_location).
|
354
|
+
returns(true).in_sequence(seq)
|
355
|
+
@settings.expects(:read_file).
|
356
|
+
with(user_config_file_default_location).
|
357
|
+
returns(user_config_text).in_sequence(seq)
|
358
|
+
|
359
|
+
@settings.send(:parse_config_files)
|
360
|
+
expect(@settings.set_by_config?(:myval)).to be_falsey
|
361
|
+
end
|
362
|
+
|
363
|
+
it "should identify configured settings from the main section" do
|
364
|
+
user_config_text = "[main]\nmyval = foo"
|
365
|
+
seq = sequence "config_file_sequence"
|
366
|
+
|
367
|
+
Puppet.features.stubs(:root?).returns(false)
|
368
|
+
Puppet::FileSystem.expects(:exist?).
|
369
|
+
with(user_config_file_default_location).
|
370
|
+
returns(true).in_sequence(seq)
|
371
|
+
@settings.expects(:read_file).
|
372
|
+
with(user_config_file_default_location).
|
373
|
+
returns(user_config_text).in_sequence(seq)
|
374
|
+
|
375
|
+
@settings.send(:parse_config_files)
|
376
|
+
expect(@settings.set_by_config?(:myval)).to be_truthy
|
377
|
+
end
|
378
|
+
|
290
379
|
it "should clear the cache when setting getopt-specific values" do
|
291
380
|
@settings.define_settings :mysection,
|
292
381
|
:one => { :default => "whah", :desc => "yay" },
|
@@ -1734,7 +1823,7 @@ describe Puppet::Settings do
|
|
1734
1823
|
end
|
1735
1824
|
|
1736
1825
|
describe "default_certname" do
|
1737
|
-
describe "using hostname and
|
1826
|
+
describe "using hostname and domain" do
|
1738
1827
|
before :each do
|
1739
1828
|
Puppet::Settings.stubs(:hostname_fact).returns("testhostname")
|
1740
1829
|
Puppet::Settings.stubs(:domain_fact).returns("domain.test.")
|
@@ -332,9 +332,10 @@ describe Puppet::SSL::CertificateAuthority::Interface do
|
|
332
332
|
@applier.expects(:puts).with "h1"
|
333
333
|
|
334
334
|
@ca.expects(:print).with("host2").returns nil
|
335
|
-
|
336
|
-
|
337
|
-
|
335
|
+
|
336
|
+
expect {
|
337
|
+
@applier.apply(@ca)
|
338
|
+
}.to raise_error(ArgumentError, /Could not find certificate for host2/)
|
338
339
|
end
|
339
340
|
end
|
340
341
|
end
|
data/spec/unit/ssl/oids_spec.rb
CHANGED
@@ -25,6 +25,14 @@ describe Puppet::SSL::Oids do
|
|
25
25
|
'pp_department' => "1.3.6.1.4.1.34380.1.1.15",
|
26
26
|
'pp_cluster' => "1.3.6.1.4.1.34380.1.1.16",
|
27
27
|
'pp_provisioner' => "1.3.6.1.4.1.34380.1.1.17",
|
28
|
+
'pp_region' => "1.3.6.1.4.1.34380.1.1.18",
|
29
|
+
'pp_datacenter' => "1.3.6.1.4.1.34380.1.1.19",
|
30
|
+
'pp_zone' => "1.3.6.1.4.1.34380.1.1.20",
|
31
|
+
'pp_network' => "1.3.6.1.4.1.34380.1.1.21",
|
32
|
+
'pp_securitypolicy' => "1.3.6.1.4.1.34380.1.1.22",
|
33
|
+
'pp_cloudplatform' => "1.3.6.1.4.1.34380.1.1.23",
|
34
|
+
'pp_apptier' => "1.3.6.1.4.1.34380.1.1.24",
|
35
|
+
'pp_hostname' => "1.3.6.1.4.1.34380.1.1.25",
|
28
36
|
'ppPrivCertExt' => '1.3.6.1.4.1.34380.1.2',
|
29
37
|
}.each_pair do |sn, oid|
|
30
38
|
it "defines #{sn} as #{oid}" do
|
@@ -52,6 +52,48 @@ describe Puppet::Transaction::AdditionalResourceGenerator do
|
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
|
+
Puppet::Type.newtype(:autorequire) do
|
56
|
+
newparam(:name) do
|
57
|
+
isnamevar
|
58
|
+
end
|
59
|
+
|
60
|
+
autorequire(:notify) do
|
61
|
+
self[:name]
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
Puppet::Type.newtype(:gen_auto) do
|
66
|
+
newparam(:name) do
|
67
|
+
isnamevar
|
68
|
+
end
|
69
|
+
|
70
|
+
newparam(:eval_after) do
|
71
|
+
end
|
72
|
+
|
73
|
+
def generate()
|
74
|
+
[ Puppet::Type.type(:autorequire).new(:name => self[:eval_after]) ]
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
Puppet::Type.newtype(:empty) do
|
79
|
+
newparam(:name) do
|
80
|
+
isnamevar
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
Puppet::Type.newtype(:gen_empty) do
|
85
|
+
newparam(:name) do
|
86
|
+
isnamevar
|
87
|
+
end
|
88
|
+
|
89
|
+
newparam(:eval_after) do
|
90
|
+
end
|
91
|
+
|
92
|
+
def generate()
|
93
|
+
[ Puppet::Type.type(:empty).new(:name => self[:eval_after], :require => "Notify[#{self[:eval_after]}]") ]
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
55
97
|
context "when applying eval_generate" do
|
56
98
|
it "should add the generated resources to the catalog" do
|
57
99
|
catalog = compile_to_ral(<<-MANIFEST)
|
@@ -368,13 +410,44 @@ describe Puppet::Transaction::AdditionalResourceGenerator do
|
|
368
410
|
"Notify[after]"))
|
369
411
|
end
|
370
412
|
|
371
|
-
|
372
|
-
|
373
|
-
|
413
|
+
it "runs autorequire on the generated resource" do
|
414
|
+
graph = relationships_after_generating(<<-MANIFEST, 'Gen_auto[thing]')
|
415
|
+
gen_auto { thing:
|
416
|
+
eval_after => hello,
|
417
|
+
}
|
374
418
|
|
375
|
-
|
419
|
+
notify { hello: }
|
420
|
+
notify { goodbye: }
|
421
|
+
MANIFEST
|
376
422
|
|
377
|
-
|
423
|
+
expect(order_resources_traversed_in(graph)).to(
|
424
|
+
include_in_order("Gen_auto[thing]",
|
425
|
+
"Notify[hello]",
|
426
|
+
"Autorequire[hello]",
|
427
|
+
"Notify[goodbye]"))
|
428
|
+
end
|
429
|
+
|
430
|
+
it "evaluates metaparameters on the generated resource" do
|
431
|
+
graph = relationships_after_generating(<<-MANIFEST, 'Gen_empty[thing]')
|
432
|
+
gen_empty { thing:
|
433
|
+
eval_after => hello,
|
434
|
+
}
|
435
|
+
|
436
|
+
notify { hello: }
|
437
|
+
notify { goodbye: }
|
438
|
+
MANIFEST
|
439
|
+
|
440
|
+
expect(order_resources_traversed_in(graph)).to(
|
441
|
+
include_in_order("Gen_empty[thing]",
|
442
|
+
"Notify[hello]",
|
443
|
+
"Empty[hello]",
|
444
|
+
"Notify[goodbye]"))
|
445
|
+
end
|
446
|
+
|
447
|
+
def relationships_after_generating(manifest, resource_to_generate)
|
448
|
+
catalog = compile_to_ral(manifest)
|
449
|
+
generate_resources_in(catalog, nil, resource_to_generate)
|
450
|
+
relationship_graph_for(catalog)
|
378
451
|
end
|
379
452
|
|
380
453
|
def generate_resources_in(catalog, relationship_graph, resource_to_generate)
|