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
data/spec/unit/daemon_spec.rb
CHANGED
@@ -45,15 +45,24 @@ describe Puppet::Daemon, :unless => Puppet.features.microsoft_windows? do
|
|
45
45
|
end
|
46
46
|
|
47
47
|
describe "when setting signal traps" do
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
48
|
+
[:INT, :TERM].each do |signal|
|
49
|
+
it "logs a notice and exits when sent #{signal}" do
|
50
|
+
Signal.stubs(:trap).with(signal).yields
|
51
|
+
Puppet.expects(:notice).with("Caught #{signal}; exiting")
|
52
|
+
daemon.expects(:stop)
|
53
53
|
|
54
|
-
|
54
|
+
daemon.set_signal_traps
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
{:HUP => :restart, :USR1 => :reload, :USR2 => :reopen_logs}.each do |signal, method|
|
59
|
+
it "logs a notice and remembers to call #{method} when it receives #{signal}" do
|
60
|
+
Signal.stubs(:trap).with(signal).yields
|
61
|
+
Puppet.expects(:notice).with("Caught #{signal}; storing #{method}")
|
55
62
|
|
56
63
|
daemon.set_signal_traps
|
64
|
+
|
65
|
+
expect(daemon.signals).to eq([method])
|
57
66
|
end
|
58
67
|
end
|
59
68
|
end
|
@@ -176,7 +185,8 @@ describe Puppet::Daemon, :unless => Puppet.features.microsoft_windows? do
|
|
176
185
|
end
|
177
186
|
|
178
187
|
it "should do nothing if the agent is running" do
|
179
|
-
agent.expects(:
|
188
|
+
agent.expects(:run).with({:splay => false}).raises Puppet::LockError, 'Failed to aquire lock'
|
189
|
+
Puppet.expects(:notice).with('Not triggering already-running agent')
|
180
190
|
|
181
191
|
daemon.agent = agent
|
182
192
|
|
@@ -184,8 +194,8 @@ describe Puppet::Daemon, :unless => Puppet.features.microsoft_windows? do
|
|
184
194
|
end
|
185
195
|
|
186
196
|
it "should run the agent if one is available and it is not running" do
|
187
|
-
agent.expects(:running?).returns false
|
188
197
|
agent.expects(:run).with({:splay => false})
|
198
|
+
Puppet.expects(:notice).with('Not triggering already-running agent').never
|
189
199
|
|
190
200
|
daemon.agent = agent
|
191
201
|
|
@@ -0,0 +1,201 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
require 'spec_helper'
|
3
|
+
require 'puppet_spec/compiler'
|
4
|
+
|
5
|
+
describe "when using a hiera data provider" do
|
6
|
+
include PuppetSpec::Compiler
|
7
|
+
|
8
|
+
# There is a fully configured 'sample' environment in fixtures at this location
|
9
|
+
let(:environmentpath) { parent_fixture('environments') }
|
10
|
+
|
11
|
+
let(:facts) { Puppet::Node::Facts.new("facts", {}) }
|
12
|
+
|
13
|
+
around(:each) do |example|
|
14
|
+
# Initialize settings to get a full compile as close as possible to a real
|
15
|
+
# environment load
|
16
|
+
Puppet.settings.initialize_global_settings
|
17
|
+
# Initialize loaders based on the environmentpath. It does not work to
|
18
|
+
# just set the setting environmentpath for some reason - this achieves the same:
|
19
|
+
# - first a loader is created, loading directory environments from the fixture (there is
|
20
|
+
# one environment, 'sample', which will be loaded since the node references this
|
21
|
+
# environment by name).
|
22
|
+
# - secondly, the created env loader is set as 'environments' in the puppet context.
|
23
|
+
#
|
24
|
+
loader = Puppet::Environments::Directories.new(environmentpath, [])
|
25
|
+
Puppet.override(:environments => loader) do
|
26
|
+
example.run
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def compile_and_get_notifications(environment, code = nil)
|
31
|
+
compile(environment, code).resources.map(&:ref).select { |r| r.start_with?('Notify[') }.map { |r| r[7..-2] }
|
32
|
+
end
|
33
|
+
|
34
|
+
def compile(environment, code = nil)
|
35
|
+
Puppet[:code] = code if code
|
36
|
+
node = Puppet::Node.new("testnode", :facts => facts, :environment => environment)
|
37
|
+
compiler = Puppet::Parser::Compiler.new(node)
|
38
|
+
block_given? ? compiler.compile() { |catalog| yield(compiler); catalog } : compiler.compile()
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'uses default configuration for environment and module data' do
|
42
|
+
resources = compile_and_get_notifications('hiera_defaults')
|
43
|
+
expect(resources).to include('module data param_a is 100, param default is 200, env data param_c is 300')
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'reads hiera.yaml in environment root and configures multiple json and yaml providers' do
|
47
|
+
resources = compile_and_get_notifications('hiera_env_config')
|
48
|
+
expect(resources).to include('env data param_a is 10, env data param_b is 20, env data param_c is 30, env data param_d is 40, env data param_e is 50')
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'reads hiera.yaml in module root and configures multiple json and yaml providers' do
|
52
|
+
resources = compile_and_get_notifications('hiera_module_config')
|
53
|
+
expect(resources).to include('module data param_a is 100, module data param_b is 200, module data param_c is 300, module data param_d is 400, module data param_e is 500')
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'does not perform merge of values declared in environment and module when resolving parameters' do
|
57
|
+
resources = compile_and_get_notifications('hiera_misc')
|
58
|
+
expect(resources).to include('env 1, ')
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'performs hash merge of values declared in environment and module' do
|
62
|
+
resources = compile_and_get_notifications('hiera_misc', '$r = lookup(one::test::param, Hash[String,String], hash) notify{"${r[key1]}, ${r[key2]}":}')
|
63
|
+
expect(resources).to include('env 1, module 2')
|
64
|
+
end
|
65
|
+
|
66
|
+
it 'performs unique merge of values declared in environment and module' do
|
67
|
+
resources = compile_and_get_notifications('hiera_misc', '$r = lookup(one::array, Array[String], unique) notify{"${r}":}')
|
68
|
+
expect(resources.size).to eq(1)
|
69
|
+
expect(resources[0][1..-2].split(', ')).to contain_exactly('first', 'second', 'third', 'fourth')
|
70
|
+
end
|
71
|
+
|
72
|
+
it 'performs merge found in lookup_options in environment of values declared in environment and module' do
|
73
|
+
resources = compile_and_get_notifications('hiera_misc', 'include one::lopts_test')
|
74
|
+
expect(resources.size).to eq(1)
|
75
|
+
expect(resources[0]).to eq('A, B, C, MA, MB, MC')
|
76
|
+
end
|
77
|
+
|
78
|
+
it 'performs merge found in lookup_options in module of values declared in environment and module' do
|
79
|
+
resources = compile_and_get_notifications('hiera_misc', 'include one::loptsm_test')
|
80
|
+
expect(resources.size).to eq(1)
|
81
|
+
expect(resources[0]).to eq('A, B, C, MA, MB, MC')
|
82
|
+
end
|
83
|
+
|
84
|
+
it "can lookup the 'lookup_options' hash as a regular value" do
|
85
|
+
resources = compile_and_get_notifications('hiera_misc', '$r = lookup(lookup_options, Hash[String,Hash[String,String]], hash) notify{"${r[one::lopts_test::hash][merge]}":}')
|
86
|
+
expect(resources.size).to eq(1)
|
87
|
+
expect(resources[0]).to eq('deep')
|
88
|
+
end
|
89
|
+
|
90
|
+
it 'does find unqualified keys in the environment' do
|
91
|
+
resources = compile_and_get_notifications('hiera_misc', 'notify{lookup(ukey1):}')
|
92
|
+
expect(resources).to include('Some value')
|
93
|
+
end
|
94
|
+
|
95
|
+
it 'does not find unqualified keys in the module' do
|
96
|
+
expect do
|
97
|
+
compile_and_get_notifications('hiera_misc', 'notify{lookup(ukey2):}')
|
98
|
+
end.to raise_error(Puppet::ParseError, /did not find a value for the name 'ukey2'/)
|
99
|
+
end
|
100
|
+
|
101
|
+
it 'can use interpolation lookup method "alias"' do
|
102
|
+
resources = compile_and_get_notifications('hiera_misc', 'notify{lookup(km_alias):}')
|
103
|
+
expect(resources).to include('Value from interpolation with alias')
|
104
|
+
end
|
105
|
+
|
106
|
+
it 'can use interpolation lookup method "lookup"' do
|
107
|
+
resources = compile_and_get_notifications('hiera_misc', 'notify{lookup(km_lookup):}')
|
108
|
+
expect(resources).to include('Value from interpolation with lookup')
|
109
|
+
end
|
110
|
+
|
111
|
+
it 'can use interpolation lookup method "hiera"' do
|
112
|
+
resources = compile_and_get_notifications('hiera_misc', 'notify{lookup(km_hiera):}')
|
113
|
+
expect(resources).to include('Value from interpolation with hiera')
|
114
|
+
end
|
115
|
+
|
116
|
+
it 'can use interpolation lookup method "literal"' do
|
117
|
+
resources = compile_and_get_notifications('hiera_misc', 'notify{lookup(km_literal):}')
|
118
|
+
expect(resources).to include('Value from interpolation with literal')
|
119
|
+
end
|
120
|
+
|
121
|
+
it 'can use interpolation lookup method "scope"' do
|
122
|
+
resources = compile_and_get_notifications('hiera_misc', '$target_scope = "with scope" notify{lookup(km_scope):}')
|
123
|
+
expect(resources).to include('Value from interpolation with scope')
|
124
|
+
end
|
125
|
+
|
126
|
+
it 'can use interpolation using default lookup method (scope)' do
|
127
|
+
resources = compile_and_get_notifications('hiera_misc', '$target_default = "with default" notify{lookup(km_default):}')
|
128
|
+
expect(resources).to include('Value from interpolation with default')
|
129
|
+
end
|
130
|
+
|
131
|
+
it 'performs lookup using qualified expressions in interpolation' do
|
132
|
+
resources = compile_and_get_notifications('hiera_misc', "$os = { name => 'Fedora' } notify{lookup(km_qualified):}")
|
133
|
+
expect(resources).to include('Value from qualified interpolation OS = Fedora')
|
134
|
+
end
|
135
|
+
|
136
|
+
it 'can have multiple interpolate expressions in one value' do
|
137
|
+
resources = compile_and_get_notifications('hiera_misc', 'notify{lookup(km_multi):}')
|
138
|
+
expect(resources).to include('cluster/%{::cluster}/%{role}')
|
139
|
+
end
|
140
|
+
|
141
|
+
it 'performs single quoted interpolation' do
|
142
|
+
resources = compile_and_get_notifications('hiera_misc', 'notify{lookup(km_sqalias):}')
|
143
|
+
expect(resources).to include('Value from interpolation with alias')
|
144
|
+
end
|
145
|
+
|
146
|
+
it 'traps endless interpolate recursion' do
|
147
|
+
expect do
|
148
|
+
compile_and_get_notifications('hiera_misc', '$r1 = "%{r2}" $r2 = "%{r1}" notify{lookup(recursive):}')
|
149
|
+
end.to raise_error(Puppet::DataBinding::RecursiveLookupError, /detected in \[recursive, r1, r2\]/)
|
150
|
+
end
|
151
|
+
|
152
|
+
it 'traps bad alias declarations' do
|
153
|
+
expect do
|
154
|
+
compile_and_get_notifications('hiera_misc', "$r1 = 'Alias within string %{alias(\"r2\")}' $r2 = '%{r1}' notify{lookup(recursive):}")
|
155
|
+
end.to raise_error(Puppet::DataBinding::LookupError, /'alias' interpolation is only permitted if the expression is equal to the entire string/)
|
156
|
+
end
|
157
|
+
|
158
|
+
it 'reports syntax errors for JSON files' do
|
159
|
+
expect do
|
160
|
+
compile_and_get_notifications('hiera_bad_syntax_json')
|
161
|
+
end.to raise_error(Puppet::DataBinding::LookupError, /Unable to parse \(#{environmentpath}[^)]+\):/)
|
162
|
+
end
|
163
|
+
|
164
|
+
it 'reports syntax errors for YAML files' do
|
165
|
+
expect do
|
166
|
+
compile_and_get_notifications('hiera_bad_syntax_yaml')
|
167
|
+
end.to raise_error(Puppet::DataBinding::LookupError, /Unable to parse \(#{environmentpath}[^)]+\):/)
|
168
|
+
end
|
169
|
+
|
170
|
+
describe 'when using explain' do
|
171
|
+
it 'will report config path (original and resolved), data path (original and resolved), and interpolation (before and after)' do
|
172
|
+
compile('hiera_misc', '$target_scope = "with scope"') do |compiler|
|
173
|
+
lookup_invocation = Puppet::Pops::Lookup::Invocation.new(compiler.topscope, {}, {}, true)
|
174
|
+
value = Puppet::Pops::Lookup.lookup('km_scope', nil, nil, nil, nil, lookup_invocation)
|
175
|
+
expect(lookup_invocation.explainer.to_s).to eq(<<EOS)
|
176
|
+
Merge strategy first
|
177
|
+
Data Binding "hiera"
|
178
|
+
No such key: "km_scope"
|
179
|
+
Data Provider "Hiera Data Provider, version 4"
|
180
|
+
ConfigurationPath "#{environmentpath}/hiera_misc/hiera.yaml"
|
181
|
+
Data Provider "common"
|
182
|
+
Path "#{environmentpath}/hiera_misc/data/common.yaml"
|
183
|
+
Original path: common
|
184
|
+
Interpolation on "Value from interpolation %{scope("target_scope")}"
|
185
|
+
Global Scope"
|
186
|
+
Found key: "target_scope" value: "with scope"
|
187
|
+
Found key: "km_scope" value: "Value from interpolation with scope"
|
188
|
+
Merged result: "Value from interpolation with scope"
|
189
|
+
EOS
|
190
|
+
end
|
191
|
+
end
|
192
|
+
end
|
193
|
+
def parent_fixture(dir_name)
|
194
|
+
File.absolute_path(File.join(my_fixture_dir(), "../#{dir_name}"))
|
195
|
+
end
|
196
|
+
|
197
|
+
def resources_in(catalog)
|
198
|
+
catalog.resources.map(&:ref)
|
199
|
+
end
|
200
|
+
|
201
|
+
end
|
@@ -72,6 +72,216 @@ describe Puppet::FileBucket::Dipper, :uses_checksums => true do
|
|
72
72
|
expect { @dipper.backup(file) }.to raise_error(Puppet::Error)
|
73
73
|
end
|
74
74
|
|
75
|
+
describe "when diffing on a local filebucket" do
|
76
|
+
describe "in non-windows environments", :unless => Puppet.features.microsoft_windows? do
|
77
|
+
with_digest_algorithms do
|
78
|
+
|
79
|
+
it "should fail in an informative way when one or more checksum doesn't exists" do
|
80
|
+
@dipper = Puppet::FileBucket::Dipper.new(:Path => tmpdir("bucket"))
|
81
|
+
wrong_checksum = "DEADBEEF"
|
82
|
+
|
83
|
+
# First checksum fails
|
84
|
+
expect { @dipper.diff(wrong_checksum, "WEIRDCKSM", nil, nil) }.to raise_error(RuntimeError, "Invalid checksum #{wrong_checksum.inspect}")
|
85
|
+
|
86
|
+
file = make_tmp_file(plaintext)
|
87
|
+
@dipper.backup(file)
|
88
|
+
|
89
|
+
#Diff_with checksum fails
|
90
|
+
expect { @dipper.diff(checksum, wrong_checksum, nil, nil) }.to raise_error(RuntimeError, "could not find diff_with #{wrong_checksum}")
|
91
|
+
end
|
92
|
+
|
93
|
+
it "should properly diff files on the filebucket" do
|
94
|
+
file1 = make_tmp_file("OriginalContent")
|
95
|
+
file2 = make_tmp_file("ModifiedContent")
|
96
|
+
@dipper = Puppet::FileBucket::Dipper.new(:Path => tmpdir("bucket"))
|
97
|
+
checksum1 = @dipper.backup(file1)
|
98
|
+
checksum2 = @dipper.backup(file2)
|
99
|
+
|
100
|
+
# Diff without the context
|
101
|
+
diff12 = `diff -uN #{file1} #{file2} | sed '1,2d'`
|
102
|
+
diff21 = `diff -uN #{file2} #{file1} | sed '1,2d'`
|
103
|
+
|
104
|
+
expect(@dipper.diff(checksum1, checksum2, nil, nil)).to include(diff12)
|
105
|
+
expect(@dipper.diff(checksum1, nil, nil, file2)).to include(diff12)
|
106
|
+
expect(@dipper.diff(nil, checksum2, file1, nil)).to include(diff12)
|
107
|
+
expect(@dipper.diff(nil, nil, file1, file2)).to include(diff12)
|
108
|
+
expect(@dipper.diff(checksum2, checksum1, nil, nil)).to include(diff21)
|
109
|
+
expect(@dipper.diff(checksum2, nil, nil, file1)).to include(diff21)
|
110
|
+
expect(@dipper.diff(nil, checksum1, file2, nil)).to include(diff21)
|
111
|
+
expect(@dipper.diff(nil, nil, file2, file1)).to include(diff21)
|
112
|
+
|
113
|
+
end
|
114
|
+
end
|
115
|
+
describe "in windows environment", :if => Puppet.features.microsoft_windows? do
|
116
|
+
it "should fail in an informative way when trying to diff" do
|
117
|
+
@dipper = Puppet::FileBucket::Dipper.new(:Path => tmpdir("bucket"))
|
118
|
+
wrong_checksum = "DEADBEEF"
|
119
|
+
|
120
|
+
# First checksum fails
|
121
|
+
expect { @dipper.diff(wrong_checksum, "WEIRDCKSM", nil, nil) }.to raise_error(RuntimeError, "Diff is not supported on this platform")
|
122
|
+
|
123
|
+
# Diff_with checksum fails
|
124
|
+
expect { @dipper.diff(checksum, wrong_checksum, nil, nil) }.to raise_error(RuntimeError, "Diff is not supported on this platform")
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
it "should fail in an informative way when there are failures listing files on the server" do
|
130
|
+
@dipper = Puppet::FileBucket::Dipper.new(:Path => "/unexistent/bucket")
|
131
|
+
Puppet::FileBucket::File.indirection.expects(:find).returns nil
|
132
|
+
|
133
|
+
expect { @dipper.list(nil, nil) }.to raise_error(Puppet::Error)
|
134
|
+
end
|
135
|
+
|
136
|
+
describe "listing files in local filebucket" do
|
137
|
+
with_digest_algorithms do
|
138
|
+
it "should list all files present" do
|
139
|
+
Puppet[:bucketdir] = "/my/bucket"
|
140
|
+
file_bucket = tmpdir("bucket")
|
141
|
+
|
142
|
+
@dipper = Puppet::FileBucket::Dipper.new(:Path => file_bucket)
|
143
|
+
|
144
|
+
onehour=60*60
|
145
|
+
twohours=onehour*2
|
146
|
+
|
147
|
+
#First File
|
148
|
+
file1 = make_tmp_file(plaintext)
|
149
|
+
real_path = Pathname.new(file1).realpath
|
150
|
+
expect(digest(plaintext)).to eq(checksum)
|
151
|
+
expect(@dipper.backup(file1)).to eq(checksum)
|
152
|
+
expected_list1_1 = /#{checksum} \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} #{real_path}\n/
|
153
|
+
|
154
|
+
File.open(file1, 'w') {|f| f.write("Blahhhh")}
|
155
|
+
new_checksum = digest("Blahhhh")
|
156
|
+
expect(@dipper.backup(file1)).to eq(new_checksum)
|
157
|
+
expected_list1_2 = /#{new_checksum} \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} #{real_path}\n/
|
158
|
+
|
159
|
+
#Second File
|
160
|
+
content = "DummyFileWithNonSenseTextInIt"
|
161
|
+
file2 = make_tmp_file(content)
|
162
|
+
real_path = Pathname.new(file2).realpath
|
163
|
+
checksum = digest(content)
|
164
|
+
expect(@dipper.backup(file2)).to eq(checksum)
|
165
|
+
expected_list2 = /#{checksum} \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} #{real_path}\n/
|
166
|
+
|
167
|
+
#Third file : Same as the first one with a different path
|
168
|
+
file3 = make_tmp_file(plaintext)
|
169
|
+
real_path = Pathname.new(file3).realpath
|
170
|
+
checksum = digest(plaintext)
|
171
|
+
expect(digest(plaintext)).to eq(checksum)
|
172
|
+
expect(@dipper.backup(file3)).to eq(checksum)
|
173
|
+
date = Time.now
|
174
|
+
expected_list3 = /#{checksum} \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} #{real_path}\n/
|
175
|
+
|
176
|
+
result = @dipper.list(nil, nil)
|
177
|
+
expect(result).to match(expected_list1_1)
|
178
|
+
expect(result).to match(expected_list1_2)
|
179
|
+
expect(result).to match(expected_list2)
|
180
|
+
expect(result).to match(expected_list3)
|
181
|
+
end
|
182
|
+
|
183
|
+
it "should filter with the provided dates" do
|
184
|
+
Puppet[:bucketdir] = "/my/bucket"
|
185
|
+
file_bucket = tmpdir("bucket")
|
186
|
+
|
187
|
+
twentyminutes=60*20
|
188
|
+
thirtyminutes=60*30
|
189
|
+
onehour=60*60
|
190
|
+
twohours=onehour*2
|
191
|
+
threehours=onehour*3
|
192
|
+
|
193
|
+
# First File created now
|
194
|
+
@dipper = Puppet::FileBucket::Dipper.new(:Path => file_bucket)
|
195
|
+
file1 = make_tmp_file(plaintext)
|
196
|
+
real_path = Pathname.new(file1).realpath
|
197
|
+
|
198
|
+
expect(digest(plaintext)).to eq(checksum)
|
199
|
+
expect(@dipper.backup(file1)).to eq(checksum)
|
200
|
+
expected_list1 = /#{checksum} \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} #{real_path}\n/
|
201
|
+
|
202
|
+
# Second File created an hour ago
|
203
|
+
content = "DummyFileWithNonSenseTextInIt"
|
204
|
+
file2 = make_tmp_file(content)
|
205
|
+
real_path = Pathname.new(file2).realpath
|
206
|
+
checksum = digest(content)
|
207
|
+
expect(@dipper.backup(file2)).to eq(checksum)
|
208
|
+
|
209
|
+
# Modify mtime of the second file to be an hour ago
|
210
|
+
onehourago = Time.now - onehour
|
211
|
+
bucketed_paths_file = Dir.glob("#{file_bucket}/**/#{checksum}/paths")
|
212
|
+
FileUtils.touch(bucketed_paths_file, :mtime => onehourago)
|
213
|
+
expected_list2 = /#{checksum} \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} #{real_path}\n/
|
214
|
+
|
215
|
+
now = Time.now
|
216
|
+
|
217
|
+
#Future
|
218
|
+
expect(@dipper.list((now + threehours).strftime("%F %T"), nil )).to eq("")
|
219
|
+
|
220
|
+
#Epoch -> Future = Everything (Sorted (desc) by date)
|
221
|
+
expect(@dipper.list(nil, (now + twohours).strftime("%F %T"))).to match(expected_list1)
|
222
|
+
expect(@dipper.list(nil, (now + twohours).strftime("%F %T"))).to match(expected_list2)
|
223
|
+
|
224
|
+
#Now+1sec -> Future = Nothing
|
225
|
+
expect(@dipper.list((now + 1).strftime("%F %T"), (now + twohours).strftime("%F %T"))).to eq("")
|
226
|
+
|
227
|
+
#Now-30mins -> Now-20mins = Nothing
|
228
|
+
expect(@dipper.list((now - thirtyminutes).strftime("%F %T"), (now - twentyminutes).strftime("%F %T"))).to eq("")
|
229
|
+
|
230
|
+
#Now-2hours -> Now-30mins = Second file only
|
231
|
+
expect(@dipper.list((now - twohours).strftime("%F %T"), (now - thirtyminutes).strftime("%F %T"))).to match(expected_list2)
|
232
|
+
expect(@dipper.list((now - twohours).strftime("%F %T"), (now - thirtyminutes).strftime("%F %T"))).not_to match(expected_list1)
|
233
|
+
|
234
|
+
#Now-30minutes -> Now = First file only
|
235
|
+
expect(@dipper.list((now - thirtyminutes).strftime("%F %T"), now.strftime("%F %T"))).to match(expected_list1)
|
236
|
+
expect(@dipper.list((now - thirtyminutes).strftime("%F %T"), now.strftime("%F %T"))).not_to match(expected_list2)
|
237
|
+
end
|
238
|
+
end
|
239
|
+
end
|
240
|
+
|
241
|
+
describe "when diffing on a remote filebucket" do
|
242
|
+
describe "in non-windows environments", :unless => Puppet.features.microsoft_windows? do
|
243
|
+
with_digest_algorithms do
|
244
|
+
it "should fail in an informative way when one or more checksum doesn't exists" do
|
245
|
+
@dipper = Puppet::FileBucket::Dipper.new(:Server => "puppetmaster", :Port => "31337")
|
246
|
+
wrong_checksum = "DEADBEEF"
|
247
|
+
|
248
|
+
Puppet::FileBucketFile::Rest.any_instance.expects(:find).returns(nil)
|
249
|
+
expect { @dipper.diff(wrong_checksum, "WEIRDCKSM", nil, nil) }.to raise_error(Puppet::Error, "Failed to diff files")
|
250
|
+
|
251
|
+
end
|
252
|
+
|
253
|
+
it "should properly diff files on the filebucket" do
|
254
|
+
@dipper = Puppet::FileBucket::Dipper.new(:Server => "puppetmaster", :Port => "31337")
|
255
|
+
|
256
|
+
Puppet::FileBucketFile::Rest.any_instance.expects(:find).returns("Probably valid diff")
|
257
|
+
|
258
|
+
expect(@dipper.diff("checksum1", "checksum2", nil, nil)).to eq("Probably valid diff")
|
259
|
+
end
|
260
|
+
end
|
261
|
+
end
|
262
|
+
|
263
|
+
describe "in windows environment", :if => Puppet.features.microsoft_windows? do
|
264
|
+
it "should fail in an informative way when trying to diff" do
|
265
|
+
@dipper = Puppet::FileBucket::Dipper.new(:Server => "puppetmaster", :Port => "31337")
|
266
|
+
wrong_checksum = "DEADBEEF"
|
267
|
+
|
268
|
+
expect { @dipper.diff(wrong_checksum, "WEIRDCKSM", nil, nil) }.to raise_error(RuntimeError, "Diff is not supported on this platform")
|
269
|
+
|
270
|
+
expect { @dipper.diff(wrong_checksum, nil, nil, nil) }.to raise_error(RuntimeError, "Diff is not supported on this platform")
|
271
|
+
end
|
272
|
+
end
|
273
|
+
end
|
274
|
+
|
275
|
+
describe "listing files in remote filebucket" do
|
276
|
+
it "is not allowed" do
|
277
|
+
@dipper = Puppet::FileBucket::Dipper.new(:Server => "puppetmaster", :Port=> "31337")
|
278
|
+
|
279
|
+
expect {
|
280
|
+
@dipper.list(nil, nil)
|
281
|
+
}.to raise_error(Puppet::Error, "Listing remote file buckets is not allowed")
|
282
|
+
end
|
283
|
+
end
|
284
|
+
|
75
285
|
describe "backing up and retrieving local files" do
|
76
286
|
with_digest_algorithms do
|
77
287
|
it "should backup files to a local bucket" do
|
@@ -173,4 +383,3 @@ describe Puppet::FileBucket::Dipper, :uses_checksums => true do
|
|
173
383
|
end
|
174
384
|
end
|
175
385
|
end
|
176
|
-
|