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
@@ -22,7 +22,7 @@ describe provider_class do
|
|
22
22
|
end
|
23
23
|
|
24
24
|
before do
|
25
|
-
|
25
|
+
provider_class.stubs(:command).with(:cmd).returns('/usr/bin/yum')
|
26
26
|
provider.stubs(:rpm).returns 'rpm'
|
27
27
|
provider.stubs(:get).with(:version).returns '1'
|
28
28
|
provider.stubs(:get).with(:release).returns '1'
|
@@ -186,7 +186,7 @@ describe provider_class do
|
|
186
186
|
|
187
187
|
it 'should call yum install for :installed' do
|
188
188
|
resource.stubs(:should).with(:ensure).returns :installed
|
189
|
-
|
189
|
+
Puppet::Util::Execution.expects(:execute).with(['/usr/bin/yum', '-d', '0', '-e', '0', '-y', :install, 'mypackage'])
|
190
190
|
provider.install
|
191
191
|
end
|
192
192
|
|
@@ -197,7 +197,7 @@ describe provider_class do
|
|
197
197
|
|
198
198
|
it 'should catch yum install failures when status code is wrong' do
|
199
199
|
resource.stubs(:should).with(:ensure).returns :installed
|
200
|
-
|
200
|
+
Puppet::Util::Execution.expects(:execute).with(['/usr/bin/yum', '-e', '0', '-y', :install, name]).returns("No package #{name} available.")
|
201
201
|
expect {
|
202
202
|
provider.install
|
203
203
|
}.to raise_error(Puppet::Error, "Could not find package #{name}")
|
@@ -212,7 +212,7 @@ describe provider_class do
|
|
212
212
|
it 'should be able to set version' do
|
213
213
|
version = '1.2'
|
214
214
|
resource[:ensure] = version
|
215
|
-
|
215
|
+
Puppet::Util::Execution.expects(:execute).with(['/usr/bin/yum', '-d', '0', '-e', '0', '-y', :install, "#{name}-#{version}"])
|
216
216
|
provider.stubs(:query).returns :ensure => version
|
217
217
|
provider.install
|
218
218
|
end
|
@@ -220,6 +220,7 @@ describe provider_class do
|
|
220
220
|
it 'should handle partial versions specified' do
|
221
221
|
version = '1.3.4'
|
222
222
|
resource[:ensure] = version
|
223
|
+
Puppet::Util::Execution.expects(:execute).with(['/usr/bin/yum', '-d', '0', '-e', '0', '-y', :install, 'mypackage-1.3.4'])
|
223
224
|
provider.stubs(:query).returns :ensure => '1.3.4-1.el6'
|
224
225
|
provider.install
|
225
226
|
end
|
@@ -228,7 +229,7 @@ describe provider_class do
|
|
228
229
|
current_version = '1.2'
|
229
230
|
version = '1.0'
|
230
231
|
resource[:ensure] = '1.0'
|
231
|
-
|
232
|
+
Puppet::Util::Execution.expects(:execute).with(['/usr/bin/yum', '-d', '0', '-e', '0', '-y', :downgrade, "#{name}-#{version}"])
|
232
233
|
provider.stubs(:query).returns(:ensure => current_version).then.returns(:ensure => version)
|
233
234
|
provider.install
|
234
235
|
end
|
@@ -237,22 +238,22 @@ describe provider_class do
|
|
237
238
|
resource[:ensure] = :installed
|
238
239
|
resource[:install_options] = ['-t', {'-x' => 'expackage'}]
|
239
240
|
|
240
|
-
|
241
|
+
Puppet::Util::Execution.expects(:execute).with(['/usr/bin/yum', '-d', '0', '-e', '0', '-y', ['-t', '-x=expackage'], :install, name])
|
241
242
|
provider.install
|
242
243
|
end
|
243
244
|
|
244
245
|
it 'allow virtual packages' do
|
245
246
|
resource[:ensure] = :installed
|
246
247
|
resource[:allow_virtual] = true
|
247
|
-
|
248
|
-
|
248
|
+
Puppet::Util::Execution.expects(:execute).with(['/usr/bin/yum', '-d', '0', '-e', '0', '-y', :list, name]).never
|
249
|
+
Puppet::Util::Execution.expects(:execute).with(['/usr/bin/yum', '-d', '0', '-e', '0', '-y', :install, name])
|
249
250
|
provider.install
|
250
251
|
end
|
251
252
|
end
|
252
253
|
|
253
254
|
describe 'when uninstalling' do
|
254
255
|
it 'should use erase to purge' do
|
255
|
-
|
256
|
+
Puppet::Util::Execution.expects(:execute).with(['/usr/bin/yum', '-y', :erase, name])
|
256
257
|
provider.purge
|
257
258
|
end
|
258
259
|
end
|
@@ -397,10 +398,6 @@ describe provider_class do
|
|
397
398
|
end
|
398
399
|
|
399
400
|
describe "executing yum check-update" do
|
400
|
-
before do
|
401
|
-
described_class.stubs(:command).with(:yum).returns '/usr/bin/yum'
|
402
|
-
end
|
403
|
-
|
404
401
|
it "passes repos to enable to 'yum check-update'" do
|
405
402
|
Puppet::Util::Execution.expects(:execute).with do |args, *rest|
|
406
403
|
expect(args).to eq %w[/usr/bin/yum check-update --enablerepo=updates --enablerepo=centosplus]
|
@@ -497,6 +494,17 @@ describe provider_class do
|
|
497
494
|
expect(output).not_to include("1:1.0.0-14.git20150121.b4ea599c.el7")
|
498
495
|
end
|
499
496
|
end
|
497
|
+
describe "with security notifications" do
|
498
|
+
let(:check_update) { File.read(my_fixture('yum-check-update-security.txt')) }
|
499
|
+
let(:output) { described_class.parse_updates(check_update) }
|
500
|
+
|
501
|
+
it "ignores all entries including and after 'Security'" do
|
502
|
+
expect(output).not_to include("Security")
|
503
|
+
end
|
504
|
+
it "includes updates before 'Security'" do
|
505
|
+
expect(output).to include("yum-plugin-fastestmirror.noarch")
|
506
|
+
end
|
507
|
+
end
|
500
508
|
end
|
501
509
|
|
502
510
|
describe "parsing a line from yum check-update" do
|
@@ -600,6 +600,16 @@ describe Puppet::Type.type(:scheduled_task).provider(:win32_taskscheduler), :if
|
|
600
600
|
|
601
601
|
expect(resource.provider.exists?).to eq(true)
|
602
602
|
end
|
603
|
+
|
604
|
+
it "uses SystemRoot in the path of Task folder" do
|
605
|
+
Win32::TaskScheduler.unstub(:new)
|
606
|
+
exists_test_task = Win32::TaskScheduler.new
|
607
|
+
Dir.stubs(:foreach).with('D:/WinNT/Tasks').returns([])
|
608
|
+
|
609
|
+
Puppet::Util.withenv('SystemRoot' => 'D:/WinNT') do
|
610
|
+
exists_test_task.exists?('Test Task')
|
611
|
+
end
|
612
|
+
end
|
603
613
|
end
|
604
614
|
|
605
615
|
describe '#clear_task' do
|
@@ -141,4 +141,31 @@ describe provider_class do
|
|
141
141
|
end
|
142
142
|
end
|
143
143
|
|
144
|
+
describe "when checking service status" do
|
145
|
+
context "On systems which use the systemd-sysvinit compatibility layer" do
|
146
|
+
it "should call systemctl to determine running status in Debian" do
|
147
|
+
Facter.stubs(:value).with(:operatingsystem).returns('Debian')
|
148
|
+
Facter.stubs(:value).with(:operatingsystemmajrelease).returns('8')
|
149
|
+
@resource.stubs(:[]).with(:hasstatus).returns(:true)
|
150
|
+
expect(@provider.statuscmd).to eq(["systemctl", "is-active", @resource[:name]])
|
151
|
+
end
|
152
|
+
|
153
|
+
it "should call systemctl to determine running status in Ubuntu" do
|
154
|
+
Facter.stubs(:value).with(:operatingsystem).returns('Ubuntu')
|
155
|
+
Facter.stubs(:value).with(:operatingsystemmajrelease).returns('15.04')
|
156
|
+
@resource.stubs(:[]).with(:hasstatus).returns(:true)
|
157
|
+
expect(@provider.statuscmd).to eq(["systemctl", "is-active", @resource[:name]])
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
context "On systems which only use sysvinit" do
|
162
|
+
it "should use the service init script" do
|
163
|
+
Facter.stubs(:value).with(:operatingsystem).returns('Debian')
|
164
|
+
Facter.stubs(:value).with(:operatingsystemmajrelease).returns('7')
|
165
|
+
@resource.stubs(:[]).with(:hasstatus).returns(:true)
|
166
|
+
@provider.stubs(:initscript).returns("/etc/init.d/script")
|
167
|
+
expect(@provider.statuscmd).to eq(["/etc/init.d/script", :status])
|
168
|
+
end
|
169
|
+
end
|
170
|
+
end
|
144
171
|
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
provider_class = Puppet::Type.type(:service).provider(:rcng)
|
6
|
+
|
7
|
+
describe provider_class, :unless => Puppet.features.microsoft_windows? do
|
8
|
+
before :each do
|
9
|
+
Puppet::Type.type(:service).stubs(:defaultprovider).returns described_class
|
10
|
+
Facter.stubs(:value).with(:operatingsystem).returns :netbsd
|
11
|
+
Facter.stubs(:value).with(:osfamily).returns 'NetBSD'
|
12
|
+
described_class.stubs(:defpath).returns('/etc/rc.d')
|
13
|
+
@provider = provider_class.new
|
14
|
+
@provider.stubs(:initscript)
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "#enable" do
|
18
|
+
it "should have an enable method" do
|
19
|
+
expect(@provider).to respond_to(:enable)
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should set the proper contents to enable" do
|
23
|
+
provider = described_class.new(Puppet::Type.type(:service).new(:name => 'sshd'))
|
24
|
+
Dir.stubs(:mkdir).with('/etc/rc.conf.d')
|
25
|
+
fh = stub 'fh'
|
26
|
+
Puppet::Util.expects(:replace_file).with('/etc/rc.conf.d/sshd', 0644).yields(fh)
|
27
|
+
fh.expects(:puts).with("sshd=${sshd:=YES}\n")
|
28
|
+
provider.enable
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should set the proper contents to enable when disabled" do
|
32
|
+
provider = described_class.new(Puppet::Type.type(:service).new(:name => 'sshd'))
|
33
|
+
Dir.stubs(:mkdir).with('/etc/rc.conf.d')
|
34
|
+
File.stubs(:read).with('/etc/rc.conf.d/sshd').returns("sshd_enable=\"NO\"\n")
|
35
|
+
fh = stub 'fh'
|
36
|
+
Puppet::Util.expects(:replace_file).with('/etc/rc.conf.d/sshd', 0644).yields(fh)
|
37
|
+
fh.expects(:puts).with("sshd=${sshd:=YES}\n")
|
38
|
+
provider.enable
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -23,7 +23,7 @@ describe provider_class, :if => Puppet.features.posix? do
|
|
23
23
|
Facter.stubs(:value).with(:osfamily).returns 'RedHat'
|
24
24
|
end
|
25
25
|
|
26
|
-
osfamily = [ 'RedHat'
|
26
|
+
osfamily = [ 'RedHat' ]
|
27
27
|
|
28
28
|
osfamily.each do |osfamily|
|
29
29
|
it "should be the default provider on #{osfamily}" do
|
@@ -32,6 +32,13 @@ describe provider_class, :if => Puppet.features.posix? do
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
+
it "should be the default provider on sles11" do
|
36
|
+
Facter.stubs(:value).with(:osfamily).returns(:suse)
|
37
|
+
Facter.stubs(:value).with(:operatingsystem).returns(:suse)
|
38
|
+
Facter.stubs(:value).with(:operatingsystemmajrelease).returns("11")
|
39
|
+
expect(described_class.default?).to be_truthy
|
40
|
+
end
|
41
|
+
|
35
42
|
# test self.instances
|
36
43
|
describe "when getting all service instances" do
|
37
44
|
before :each do
|
@@ -28,7 +28,7 @@ describe provider_class, :if => Puppet.features.posix? do
|
|
28
28
|
end
|
29
29
|
|
30
30
|
it "should get a list of services (excluding legacy)" do
|
31
|
-
provider_class.expects(:svcs).with().returns File.read(my_fixture('svcs.out'))
|
31
|
+
provider_class.expects(:svcs).with('-H').returns File.read(my_fixture('svcs.out'))
|
32
32
|
instances = provider_class.instances.map { |p| {:name => p.get(:name), :ensure => p.get(:ensure)} }
|
33
33
|
# we dont manage legacy
|
34
34
|
expect(instances.size).to eq(2)
|
@@ -99,21 +99,31 @@ describe provider_class, :if => Puppet.features.posix? do
|
|
99
99
|
describe "when starting" do
|
100
100
|
it "should enable the service if it is not enabled" do
|
101
101
|
@provider.expects(:status).returns :stopped
|
102
|
-
@provider.expects(:texecute)
|
102
|
+
@provider.expects(:texecute).with(:start, ['/usr/sbin/svcadm', :enable, '-s', '/system/myservice'], true)
|
103
|
+
@provider.expects(:wait).with('online')
|
103
104
|
@provider.start
|
104
105
|
end
|
105
106
|
|
106
107
|
it "should always execute external command 'svcadm enable /system/myservice'" do
|
107
|
-
@provider.
|
108
|
-
@provider.expects(:texecute).with(:start, [
|
108
|
+
@provider.expects(:status).returns :running
|
109
|
+
@provider.expects(:texecute).with(:start, ['/usr/sbin/svcadm', :enable, '-s', '/system/myservice'], true)
|
110
|
+
@provider.expects(:wait).with('online')
|
109
111
|
@provider.start
|
110
112
|
end
|
111
113
|
|
112
114
|
it "should execute external command 'svcadm clear /system/myservice' if in maintenance" do
|
113
115
|
@provider.stubs(:status).returns :maintenance
|
114
116
|
@provider.expects(:texecute).with(:start, ["/usr/sbin/svcadm", :clear, "/system/myservice"], true)
|
117
|
+
@provider.expects(:wait).with('online')
|
115
118
|
@provider.start
|
116
119
|
end
|
120
|
+
|
121
|
+
it "should error if timeout occurs while starting the service" do
|
122
|
+
@provider.expects(:status).returns :stopped
|
123
|
+
@provider.expects(:texecute).with(:start, ["/usr/sbin/svcadm", :enable, "-s", "/system/myservice"], true)
|
124
|
+
Timeout.expects(:timeout).with(60).raises(Timeout::Error)
|
125
|
+
expect { @provider.start }.to raise_error Puppet::Error, ('Timed out waiting for /system/myservice to transition states')
|
126
|
+
end
|
117
127
|
end
|
118
128
|
|
119
129
|
describe "when starting a service with a manifest" do
|
@@ -126,6 +136,7 @@ describe provider_class, :if => Puppet.features.posix? do
|
|
126
136
|
it "should import the manifest if service is missing" do
|
127
137
|
@provider.expects(:svccfg).with(:import, "/tmp/myservice.xml")
|
128
138
|
@provider.expects(:texecute).with(:start, ["/usr/sbin/svcadm", :enable, "-s", "/system/myservice"], true)
|
139
|
+
@provider.expects(:wait).with('online')
|
129
140
|
@provider.expects(:svcs).with('-H', '-o', 'state,nstate', "/system/myservice").returns("online\t-")
|
130
141
|
@provider.start
|
131
142
|
end
|
@@ -139,15 +150,29 @@ describe provider_class, :if => Puppet.features.posix? do
|
|
139
150
|
describe "when stopping" do
|
140
151
|
it "should execute external command 'svcadm disable /system/myservice'" do
|
141
152
|
@provider.expects(:texecute).with(:stop, ["/usr/sbin/svcadm", :disable, "-s", "/system/myservice"], true)
|
153
|
+
@provider.expects(:wait).with('offline', 'disabled', 'uninitialized')
|
142
154
|
@provider.stop
|
143
155
|
end
|
156
|
+
|
157
|
+
it "should error if timeout occurs while stopping the service" do
|
158
|
+
@provider.expects(:texecute).with(:stop, ["/usr/sbin/svcadm", :disable, "-s", "/system/myservice"], true)
|
159
|
+
Timeout.expects(:timeout).with(60).raises(Timeout::Error)
|
160
|
+
expect { @provider.stop }.to raise_error Puppet::Error, ('Timed out waiting for /system/myservice to transition states')
|
161
|
+
end
|
144
162
|
end
|
145
163
|
|
146
164
|
describe "when restarting" do
|
147
165
|
it "should call 'svcadm restart /system/myservice'" do
|
148
166
|
@provider.expects(:texecute).with(:restart, ["/usr/sbin/svcadm", :restart, "/system/myservice"], true)
|
167
|
+
@provider.expects(:wait).with('online')
|
149
168
|
@provider.restart
|
150
169
|
end
|
151
|
-
end
|
152
170
|
|
171
|
+
it "should error if timeout occurs while restarting the service" do
|
172
|
+
@provider.expects(:texecute).with(:restart, ["/usr/sbin/svcadm", :restart, "/system/myservice"], true)
|
173
|
+
Timeout.expects(:timeout).with(60).raises(Timeout::Error)
|
174
|
+
expect { @provider.restart }.to raise_error Puppet::Error, ('Timed out waiting for /system/myservice to transition states')
|
175
|
+
end
|
176
|
+
|
177
|
+
end
|
153
178
|
end
|
@@ -37,7 +37,7 @@ describe provider_class do
|
|
37
37
|
end
|
38
38
|
|
39
39
|
describe ".instances" do
|
40
|
-
it "should
|
40
|
+
it "should have a .instances method" do
|
41
41
|
expect(provider_class).to respond_to :instances
|
42
42
|
end
|
43
43
|
|
@@ -63,15 +63,29 @@ _EOF_
|
|
63
63
|
describe "when starting a service" do
|
64
64
|
it "should execute the startsrc command" do
|
65
65
|
@provider.expects(:execute).with(['/usr/bin/startsrc', '-s', "myservice"], {:override_locale => false, :squelch => false, :combine => true, :failonfail => true})
|
66
|
+
@provider.expects(:status).returns :running
|
66
67
|
@provider.start
|
67
68
|
end
|
69
|
+
|
70
|
+
it "should error if timeout occurs while stopping the service" do
|
71
|
+
@provider.expects(:execute).with(['/usr/bin/startsrc', '-s', "myservice"], {:override_locale => false, :squelch => false, :combine => true, :failonfail => true})
|
72
|
+
Timeout.expects(:timeout).with(60).raises(Timeout::Error)
|
73
|
+
expect { @provider.start }.to raise_error Puppet::Error, ('Timed out waiting for myservice to transition states')
|
74
|
+
end
|
68
75
|
end
|
69
76
|
|
70
77
|
describe "when stopping a service" do
|
71
78
|
it "should execute the stopsrc command" do
|
72
79
|
@provider.expects(:execute).with(['/usr/bin/stopsrc', '-s', "myservice"], {:override_locale => false, :squelch => false, :combine => true, :failonfail => true})
|
80
|
+
@provider.expects(:status).returns :stopped
|
73
81
|
@provider.stop
|
74
82
|
end
|
83
|
+
|
84
|
+
it "should error if timeout occurs while stopping the service" do
|
85
|
+
@provider.expects(:execute).with(['/usr/bin/stopsrc', '-s', "myservice"], {:override_locale => false, :squelch => false, :combine => true, :failonfail => true})
|
86
|
+
Timeout.expects(:timeout).with(60).raises(Timeout::Error)
|
87
|
+
expect { @provider.stop }.to raise_error Puppet::Error, ('Timed out waiting for myservice to transition states')
|
88
|
+
end
|
75
89
|
end
|
76
90
|
|
77
91
|
describe "should have a set of methods" do
|
@@ -160,14 +174,15 @@ _EOF_
|
|
160
174
|
@provider.restart
|
161
175
|
end
|
162
176
|
|
163
|
-
it "should execute restart which runs
|
177
|
+
it "should execute restart which runs stop then start" do
|
164
178
|
sample_output = <<_EOF_
|
165
179
|
#subsysname:synonym:cmdargs:path:uid:auditid:standin:standout:standerr:action:multi:contact:svrkey:svrmtype:priority:signorm:sigforce:display:waittime:grpname:
|
166
180
|
myservice::--no-daemonize:/usr/sbin/puppetd:0:0:/dev/null:/var/log/puppet.log:/var/log/puppet.log:-O:-Q:-S:0:0:20:15:9:-d:20::"
|
167
181
|
_EOF_
|
182
|
+
|
168
183
|
@provider.expects(:execute).with(['/usr/bin/lssrc', '-Ss', "myservice"]).returns sample_output
|
169
|
-
@provider.expects(:
|
170
|
-
@provider.expects(:
|
184
|
+
@provider.expects(:stop)
|
185
|
+
@provider.expects(:start)
|
171
186
|
@provider.restart
|
172
187
|
end
|
173
188
|
end
|
@@ -10,7 +10,6 @@ describe Puppet::Type.type(:service).provider(:systemd) do
|
|
10
10
|
described_class.stubs(:which).with('systemctl').returns '/bin/systemctl'
|
11
11
|
end
|
12
12
|
|
13
|
-
|
14
13
|
let :provider do
|
15
14
|
described_class.new(:name => 'sshd.service')
|
16
15
|
end
|
@@ -19,14 +18,14 @@ describe Puppet::Type.type(:service).provider(:systemd) do
|
|
19
18
|
|
20
19
|
osfamily.each do |osfamily|
|
21
20
|
it "should be the default provider on #{osfamily}" do
|
22
|
-
Facter.
|
21
|
+
Facter.stubs(:value).with(:osfamily).returns(osfamily)
|
23
22
|
expect(described_class.default?).to be_truthy
|
24
23
|
end
|
25
24
|
end
|
26
25
|
|
27
26
|
it "should be the default provider on rhel7" do
|
28
|
-
Facter.
|
29
|
-
Facter.
|
27
|
+
Facter.stubs(:value).with(:osfamily).returns(:redhat)
|
28
|
+
Facter.stubs(:value).with(:operatingsystemmajrelease).returns("7")
|
30
29
|
expect(described_class.default?).to be_truthy
|
31
30
|
end
|
32
31
|
|
@@ -36,7 +35,7 @@ describe Puppet::Type.type(:service).provider(:systemd) do
|
|
36
35
|
# caused short-circuiting of the logic used by default.all? in the
|
37
36
|
# provider. As a workaround we need to use stubs() instead of
|
38
37
|
# expects() here.
|
39
|
-
Facter.
|
38
|
+
Facter.stubs(:value).with(:osfamily).returns(:redhat)
|
40
39
|
Facter.stubs(:value).with(:operatingsystem).returns(:redhat)
|
41
40
|
Facter.stubs(:value).with(:operatingsystemmajrelease).returns("#{ver}")
|
42
41
|
expect(described_class.default?).not_to be_truthy
|
@@ -45,57 +44,64 @@ describe Puppet::Type.type(:service).provider(:systemd) do
|
|
45
44
|
|
46
45
|
[ 17, 18, 19, 20, 21 ].each do |ver|
|
47
46
|
it "should be the default provider on fedora#{ver}" do
|
48
|
-
Facter.
|
49
|
-
Facter.
|
50
|
-
Facter.
|
47
|
+
Facter.stubs(:value).with(:osfamily).returns(:redhat)
|
48
|
+
Facter.stubs(:value).with(:operatingsystem).returns(:fedora)
|
49
|
+
Facter.stubs(:value).with(:operatingsystemmajrelease).returns("#{ver}")
|
51
50
|
expect(described_class.default?).to be_truthy
|
52
51
|
end
|
53
52
|
end
|
54
53
|
|
55
54
|
it "should be the default provider on sles12" do
|
56
|
-
Facter.
|
57
|
-
Facter.
|
55
|
+
Facter.stubs(:value).with(:osfamily).returns(:suse)
|
56
|
+
Facter.stubs(:value).with(:operatingsystemmajrelease).returns("12")
|
58
57
|
expect(described_class.default?).to be_truthy
|
59
58
|
end
|
60
59
|
|
61
60
|
it "should be the default provider on opensuse13" do
|
62
|
-
Facter.
|
63
|
-
Facter.
|
61
|
+
Facter.stubs(:value).with(:osfamily).returns(:suse)
|
62
|
+
Facter.stubs(:value).with(:operatingsystemmajrelease).returns("13")
|
64
63
|
expect(described_class.default?).to be_truthy
|
65
64
|
end
|
66
65
|
|
67
|
-
|
68
|
-
|
69
|
-
Facter.
|
70
|
-
Facter.
|
71
|
-
expect(described_class.default?).
|
66
|
+
# tumbleweed is a rolling release with date-based major version numbers
|
67
|
+
it "should be the default provider on tumbleweed" do
|
68
|
+
Facter.stubs(:value).with(:osfamily).returns(:suse)
|
69
|
+
Facter.stubs(:value).with(:operatingsystemmajrelease).returns("20150829")
|
70
|
+
expect(described_class.default?).to be_truthy
|
71
|
+
end
|
72
|
+
|
73
|
+
# leap is the next generation suse release
|
74
|
+
it "should be the default provider on leap" do
|
75
|
+
Facter.stubs(:value).with(:osfamily).returns(:suse)
|
76
|
+
Facter.stubs(:value).with(:operatingsystemmajrelease).returns("42")
|
77
|
+
expect(described_class.default?).to be_truthy
|
72
78
|
end
|
73
79
|
|
74
80
|
it "should not be the default provider on debian7" do
|
75
|
-
Facter.
|
76
|
-
Facter.
|
77
|
-
Facter.
|
81
|
+
Facter.stubs(:value).with(:osfamily).returns(:debian)
|
82
|
+
Facter.stubs(:value).with(:operatingsystem).returns(:debian)
|
83
|
+
Facter.stubs(:value).with(:operatingsystemmajrelease).returns("7")
|
78
84
|
expect(described_class.default?).not_to be_truthy
|
79
85
|
end
|
80
86
|
|
81
87
|
it "should be the default provider on debian8" do
|
82
|
-
Facter.
|
83
|
-
Facter.
|
84
|
-
Facter.
|
88
|
+
Facter.stubs(:value).with(:osfamily).returns(:debian)
|
89
|
+
Facter.stubs(:value).with(:operatingsystem).returns(:debian)
|
90
|
+
Facter.stubs(:value).with(:operatingsystemmajrelease).returns("8")
|
85
91
|
expect(described_class.default?).to be_truthy
|
86
92
|
end
|
87
93
|
|
88
94
|
it "should not be the default provider on ubuntu14.04" do
|
89
|
-
Facter.
|
90
|
-
Facter.
|
91
|
-
Facter.
|
95
|
+
Facter.stubs(:value).with(:osfamily).returns(:debian)
|
96
|
+
Facter.stubs(:value).with(:operatingsystem).returns(:ubuntu)
|
97
|
+
Facter.stubs(:value).with(:operatingsystemmajrelease).returns("14.04")
|
92
98
|
expect(described_class.default?).not_to be_truthy
|
93
99
|
end
|
94
100
|
|
95
101
|
it "should be the default provider on ubuntu15.04" do
|
96
|
-
Facter.
|
97
|
-
Facter.
|
98
|
-
Facter.
|
102
|
+
Facter.stubs(:value).with(:osfamily).returns(:debian)
|
103
|
+
Facter.stubs(:value).with(:operatingsystem).returns(:ubuntu)
|
104
|
+
Facter.stubs(:value).with(:operatingsystemmajrelease).returns("15.04")
|
99
105
|
expect(described_class.default?).to be_truthy
|
100
106
|
end
|
101
107
|
|
@@ -264,6 +270,49 @@ describe Puppet::Type.type(:service).provider(:systemd) do
|
|
264
270
|
end
|
265
271
|
end
|
266
272
|
|
273
|
+
describe "#debian_enabled?" do
|
274
|
+
[104, 106].each do |status|
|
275
|
+
it "should return true when invoke-rc.d returns #{status}" do
|
276
|
+
provider = described_class.new(Puppet::Type.type(:service).new(:name => 'sshd.service'))
|
277
|
+
provider.stubs(:system)
|
278
|
+
$CHILD_STATUS.expects(:exitstatus).returns(status)
|
279
|
+
expect(provider.debian_enabled?({:LoadState => "loaded", :UnitFileState => "UnitFileState"})).to eq(:true)
|
280
|
+
end
|
281
|
+
end
|
282
|
+
|
283
|
+
[101, 105].each do |status|
|
284
|
+
it "should return true when status is #{status} and there are at least 4 start links" do
|
285
|
+
provider = described_class.new(Puppet::Type.type(:service).new(:name => 'sshd.service'))
|
286
|
+
provider.stubs(:system)
|
287
|
+
provider.expects(:get_start_link_count).returns(4)
|
288
|
+
$CHILD_STATUS.expects(:exitstatus).twice.returns(status)
|
289
|
+
expect(provider.debian_enabled?({:LoadState => "loaded", :UnitFileState => "UnitFileState"})).to eq(:true)
|
290
|
+
end
|
291
|
+
|
292
|
+
it "should return false when status is #{status} and there are less than 4 start links" do
|
293
|
+
provider = described_class.new(Puppet::Type.type(:service).new(:name => 'sshd.service'))
|
294
|
+
provider.stubs(:system)
|
295
|
+
provider.expects(:get_start_link_count).returns(1)
|
296
|
+
$CHILD_STATUS.expects(:exitstatus).twice.returns(status)
|
297
|
+
expect(provider.debian_enabled?({:LoadState => "loaded", :UnitFileState => "UnitFileState"})).to eq(:false)
|
298
|
+
end
|
299
|
+
end
|
300
|
+
end
|
301
|
+
|
302
|
+
describe "#get_start_link_count" do
|
303
|
+
it "should strip the '.service' from the search if present in the resource name" do
|
304
|
+
provider = described_class.new(Puppet::Type.type(:service).new(:name => 'sshd.service'))
|
305
|
+
Dir.expects(:glob).with("/etc/rc*.d/S??sshd").returns(['files'])
|
306
|
+
provider.get_start_link_count
|
307
|
+
end
|
308
|
+
|
309
|
+
it "should use the full service name if it does not include '.service'" do
|
310
|
+
provider = described_class.new(Puppet::Type.type(:service).new(:name => 'sshd'))
|
311
|
+
Dir.expects(:glob).with("/etc/rc*.d/S??sshd").returns(['files'])
|
312
|
+
provider.get_start_link_count
|
313
|
+
end
|
314
|
+
end
|
315
|
+
|
267
316
|
it "(#16451) has command systemctl without being fully qualified" do
|
268
317
|
expect(described_class.instance_variable_get(:@commands)).to include(:systemctl => 'systemctl')
|
269
318
|
end
|