puppet 4.2.3 → 4.3.0
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
@@ -20,7 +20,7 @@ class Puppet::Provider::Package::Windows
|
|
20
20
|
inst = installer
|
21
21
|
|
22
22
|
if inst.ProductState(name) == INSTALLSTATE_DEFAULT
|
23
|
-
MsiPackage.new(values
|
23
|
+
MsiPackage.new(get_display_name(values),
|
24
24
|
values['DisplayVersion'],
|
25
25
|
name, # productcode
|
26
26
|
inst.ProductInfo(name, 'PackageCode'))
|
@@ -31,8 +31,9 @@ class Puppet::Provider::Package::Windows
|
|
31
31
|
# Is this a valid MSI package we should manage?
|
32
32
|
def self.valid?(name, values)
|
33
33
|
# See http://community.spiceworks.com/how_to/show/2238
|
34
|
-
|
35
|
-
|
34
|
+
displayName = get_display_name(values)
|
35
|
+
!!(displayName && displayName.length > 0 &&
|
36
|
+
values['WindowsInstaller'] == 1 && # DWORD
|
36
37
|
name =~ /\A\{[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\}\Z/i)
|
37
38
|
end
|
38
39
|
|
@@ -71,7 +71,7 @@ class Puppet::Provider::Package::Windows
|
|
71
71
|
|
72
72
|
def self.replace_forward_slashes(value)
|
73
73
|
if value.include?('/')
|
74
|
-
value.gsub!('/', "\\")
|
74
|
+
value.gsub!('/', "\\")
|
75
75
|
Puppet.debug('Package source parameter contained /s - replaced with \\s')
|
76
76
|
end
|
77
77
|
value
|
@@ -81,6 +81,14 @@ class Puppet::Provider::Package::Windows
|
|
81
81
|
value.include?(' ') ? %Q["#{value.gsub(/"/, '\"')}"] : value
|
82
82
|
end
|
83
83
|
|
84
|
+
def self.get_display_name(values)
|
85
|
+
return if values.nil?
|
86
|
+
return values['DisplayName'] if values['DisplayName'] && values['DisplayName'].length > 0
|
87
|
+
return values['QuietDisplayName'] if values['QuietDisplayName'] && values['QuietDisplayName'].length > 0
|
88
|
+
|
89
|
+
''
|
90
|
+
end
|
91
|
+
|
84
92
|
def initialize(name, version)
|
85
93
|
@name = name
|
86
94
|
@version = version
|
@@ -11,7 +11,7 @@ Puppet::Type.type(:package).provide :yum, :parent => :rpm, :source => :rpm do
|
|
11
11
|
|
12
12
|
has_feature :install_options, :versionable, :virtual_packages
|
13
13
|
|
14
|
-
commands :
|
14
|
+
commands :cmd => "yum", :rpm => "rpm"
|
15
15
|
|
16
16
|
if command('rpm')
|
17
17
|
confine :true => begin
|
@@ -67,7 +67,7 @@ Puppet::Type.type(:package).provide :yum, :parent => :rpm, :source => :rpm do
|
|
67
67
|
# @return [Hash<String, Array<Hash<String, String>>>] All packages that were
|
68
68
|
# found with a list of found versions for each package.
|
69
69
|
def self.check_updates(enablerepo, disablerepo, disableexcludes)
|
70
|
-
args = [command(:
|
70
|
+
args = [command(:cmd), 'check-update']
|
71
71
|
args.concat(enablerepo.map { |repo| ["--enablerepo=#{repo}"] }.flatten)
|
72
72
|
args.concat(disablerepo.map { |repo| ["--disablerepo=#{repo}"] }.flatten)
|
73
73
|
args.concat(disableexcludes.map { |repo| ["--disableexcludes=#{repo}"] }.flatten)
|
@@ -78,9 +78,9 @@ Puppet::Type.type(:package).provide :yum, :parent => :rpm, :source => :rpm do
|
|
78
78
|
if output.exitstatus == 100
|
79
79
|
updates = parse_updates(output)
|
80
80
|
elsif output.exitstatus == 0
|
81
|
-
self.debug "
|
81
|
+
self.debug "#{command(:cmd)} check-update exited with 0; no package updates available."
|
82
82
|
else
|
83
|
-
self.warn "Could not check for updates, '
|
83
|
+
self.warn "Could not check for updates, '#{command(:cmd)} check-update' exited with #{output.exitstatus}"
|
84
84
|
end
|
85
85
|
updates
|
86
86
|
end
|
@@ -91,7 +91,7 @@ Puppet::Type.type(:package).provide :yum, :parent => :rpm, :source => :rpm do
|
|
91
91
|
|
92
92
|
updates = Hash.new { |h, k| h[k] = [] }
|
93
93
|
body.split.each_slice(3) do |tuple|
|
94
|
-
break if tuple[0] =~ /^Obsoleting/
|
94
|
+
break if tuple[0] =~ /^(Obsoleting|Security:)/
|
95
95
|
hash = update_to_hash(*tuple[0..1])
|
96
96
|
# Create entries for both the package name without a version and a
|
97
97
|
# version since yum considers those as mostly interchangeable.
|
@@ -126,11 +126,16 @@ Puppet::Type.type(:package).provide :yum, :parent => :rpm, :source => :rpm do
|
|
126
126
|
@latest_versions = nil
|
127
127
|
end
|
128
128
|
|
129
|
+
def self.error_level
|
130
|
+
'0'
|
131
|
+
end
|
132
|
+
|
129
133
|
def install
|
130
134
|
wanted = @resource[:name]
|
135
|
+
error_level = self.class.error_level
|
131
136
|
# If not allowing virtual packages, do a query to ensure a real package exists
|
132
137
|
unless @resource.allow_virtual?
|
133
|
-
|
138
|
+
execute([command(:cmd), '-d', '0', '-e', error_level, '-y', install_options, :list, wanted].compact)
|
134
139
|
end
|
135
140
|
|
136
141
|
should = @resource.should(:ensure)
|
@@ -154,8 +159,8 @@ Puppet::Type.type(:package).provide :yum, :parent => :rpm, :source => :rpm do
|
|
154
159
|
# Yum on el-4 and el-5 returns exit status 0 when trying to install a package it doesn't recognize;
|
155
160
|
# ensure we capture output to check for errors.
|
156
161
|
no_debug = if Facter.value(:operatingsystemmajrelease).to_i > 5 then ["-d", "0"] else [] end
|
157
|
-
|
158
|
-
output =
|
162
|
+
command = [command(:cmd)] + no_debug + ["-e", error_level, "-y", install_options, operation, wanted].compact
|
163
|
+
output = execute(command)
|
159
164
|
|
160
165
|
if output =~ /^No package #{wanted} available\.$/
|
161
166
|
raise Puppet::Error, "Could not find package #{wanted}"
|
@@ -194,7 +199,7 @@ Puppet::Type.type(:package).provide :yum, :parent => :rpm, :source => :rpm do
|
|
194
199
|
end
|
195
200
|
|
196
201
|
def purge
|
197
|
-
|
202
|
+
execute([command(:cmd), "-y", :erase, @resource[:name]])
|
198
203
|
end
|
199
204
|
|
200
205
|
# parse a yum "version" specification
|
@@ -5,7 +5,7 @@ Puppet::Type.type(:service).provide :bsd, :parent => :init do
|
|
5
5
|
Uses `rc.conf.d` for service enabling and disabling.
|
6
6
|
EOT
|
7
7
|
|
8
|
-
confine :operatingsystem => [:freebsd, :
|
8
|
+
confine :operatingsystem => [:freebsd, :dragonfly]
|
9
9
|
|
10
10
|
def rcconf_dir
|
11
11
|
'/etc/rc.conf.d'
|
@@ -63,4 +63,25 @@ Puppet::Type.type(:service).provide :debian, :parent => :init do
|
|
63
63
|
update_rc "-f", @resource[:name], "remove"
|
64
64
|
update_rc @resource[:name], "defaults"
|
65
65
|
end
|
66
|
+
|
67
|
+
def statuscmd
|
68
|
+
os = Facter.value(:operatingsystem).downcase
|
69
|
+
|
70
|
+
if os == 'debian'
|
71
|
+
majversion = Facter.value(:operatingsystemmajrelease).to_i
|
72
|
+
else
|
73
|
+
majversion = Facter.value(:operatingsystemmajrelease).split('.')[0].to_i
|
74
|
+
end
|
75
|
+
|
76
|
+
|
77
|
+
if ((os == 'debian' && majversion >= 8) || (os == 'ubuntu' && majversion >= 15))
|
78
|
+
# SysVInit scripts will always return '0' for status when the service is masked,
|
79
|
+
# even if the service is actually stopped. Use the SysVInit-Systemd compatibility
|
80
|
+
# layer to determine the actual status. This is only necessary when the SysVInit
|
81
|
+
# version of a service is queried. I.e, 'ntp' instead of 'ntp.service'.
|
82
|
+
(@resource[:hasstatus] == :true) && ["systemctl", "is-active", @resource[:name]]
|
83
|
+
else
|
84
|
+
super
|
85
|
+
end
|
86
|
+
end
|
66
87
|
end
|
@@ -16,6 +16,12 @@ Puppet::Type.type(:service).provide :init, :parent => :base do
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
+
# Debian and Ubuntu should use the Debian provider.
|
20
|
+
confine :true => begin
|
21
|
+
os = Facter.value(:operatingsystem).downcase
|
22
|
+
!(os == 'debian' || os == 'ubuntu')
|
23
|
+
end
|
24
|
+
|
19
25
|
# We can't confine this here, because the init path can be overridden.
|
20
26
|
#confine :exists => defpath
|
21
27
|
|
@@ -0,0 +1,51 @@
|
|
1
|
+
Puppet::Type.type(:service).provide :rcng, :parent => :bsd do
|
2
|
+
desc <<-EOT
|
3
|
+
RCng service management with rc.d
|
4
|
+
EOT
|
5
|
+
|
6
|
+
defaultfor :operatingsystem => [:netbsd, :cargos]
|
7
|
+
confine :operatingsystem => [:netbsd, :cargos]
|
8
|
+
|
9
|
+
def self.defpath
|
10
|
+
"/etc/rc.d"
|
11
|
+
end
|
12
|
+
|
13
|
+
# if the service file exists in rc.conf.d AND matches an expected pattern
|
14
|
+
# then it's already enabled
|
15
|
+
def enabled?
|
16
|
+
rcfile = File.join(rcconf_dir, @resource[:name])
|
17
|
+
if Puppet::FileSystem.exist?(rcfile)
|
18
|
+
File.open(rcfile).readlines.each do |line|
|
19
|
+
# Now look for something that looks like "service=${service:=YES}" or "service=YES"
|
20
|
+
if line.match(/^\s*#{@resource[:name]}=(?:YES|\${#{@resource[:name]}:=YES})/)
|
21
|
+
return :true
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
:false
|
27
|
+
end
|
28
|
+
|
29
|
+
# enable service by creating a service file under rc.conf.d with the
|
30
|
+
# proper contents, or by modifying it's contents to to enable the service.
|
31
|
+
def enable
|
32
|
+
Dir.mkdir(rcconf_dir) if not Puppet::FileSystem.exist?(rcconf_dir)
|
33
|
+
rcfile = File.join(rcconf_dir, @resource[:name])
|
34
|
+
if Puppet::FileSystem.exist?(rcfile)
|
35
|
+
newcontents = []
|
36
|
+
File.open(rcfile).readlines.each do |line|
|
37
|
+
if line.match(/^\s*#{@resource[:name]}=(NO|\$\{#{@resource[:name]}:NO\})/)
|
38
|
+
line = "#{@resource[:name]}=${#{@resource[:name]}:=YES}"
|
39
|
+
end
|
40
|
+
newcontents.push(line)
|
41
|
+
end
|
42
|
+
Puppet::Util.replace_file(rcfile, 0644) do |f|
|
43
|
+
f.puts newcontents
|
44
|
+
end
|
45
|
+
else
|
46
|
+
Puppet::Util.replace_file(rcfile, 0644) do |f|
|
47
|
+
f.puts "%s=${%s:=YES}\n" % [@resource[:name], @resource[:name]]
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -8,7 +8,8 @@ Puppet::Type.type(:service).provide :redhat, :parent => :init, :source => :init
|
|
8
8
|
|
9
9
|
commands :chkconfig => "/sbin/chkconfig", :service => "/sbin/service"
|
10
10
|
|
11
|
-
defaultfor :osfamily =>
|
11
|
+
defaultfor :osfamily => :redhat
|
12
|
+
defaultfor :osfamily => :suse, :operatingsystemmajrelease => ["10", "11"]
|
12
13
|
|
13
14
|
# Remove the symlinks
|
14
15
|
def disable
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'timeout'
|
2
|
+
|
1
3
|
# Solaris 10 SMF-style services.
|
2
4
|
Puppet::Type.type(:service).provide :smf, :parent => :base do
|
3
5
|
desc <<-EOT
|
@@ -32,7 +34,7 @@ Puppet::Type.type(:service).provide :smf, :parent => :base do
|
|
32
34
|
end
|
33
35
|
|
34
36
|
def self.instances
|
35
|
-
svcs.split("\n").select{|l| l !~ /^legacy_run/ }.collect do |line|
|
37
|
+
svcs("-H").split("\n").select{|l| l !~ /^legacy_run/ }.collect do |line|
|
36
38
|
state,stime,fmri = line.split(/\s+/)
|
37
39
|
status = case state
|
38
40
|
when /online/; :running
|
@@ -74,6 +76,45 @@ Puppet::Type.type(:service).provide :smf, :parent => :base do
|
|
74
76
|
end
|
75
77
|
end
|
76
78
|
|
79
|
+
# Wait for the service to transition into the specified state before returning.
|
80
|
+
# This is necessary due to the asynchronous nature of SMF services.
|
81
|
+
# desired_state should be online, offline, disabled, or uninitialized.
|
82
|
+
# See PUP-5474 for long-term solution to this issue.
|
83
|
+
def wait(*desired_state)
|
84
|
+
Timeout.timeout(60) do
|
85
|
+
loop do
|
86
|
+
states = self.service_states
|
87
|
+
break if desired_state.include?(states[0]) && states[1] == '-'
|
88
|
+
sleep(1)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
rescue Timeout::Error
|
92
|
+
raise Puppet::Error.new("Timed out waiting for #{@resource[:name]} to transition states")
|
93
|
+
end
|
94
|
+
|
95
|
+
def start
|
96
|
+
# Wait for the service to actually start before returning.
|
97
|
+
super
|
98
|
+
self.wait('online')
|
99
|
+
end
|
100
|
+
|
101
|
+
def stop
|
102
|
+
# Wait for the service to actually stop before returning.
|
103
|
+
super
|
104
|
+
self.wait('offline', 'disabled', 'uninitialized')
|
105
|
+
end
|
106
|
+
|
107
|
+
def restart
|
108
|
+
# Wait for the service to actually start before returning.
|
109
|
+
super
|
110
|
+
self.wait('online')
|
111
|
+
end
|
112
|
+
|
113
|
+
# Determine the current and next states of a service.
|
114
|
+
def service_states
|
115
|
+
svcs("-H", "-o", "state,nstate", @resource[:name]).chomp.split
|
116
|
+
end
|
117
|
+
|
77
118
|
def status
|
78
119
|
if @resource[:status]
|
79
120
|
super
|
@@ -83,7 +124,7 @@ Puppet::Type.type(:service).provide :smf, :parent => :base do
|
|
83
124
|
begin
|
84
125
|
# get the current state and the next state, and if the next
|
85
126
|
# state is set (i.e. not "-") use it for state comparison
|
86
|
-
states =
|
127
|
+
states = service_states
|
87
128
|
state = states[1] == "-" ? states[0] : states[1]
|
88
129
|
rescue Puppet::ExecutionFailure
|
89
130
|
info "Could not get status on service #{self.name}"
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'timeout'
|
2
|
+
|
1
3
|
# AIX System Resource controller (SRC)
|
2
4
|
Puppet::Type.type(:service).provide :src, :parent => :base do
|
3
5
|
|
@@ -63,6 +65,31 @@ Puppet::Type.type(:service).provide :src, :parent => :base do
|
|
63
65
|
rmitab(@resource[:name])
|
64
66
|
end
|
65
67
|
|
68
|
+
# Wait for the service to transition into the specified state before returning.
|
69
|
+
# This is necessary due to the asynchronous nature of AIX services.
|
70
|
+
# desired_state should either be :running or :stopped.
|
71
|
+
def wait(desired_state)
|
72
|
+
Timeout.timeout(60) do
|
73
|
+
loop do
|
74
|
+
status = self.status
|
75
|
+
break if status == desired_state.to_sym
|
76
|
+
sleep(1)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
rescue Timeout::Error
|
80
|
+
raise Puppet::Error.new("Timed out waiting for #{@resource[:name]} to transition states")
|
81
|
+
end
|
82
|
+
|
83
|
+
def start
|
84
|
+
super
|
85
|
+
self.wait(:running)
|
86
|
+
end
|
87
|
+
|
88
|
+
def stop
|
89
|
+
super
|
90
|
+
self.wait(:stopped)
|
91
|
+
end
|
92
|
+
|
66
93
|
def restart
|
67
94
|
execute([command(:lssrc), "-Ss", @resource[:name]]).each_line do |line|
|
68
95
|
args = line.split(":")
|
@@ -10,7 +10,7 @@ Puppet::Type.type(:service).provide :systemd, :parent => :base do
|
|
10
10
|
defaultfor :osfamily => [:archlinux]
|
11
11
|
defaultfor :osfamily => :redhat, :operatingsystemmajrelease => "7"
|
12
12
|
defaultfor :osfamily => :redhat, :operatingsystem => :fedora
|
13
|
-
defaultfor :osfamily => :suse
|
13
|
+
defaultfor :osfamily => :suse
|
14
14
|
defaultfor :operatingsystem => :debian, :operatingsystemmajrelease => "8"
|
15
15
|
defaultfor :operatingsystem => :ubuntu, :operatingsystemmajrelease => "15.04"
|
16
16
|
|
@@ -32,7 +32,14 @@ Puppet::Type.type(:service).provide :systemd, :parent => :base do
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def get_start_link_count
|
35
|
-
|
35
|
+
# Start links don't include '.service'. Just search for the service name.
|
36
|
+
if @resource[:name].match(/\.service/)
|
37
|
+
link_name = @resource[:name].split('.')[0]
|
38
|
+
else
|
39
|
+
link_name = @resource[:name]
|
40
|
+
end
|
41
|
+
|
42
|
+
Dir.glob("/etc/rc*.d/S??#{link_name}").length
|
36
43
|
end
|
37
44
|
|
38
45
|
def enabled?
|
@@ -59,7 +66,7 @@ Puppet::Type.type(:service).provide :systemd, :parent => :base do
|
|
59
66
|
# flapping when simply trying to disable a masked service.
|
60
67
|
return :mask if (@resource[:enable] == :mask) && (svc_info[:LoadState] == 'masked')
|
61
68
|
return :true if svc_info[:UnitFileState] == 'enabled'
|
62
|
-
if Facter.value(:osfamily) == 'debian'
|
69
|
+
if Facter.value(:osfamily).downcase == 'debian'
|
63
70
|
ret = debian_enabled?(svc_info)
|
64
71
|
return ret if ret
|
65
72
|
end
|
@@ -72,6 +79,11 @@ Puppet::Type.type(:service).provide :systemd, :parent => :base do
|
|
72
79
|
return :false
|
73
80
|
end
|
74
81
|
|
82
|
+
# This method is required for Debian systems due to the way the SysVInit-Systemd
|
83
|
+
# compatibility layer works. When we are trying to manage a service which does not
|
84
|
+
# have a Systemd unit file, we need to go through the old init script to determine
|
85
|
+
# whether it is enabled or not. See PUP-5016 for more details.
|
86
|
+
#
|
75
87
|
def debian_enabled?(svc_info)
|
76
88
|
# If UnitFileState == UnitFileState then we query the older way.
|
77
89
|
if svc_info[:UnitFileState] == 'UnitFileState'
|
@@ -1,17 +1,8 @@
|
|
1
1
|
require 'puppet/provider/parsedfile'
|
2
2
|
|
3
|
-
known = nil
|
4
|
-
case Facter.value(:operatingsystem)
|
5
|
-
when "Darwin"; known = "/etc/ssh_known_hosts"
|
6
|
-
else
|
7
|
-
known = "/etc/ssh/ssh_known_hosts"
|
8
|
-
end
|
9
|
-
|
10
|
-
|
11
3
|
Puppet::Type.type(:sshkey).provide(
|
12
4
|
:parsed,
|
13
5
|
:parent => Puppet::Provider::ParsedFile,
|
14
|
-
:default_target => known,
|
15
6
|
:filetype => :flat
|
16
7
|
) do
|
17
8
|
desc "Parse and generate host-wide known hosts files for SSH."
|
@@ -36,5 +27,24 @@ Puppet::Type.type(:sshkey).provide(
|
|
36
27
|
def self.default_mode
|
37
28
|
0644
|
38
29
|
end
|
30
|
+
|
31
|
+
def self.default_target
|
32
|
+
case Facter.value(:operatingsystem)
|
33
|
+
when "Darwin"
|
34
|
+
# Versions 10.11 and up use /etc/ssh/ssh_known_hosts
|
35
|
+
version = Facter.value(:macosx_productversion_major)
|
36
|
+
if version
|
37
|
+
if Puppet::Util::Package.versioncmp(version, '10.11') >= 0
|
38
|
+
"/etc/ssh/ssh_known_hosts"
|
39
|
+
else
|
40
|
+
"/etc/ssh_known_hosts"
|
41
|
+
end
|
42
|
+
else
|
43
|
+
"/etc/ssh_known_hosts"
|
44
|
+
end
|
45
|
+
else
|
46
|
+
"/etc/ssh/ssh_known_hosts"
|
47
|
+
end
|
48
|
+
end
|
39
49
|
end
|
40
50
|
|
@@ -5,19 +5,16 @@ report = Puppet::Util::Reference.newreference :report, :doc => "All available tr
|
|
5
5
|
end
|
6
6
|
|
7
7
|
report.header = "
|
8
|
-
Puppet
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
to collect. See [Reports and Reporting](http://docs.puppetlabs.com/guides/reporting.html) for more information on how to use reports.
|
8
|
+
Puppet can generate a report after applying a catalog. This report includes
|
9
|
+
events, log messages, resource statuses, and metrics and metadata about the run.
|
10
|
+
Puppet agent sends its report to a Puppet master server, and Puppet apply
|
11
|
+
processes its own reports.
|
13
12
|
|
14
|
-
|
15
|
-
|
13
|
+
Puppet master and Puppet apply will handle every report with a set of report
|
14
|
+
processors, configurable with the `reports` setting in puppet.conf. This page
|
15
|
+
documents the built-in report processors.
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
reports entirely.
|
20
|
-
|
21
|
-
Puppet provides multiple report handlers that will process client reports:
|
17
|
+
See [About Reporting](https://docs.puppetlabs.com/puppet/latest/reference/reporting_about.html)
|
18
|
+
for more details.
|
22
19
|
|
23
20
|
"
|