puppet 6.4.0-universal-darwin → 6.4.1-universal-darwin
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.
- checksums.yaml +4 -4
- data/Gemfile +0 -1
- data/Gemfile.lock +7 -11
- data/lib/puppet/application/device.rb +97 -82
- data/lib/puppet/application/filebucket.rb +4 -0
- data/lib/puppet/application/ssl.rb +2 -2
- data/lib/puppet/configurer.rb +5 -4
- data/lib/puppet/defaults.rb +33 -11
- data/lib/puppet/indirector/request.rb +28 -15
- data/lib/puppet/ssl.rb +1 -1
- data/lib/puppet/ssl/certificate.rb +1 -1
- data/lib/puppet/ssl/error.rb +1 -1
- data/lib/puppet/ssl/host.rb +0 -47
- data/lib/puppet/ssl/ssl_provider.rb +2 -2
- data/lib/puppet/ssl/state_machine.rb +16 -17
- data/lib/puppet/ssl/validator/default_validator.rb +4 -4
- data/lib/puppet/ssl/verifier.rb +1 -1
- data/lib/puppet/transaction/event_manager.rb +1 -5
- data/lib/puppet/util/connection.rb +15 -8
- data/lib/puppet/util/monkey_patches.rb +20 -1
- data/lib/puppet/version.rb +1 -1
- data/locales/puppet.pot +135 -68
- data/man/man5/puppet.conf.5 +9 -9
- data/man/man8/puppet-agent.8 +1 -1
- data/man/man8/puppet-apply.8 +1 -1
- data/man/man8/puppet-catalog.8 +1 -1
- data/man/man8/puppet-config.8 +1 -1
- data/man/man8/puppet-describe.8 +1 -1
- data/man/man8/puppet-device.8 +1 -1
- data/man/man8/puppet-doc.8 +1 -1
- data/man/man8/puppet-epp.8 +1 -1
- data/man/man8/puppet-facts.8 +1 -1
- data/man/man8/puppet-filebucket.8 +1 -1
- data/man/man8/puppet-generate.8 +1 -1
- data/man/man8/puppet-help.8 +1 -1
- data/man/man8/puppet-key.8 +1 -1
- data/man/man8/puppet-lookup.8 +1 -1
- data/man/man8/puppet-man.8 +1 -1
- data/man/man8/puppet-module.8 +1 -1
- data/man/man8/puppet-node.8 +1 -1
- data/man/man8/puppet-parser.8 +1 -1
- data/man/man8/puppet-plugin.8 +1 -1
- data/man/man8/puppet-report.8 +1 -1
- data/man/man8/puppet-resource.8 +1 -1
- data/man/man8/puppet-script.8 +1 -1
- data/man/man8/puppet-ssl.8 +1 -1
- data/man/man8/puppet-status.8 +1 -1
- data/man/man8/puppet.8 +2 -2
- data/spec/integration/agent/logging_spec.rb +5 -7
- data/spec/integration/application/apply_spec.rb +18 -16
- data/spec/integration/application/doc_spec.rb +1 -2
- data/spec/integration/application/lookup_spec.rb +5 -5
- data/spec/integration/configurer_spec.rb +5 -6
- data/spec/integration/defaults_spec.rb +5 -6
- data/spec/integration/directory_environments_spec.rb +1 -1
- data/spec/integration/faces/config_spec.rb +3 -4
- data/spec/integration/faces/documentation_spec.rb +0 -1
- data/spec/integration/faces/plugin_spec.rb +1 -1
- data/spec/integration/file_bucket/file_spec.rb +2 -4
- data/spec/integration/file_serving/content_spec.rb +0 -1
- data/spec/integration/file_serving/fileset_spec.rb +0 -1
- data/spec/integration/file_serving/metadata_spec.rb +0 -1
- data/spec/integration/file_serving/terminus_helper_spec.rb +0 -1
- data/spec/integration/indirector/catalog/compiler_spec.rb +10 -11
- data/spec/integration/indirector/direct_file_server_spec.rb +1 -1
- data/spec/integration/indirector/facts/facter_spec.rb +4 -5
- data/spec/integration/indirector/file_content/file_server_spec.rb +7 -8
- data/spec/integration/indirector/file_metadata/file_server_spec.rb +7 -8
- data/spec/integration/network/authconfig_spec.rb +23 -24
- data/spec/integration/network/formats_spec.rb +0 -1
- data/spec/integration/network/http_pool_spec.rb +3 -3
- data/spec/integration/node/environment_spec.rb +0 -1
- data/spec/integration/node/facts_spec.rb +9 -10
- data/spec/integration/node_spec.rb +6 -7
- data/spec/integration/parser/catalog_spec.rb +1 -5
- data/spec/integration/parser/collection_spec.rb +1 -2
- data/spec/integration/parser/compiler_spec.rb +6 -6
- data/spec/integration/parser/scope_spec.rb +1 -1
- data/spec/integration/parser/undef_param_spec.rb +1 -1
- data/spec/integration/provider/service/init_spec.rb +4 -5
- data/spec/integration/provider/service/systemd_spec.rb +0 -2
- data/spec/integration/provider/service/windows_spec.rb +1 -2
- data/spec/integration/reference/providers_spec.rb +1 -2
- data/spec/integration/reports_spec.rb +1 -2
- data/spec/integration/resource/catalog_spec.rb +14 -17
- data/spec/integration/resource/type_collection_spec.rb +4 -5
- data/spec/integration/rest/client_spec.rb +1 -1
- data/spec/integration/ssl/certificate_request_spec.rb +0 -1
- data/spec/integration/ssl/host_spec.rb +1 -2
- data/spec/integration/ssl/key_spec.rb +0 -1
- data/spec/integration/test/test_helper_spec.rb +0 -1
- data/spec/integration/transaction/report_spec.rb +6 -11
- data/spec/integration/transaction_spec.rb +18 -19
- data/spec/integration/type/exec_spec.rb +0 -1
- data/spec/integration/type/file_spec.rb +13 -14
- data/spec/integration/type/package_spec.rb +19 -23
- data/spec/integration/type/tidy_spec.rb +1 -2
- data/spec/integration/type_spec.rb +0 -1
- data/spec/integration/util/autoload_spec.rb +1 -2
- data/spec/integration/util/rdoc/parser_spec.rb +0 -1
- data/spec/integration/util/settings_spec.rb +0 -1
- data/spec/integration/util/windows/adsi_spec.rb +3 -5
- data/spec/integration/util/windows/principal_spec.rb +0 -1
- data/spec/integration/util/windows/process_spec.rb +4 -6
- data/spec/integration/util/windows/registry_spec.rb +41 -51
- data/spec/integration/util/windows/security_spec.rb +2 -4
- data/spec/integration/util/windows/user_spec.rb +18 -20
- data/spec/integration/util_spec.rb +4 -7
- data/spec/lib/puppet_spec/compiler.rb +1 -1
- data/spec/lib/puppet_spec/files.rb +0 -1
- data/spec/lib/puppet_spec/module_tool/shared_functions.rb +1 -1
- data/spec/lib/puppet_spec/scope.rb +1 -2
- data/spec/shared_behaviours/all_parsedfile_providers.rb +1 -1
- data/spec/shared_behaviours/file_server_terminus.rb +8 -9
- data/spec/shared_behaviours/file_serving.rb +6 -8
- data/spec/shared_behaviours/file_serving_model.rb +3 -5
- data/spec/shared_behaviours/hiera_indirections.rb +3 -4
- data/spec/shared_behaviours/iterative_functions.rb +0 -1
- data/spec/shared_behaviours/memory_terminus.rb +2 -2
- data/spec/shared_examples/rhel_package_provider.rb +112 -70
- data/spec/spec_helper.rb +10 -1
- data/spec/unit/agent/disabler_spec.rb +4 -5
- data/spec/unit/agent/locker_spec.rb +12 -13
- data/spec/unit/agent_spec.rb +80 -85
- data/spec/unit/application/agent_spec.rb +88 -94
- data/spec/unit/application/apply_spec.rb +82 -83
- data/spec/unit/application/config_spec.rb +0 -1
- data/spec/unit/application/describe_spec.rb +6 -7
- data/spec/unit/application/device_spec.rb +379 -384
- data/spec/unit/application/doc_spec.rb +44 -46
- data/spec/unit/application/face_base_spec.rb +61 -62
- data/spec/unit/application/facts_spec.rb +3 -4
- data/spec/unit/application/filebucket_spec.rb +66 -74
- data/spec/unit/application/indirection_base_spec.rb +8 -6
- data/spec/unit/application/lookup_spec.rb +26 -26
- data/spec/unit/application/resource_spec.rb +42 -48
- data/spec/unit/application/ssl_spec.rb +9 -9
- data/spec/unit/application_spec.rb +82 -92
- data/spec/unit/capability_spec.rb +6 -6
- data/spec/unit/certificate_factory_spec.rb +3 -5
- data/spec/unit/configurer/downloader_spec.rb +20 -21
- data/spec/unit/configurer/fact_handler_spec.rb +2 -3
- data/spec/unit/configurer/plugin_handler_spec.rb +41 -8
- data/spec/unit/configurer_spec.rb +189 -192
- data/spec/unit/confine/exists_spec.rb +17 -15
- data/spec/unit/confine/false_spec.rb +5 -6
- data/spec/unit/confine/feature_spec.rb +7 -5
- data/spec/unit/confine/true_spec.rb +5 -6
- data/spec/unit/confine/variable_spec.rb +14 -15
- data/spec/unit/confine_collection_spec.rb +28 -29
- data/spec/unit/confine_spec.rb +13 -14
- data/spec/unit/confiner_spec.rb +10 -11
- data/spec/unit/context/trusted_information_spec.rb +1 -1
- data/spec/unit/daemon_spec.rb +35 -36
- data/spec/unit/data_providers/function_data_provider_spec.rb +0 -1
- data/spec/unit/data_providers/hiera_data_provider_spec.rb +0 -1
- data/spec/unit/datatypes_spec.rb +3 -4
- data/spec/unit/defaults_spec.rb +18 -13
- data/spec/unit/environments_spec.rb +7 -7
- data/spec/unit/etc_spec.rb +30 -32
- data/spec/unit/external/pson_spec.rb +0 -1
- data/spec/unit/face/catalog_spec.rb +0 -1
- data/spec/unit/face/config_spec.rb +31 -35
- data/spec/unit/face/epp_face_spec.rb +3 -4
- data/spec/unit/face/facts_spec.rb +5 -6
- data/spec/unit/face/generate_spec.rb +4 -5
- data/spec/unit/face/help_spec.rb +7 -8
- data/spec/unit/face/key_spec.rb +0 -1
- data/spec/unit/face/man_spec.rb +1 -2
- data/spec/unit/face/module/install_spec.rb +3 -5
- data/spec/unit/face/module/list_spec.rb +2 -12
- data/spec/unit/face/module/search_spec.rb +11 -9
- data/spec/unit/face/module/uninstall_spec.rb +4 -8
- data/spec/unit/face/node_spec.rb +23 -24
- data/spec/unit/face/parser_spec.rb +3 -3
- data/spec/unit/face/plugin_spec.rb +36 -9
- data/spec/unit/face/status_spec.rb +0 -1
- data/spec/unit/file_bucket/dipper_spec.rb +24 -20
- data/spec/unit/file_bucket/file_spec.rb +0 -2
- data/spec/unit/file_serving/base_spec.rb +14 -15
- data/spec/unit/file_serving/configuration/parser_spec.rb +27 -28
- data/spec/unit/file_serving/configuration_spec.rb +63 -66
- data/spec/unit/file_serving/content_spec.rb +10 -11
- data/spec/unit/file_serving/fileset_spec.rb +63 -58
- data/spec/unit/file_serving/http_metadata_spec.rb +8 -7
- data/spec/unit/file_serving/metadata_spec.rb +36 -36
- data/spec/unit/file_serving/mount/file_spec.rb +31 -32
- data/spec/unit/file_serving/mount/locales_spec.rb +23 -24
- data/spec/unit/file_serving/mount/modules_spec.rb +14 -15
- data/spec/unit/file_serving/mount/pluginfacts_spec.rb +23 -24
- data/spec/unit/file_serving/mount/plugins_spec.rb +23 -24
- data/spec/unit/file_serving/mount/tasks_spec.rb +14 -15
- data/spec/unit/file_serving/mount_spec.rb +0 -1
- data/spec/unit/file_serving/terminus_helper_spec.rb +37 -42
- data/spec/unit/file_serving/terminus_selector_spec.rb +12 -13
- data/spec/unit/file_system/uniquefile_spec.rb +4 -4
- data/spec/unit/file_system_spec.rb +4 -4
- data/spec/unit/forge/errors_spec.rb +1 -1
- data/spec/unit/forge/forge_spec.rb +13 -14
- data/spec/unit/forge/module_release_spec.rb +18 -18
- data/spec/unit/forge/repository_spec.rb +29 -30
- data/spec/unit/forge_spec.rb +15 -11
- data/spec/unit/functions/binary_file_spec.rb +3 -3
- data/spec/unit/functions/contain_spec.rb +0 -2
- data/spec/unit/functions/defined_spec.rb +0 -1
- data/spec/unit/functions/epp_spec.rb +2 -2
- data/spec/unit/functions/find_file_spec.rb +7 -7
- data/spec/unit/functions/include_spec.rb +0 -4
- data/spec/unit/functions/lookup_fixture_spec.rb +0 -1
- data/spec/unit/functions/lookup_spec.rb +1 -2
- data/spec/unit/functions/module_directory_spec.rb +12 -12
- data/spec/unit/functions/require_spec.rb +0 -3
- data/spec/unit/functions/shared.rb +5 -8
- data/spec/unit/functions/versioncmp_spec.rb +1 -2
- data/spec/unit/functions4_spec.rb +9 -10
- data/spec/unit/gettext/config_spec.rb +4 -4
- data/spec/unit/gettext/module_loading_spec.rb +7 -7
- data/spec/unit/graph/rb_tree_map_spec.rb +0 -2
- data/spec/unit/graph/relationship_graph_spec.rb +1 -2
- data/spec/unit/graph/simple_graph_spec.rb +9 -10
- data/spec/unit/hiera_puppet_spec.rb +20 -20
- data/spec/unit/indirector/catalog/compiler_spec.rb +147 -149
- data/spec/unit/indirector/catalog/json_spec.rb +1 -2
- data/spec/unit/indirector/catalog/msgpack_spec.rb +0 -1
- data/spec/unit/indirector/catalog/rest_spec.rb +0 -1
- data/spec/unit/indirector/catalog/store_configs_spec.rb +0 -1
- data/spec/unit/indirector/catalog/yaml_spec.rb +0 -1
- data/spec/unit/indirector/certificate/file_spec.rb +0 -1
- data/spec/unit/indirector/certificate/rest_spec.rb +8 -10
- data/spec/unit/indirector/certificate_request/file_spec.rb +0 -1
- data/spec/unit/indirector/certificate_request/rest_spec.rb +0 -1
- data/spec/unit/indirector/direct_file_server_spec.rb +17 -18
- data/spec/unit/indirector/envelope_spec.rb +1 -2
- data/spec/unit/indirector/exec_spec.rb +4 -5
- data/spec/unit/indirector/face_spec.rb +9 -9
- data/spec/unit/indirector/facts/facter_spec.rb +37 -43
- data/spec/unit/indirector/facts/network_device_spec.rb +8 -9
- data/spec/unit/indirector/facts/rest_spec.rb +7 -8
- data/spec/unit/indirector/facts/store_configs_spec.rb +0 -1
- data/spec/unit/indirector/facts/yaml_spec.rb +0 -1
- data/spec/unit/indirector/file_bucket_file/file_spec.rb +3 -4
- data/spec/unit/indirector/file_bucket_file/rest_spec.rb +0 -1
- data/spec/unit/indirector/file_bucket_file/selector_spec.rb +4 -5
- data/spec/unit/indirector/file_content/file_server_spec.rb +0 -1
- data/spec/unit/indirector/file_content/file_spec.rb +0 -1
- data/spec/unit/indirector/file_content/rest_spec.rb +0 -1
- data/spec/unit/indirector/file_content/selector_spec.rb +0 -1
- data/spec/unit/indirector/file_metadata/file_server_spec.rb +0 -1
- data/spec/unit/indirector/file_metadata/file_spec.rb +12 -13
- data/spec/unit/indirector/file_metadata/rest_spec.rb +0 -1
- data/spec/unit/indirector/file_metadata/selector_spec.rb +0 -1
- data/spec/unit/indirector/file_server_spec.rb +87 -87
- data/spec/unit/indirector/indirection_spec.rb +242 -226
- data/spec/unit/indirector/json_spec.rb +7 -9
- data/spec/unit/indirector/key/file_spec.rb +21 -22
- data/spec/unit/indirector/memory_spec.rb +6 -7
- data/spec/unit/indirector/msgpack_spec.rb +7 -9
- data/spec/unit/indirector/node/exec_spec.rb +2 -3
- data/spec/unit/indirector/node/memory_spec.rb +2 -4
- data/spec/unit/indirector/node/msgpack_spec.rb +0 -1
- data/spec/unit/indirector/node/plain_spec.rb +2 -4
- data/spec/unit/indirector/node/rest_spec.rb +0 -1
- data/spec/unit/indirector/node/store_configs_spec.rb +0 -1
- data/spec/unit/indirector/node/yaml_spec.rb +0 -1
- data/spec/unit/indirector/none_spec.rb +5 -5
- data/spec/unit/indirector/plain_spec.rb +7 -8
- data/spec/unit/indirector/report/msgpack_spec.rb +0 -1
- data/spec/unit/indirector/report/processor_spec.rb +21 -22
- data/spec/unit/indirector/report/rest_spec.rb +11 -12
- data/spec/unit/indirector/report/yaml_spec.rb +0 -1
- data/spec/unit/indirector/request_spec.rb +11 -12
- data/spec/unit/indirector/resource/ral_spec.rb +47 -54
- data/spec/unit/indirector/resource/store_configs_spec.rb +0 -1
- data/spec/unit/indirector/rest_spec.rb +113 -110
- data/spec/unit/indirector/ssl_file_spec.rb +64 -65
- data/spec/unit/indirector/status/local_spec.rb +0 -1
- data/spec/unit/indirector/status/rest_spec.rb +0 -1
- data/spec/unit/indirector/store_configs_spec.rb +0 -1
- data/spec/unit/indirector/terminus_spec.rb +27 -27
- data/spec/unit/indirector/yaml_spec.rb +5 -6
- data/spec/unit/indirector_spec.rb +1 -2
- data/spec/unit/info_service_spec.rb +1 -1
- data/spec/unit/interface/action_builder_spec.rb +0 -1
- data/spec/unit/interface/action_manager_spec.rb +0 -1
- data/spec/unit/interface/action_spec.rb +2 -3
- data/spec/unit/interface/documentation_spec.rb +0 -1
- data/spec/unit/interface/face_collection_spec.rb +19 -12
- data/spec/unit/interface_spec.rb +3 -3
- data/spec/unit/man_spec.rb +3 -4
- data/spec/unit/module_spec.rb +46 -51
- data/spec/unit/module_tool/applications/installer_spec.rb +10 -11
- data/spec/unit/module_tool/applications/searcher_spec.rb +3 -3
- data/spec/unit/module_tool/applications/uninstaller_spec.rb +1 -2
- data/spec/unit/module_tool/applications/unpacker_spec.rb +13 -13
- data/spec/unit/module_tool/applications/upgrader_spec.rb +5 -5
- data/spec/unit/module_tool/install_directory_spec.rb +8 -8
- data/spec/unit/module_tool/installed_modules_spec.rb +3 -3
- data/spec/unit/module_tool/tar/gnu_spec.rb +6 -6
- data/spec/unit/module_tool/tar/mini_spec.rb +12 -12
- data/spec/unit/module_tool/tar_spec.rb +12 -13
- data/spec/unit/module_tool_spec.rb +7 -12
- data/spec/unit/network/auth_config_parser_spec.rb +11 -13
- data/spec/unit/network/authconfig_spec.rb +17 -18
- data/spec/unit/network/authorization_spec.rb +4 -5
- data/spec/unit/network/authstore_spec.rb +0 -1
- data/spec/unit/network/format_handler_spec.rb +0 -1
- data/spec/unit/network/format_spec.rb +9 -10
- data/spec/unit/network/format_support_spec.rb +28 -29
- data/spec/unit/network/formats_spec.rb +4 -5
- data/spec/unit/network/http/api/indirected_routes_spec.rb +24 -29
- data/spec/unit/network/http/api/master/v3/authorization_spec.rb +2 -2
- data/spec/unit/network/http/api/master/v3/environment_spec.rb +1 -1
- data/spec/unit/network/http/api/master/v3/environments_spec.rb +6 -7
- data/spec/unit/network/http/api_spec.rb +0 -2
- data/spec/unit/network/http/compression_spec.rb +21 -22
- data/spec/unit/network/http/connection_spec.rb +35 -35
- data/spec/unit/network/http/factory_spec.rb +5 -6
- data/spec/unit/network/http/handler_spec.rb +9 -18
- data/spec/unit/network/http/nocache_pool_spec.rb +6 -7
- data/spec/unit/network/http/pool_spec.rb +33 -34
- data/spec/unit/network/http/request_spec.rb +0 -2
- data/spec/unit/network/http/response_spec.rb +11 -13
- data/spec/unit/network/http/route_spec.rb +0 -1
- data/spec/unit/network/http/session_spec.rb +2 -3
- data/spec/unit/network/http/site_spec.rb +0 -1
- data/spec/unit/network/http_pool_spec.rb +19 -10
- data/spec/unit/network/http_spec.rb +0 -1
- data/spec/unit/network/resolver_spec.rb +25 -26
- data/spec/unit/network/rights_spec.rb +52 -53
- data/spec/unit/node/environment_spec.rb +14 -15
- data/spec/unit/node/facts_spec.rb +5 -7
- data/spec/unit/node_spec.rb +4 -10
- data/spec/unit/other/selinux_spec.rb +0 -1
- data/spec/unit/parameter/boolean_spec.rb +1 -2
- data/spec/unit/parameter/package_options_spec.rb +1 -2
- data/spec/unit/parameter/path_spec.rb +0 -1
- data/spec/unit/parameter/value_collection_spec.rb +0 -1
- data/spec/unit/parameter/value_spec.rb +0 -1
- data/spec/unit/parameter_spec.rb +9 -9
- data/spec/unit/parser/ast/block_expression_spec.rb +6 -8
- data/spec/unit/parser/ast/leaf_spec.rb +20 -21
- data/spec/unit/parser/compiler_spec.rb +84 -96
- data/spec/unit/parser/environment_compiler_spec.rb +7 -8
- data/spec/unit/parser/files_spec.rb +0 -1
- data/spec/unit/parser/functions/create_resources_spec.rb +1 -1
- data/spec/unit/parser/functions/digest_spec.rb +0 -1
- data/spec/unit/parser/functions/fail_spec.rb +1 -2
- data/spec/unit/parser/functions/file_spec.rb +13 -14
- data/spec/unit/parser/functions/fqdn_rand_spec.rb +5 -6
- data/spec/unit/parser/functions/generate_spec.rb +7 -8
- data/spec/unit/parser/functions/inline_template_spec.rb +0 -1
- data/spec/unit/parser/functions/regsubst_spec.rb +0 -1
- data/spec/unit/parser/functions/scanf_spec.rb +0 -1
- data/spec/unit/parser/functions/shellquote_spec.rb +0 -1
- data/spec/unit/parser/functions/split_spec.rb +0 -1
- data/spec/unit/parser/functions/sprintf_spec.rb +0 -1
- data/spec/unit/parser/functions/tag_spec.rb +1 -2
- data/spec/unit/parser/functions/tagged_spec.rb +2 -3
- data/spec/unit/parser/functions/template_spec.rb +13 -13
- data/spec/unit/parser/functions/versioncmp_spec.rb +1 -2
- data/spec/unit/parser/functions_spec.rb +6 -7
- data/spec/unit/parser/relationship_spec.rb +0 -1
- data/spec/unit/parser/resource_spec.rb +42 -42
- data/spec/unit/parser/scope_spec.rb +39 -35
- data/spec/unit/parser/templatewrapper_spec.rb +11 -12
- data/spec/unit/parser/type_loader_spec.rb +17 -19
- data/spec/unit/pops/adaptable_spec.rb +0 -1
- data/spec/unit/pops/benchmark_spec.rb +0 -1
- data/spec/unit/pops/evaluator/access_ops_spec.rb +0 -1
- data/spec/unit/pops/evaluator/arithmetic_ops_spec.rb +0 -1
- data/spec/unit/pops/evaluator/basic_expressions_spec.rb +0 -1
- data/spec/unit/pops/evaluator/collections_ops_spec.rb +0 -1
- data/spec/unit/pops/evaluator/comparison_ops_spec.rb +0 -1
- data/spec/unit/pops/evaluator/conditionals_spec.rb +0 -1
- data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +10 -11
- data/spec/unit/pops/evaluator/logical_ops_spec.rb +0 -1
- data/spec/unit/pops/evaluator/runtime3_converter_spec.rb +0 -1
- data/spec/unit/pops/evaluator/string_interpolation_spec.rb +0 -1
- data/spec/unit/pops/evaluator/variables_spec.rb +0 -1
- data/spec/unit/pops/factory_spec.rb +3 -4
- data/spec/unit/pops/issues_spec.rb +19 -20
- data/spec/unit/pops/loaders/loader_spec.rb +9 -5
- data/spec/unit/pops/loaders/loaders_spec.rb +31 -28
- data/spec/unit/pops/lookup/context_spec.rb +0 -1
- data/spec/unit/pops/lookup/interpolation_spec.rb +2 -3
- data/spec/unit/pops/merge_strategy_spec.rb +0 -1
- data/spec/unit/pops/migration_spec.rb +3 -5
- data/spec/unit/pops/model/model_spec.rb +0 -1
- data/spec/unit/pops/model/pn_transformer_spec.rb +0 -1
- data/spec/unit/pops/parser/locator_spec.rb +3 -6
- data/spec/unit/pops/parser/parse_application_spec.rb +0 -1
- data/spec/unit/pops/parser/parse_basic_expressions_spec.rb +0 -1
- data/spec/unit/pops/parser/parse_calls_spec.rb +0 -1
- data/spec/unit/pops/parser/parse_capabilities_spec.rb +0 -1
- data/spec/unit/pops/parser/parse_conditionals_spec.rb +0 -1
- data/spec/unit/pops/parser/parse_containers_spec.rb +0 -1
- data/spec/unit/pops/parser/parse_plan_spec.rb +0 -1
- data/spec/unit/pops/parser/parse_resource_spec.rb +0 -1
- data/spec/unit/pops/parser/parse_site_spec.rb +0 -1
- data/spec/unit/pops/parser/pn_parser_spec.rb +0 -1
- data/spec/unit/pops/pn_spec.rb +0 -1
- data/spec/unit/pops/resource/resource_type_impl_spec.rb +0 -1
- data/spec/unit/pops/serialization/serialization_spec.rb +1 -1
- data/spec/unit/pops/serialization/to_from_hr_spec.rb +1 -1
- data/spec/unit/pops/types/recursion_guard_spec.rb +10 -10
- data/spec/unit/pops/types/ruby_generator_spec.rb +2 -2
- data/spec/unit/pops/types/type_asserter_spec.rb +2 -2
- data/spec/unit/pops/types/type_calculator_spec.rb +30 -30
- data/spec/unit/pops/types/type_parser_spec.rb +13 -13
- data/spec/unit/pops/validator/validator_spec.rb +1 -2
- data/spec/unit/pops/visitor_spec.rb +0 -1
- data/spec/unit/property/boolean_spec.rb +1 -1
- data/spec/unit/property/ensure_spec.rb +0 -1
- data/spec/unit/property/keyvalue_spec.rb +32 -34
- data/spec/unit/property/list_spec.rb +26 -27
- data/spec/unit/property/ordered_list_spec.rb +10 -14
- data/spec/unit/property_spec.rb +42 -43
- data/spec/unit/provider/aix_object_spec.rb +47 -45
- data/spec/unit/provider/command_spec.rb +9 -9
- data/spec/unit/provider/exec/posix_spec.rb +8 -9
- data/spec/unit/provider/exec/shell_spec.rb +0 -1
- data/spec/unit/provider/exec/windows_spec.rb +2 -4
- data/spec/unit/provider/exec_spec.rb +0 -1
- data/spec/unit/provider/file/posix_spec.rb +22 -24
- data/spec/unit/provider/file/windows_spec.rb +15 -17
- data/spec/unit/provider/group/aix_spec.rb +3 -2
- data/spec/unit/provider/group/groupadd_spec.rb +30 -26
- data/spec/unit/provider/group/ldap_spec.rb +18 -18
- data/spec/unit/provider/group/pw_spec.rb +11 -11
- data/spec/unit/provider/group/windows_adsi_spec.rb +54 -54
- data/spec/unit/provider/ldap_spec.rb +61 -62
- data/spec/unit/provider/nameservice/directoryservice_spec.rb +35 -36
- data/spec/unit/provider/nameservice_spec.rb +38 -40
- data/spec/unit/provider/package/aix_spec.rb +15 -15
- data/spec/unit/provider/package/appdmg_spec.rb +13 -13
- data/spec/unit/provider/package/apt_spec.rb +44 -27
- data/spec/unit/provider/package/aptitude_spec.rb +6 -7
- data/spec/unit/provider/package/aptrpm_spec.rb +7 -12
- data/spec/unit/provider/package/base_spec.rb +4 -4
- data/spec/unit/provider/package/dnf_spec.rb +18 -20
- data/spec/unit/provider/package/dpkg_spec.rb +52 -52
- data/spec/unit/provider/package/freebsd_spec.rb +11 -11
- data/spec/unit/provider/package/gem_spec.rb +51 -43
- data/spec/unit/provider/package/hpux_spec.rb +8 -8
- data/spec/unit/provider/package/macports_spec.rb +46 -42
- data/spec/unit/provider/package/nim_spec.rb +30 -39
- data/spec/unit/provider/package/openbsd_spec.rb +36 -39
- data/spec/unit/provider/package/opkg_spec.rb +23 -26
- data/spec/unit/provider/package/pacman_spec.rb +97 -118
- data/spec/unit/provider/package/pip_spec.rb +71 -72
- data/spec/unit/provider/package/pkg_spec.rb +113 -114
- data/spec/unit/provider/package/pkgdmg_spec.rb +65 -63
- data/spec/unit/provider/package/pkgin_spec.rb +10 -8
- data/spec/unit/provider/package/pkgng_spec.rb +21 -22
- data/spec/unit/provider/package/pkgutil_spec.rb +45 -49
- data/spec/unit/provider/package/portage_spec.rb +71 -75
- data/spec/unit/provider/package/puppet_gem_spec.rb +28 -8
- data/spec/unit/provider/package/rpm_spec.rb +53 -64
- data/spec/unit/provider/package/sun_spec.rb +16 -18
- data/spec/unit/provider/package/tdnf_spec.rb +2 -2
- data/spec/unit/provider/package/up2date_spec.rb +2 -4
- data/spec/unit/provider/package/urpmi_spec.rb +15 -17
- data/spec/unit/provider/package/windows/exe_package_spec.rb +12 -15
- data/spec/unit/provider/package/windows/msi_package_spec.rb +19 -22
- data/spec/unit/provider/package/windows/package_spec.rb +37 -42
- data/spec/unit/provider/package/windows_spec.rb +36 -32
- data/spec/unit/provider/package/yum_spec.rb +7 -7
- data/spec/unit/provider/package/zypper_spec.rb +87 -87
- data/spec/unit/provider/parsedfile_spec.rb +44 -45
- data/spec/unit/provider/service/base_spec.rb +4 -5
- data/spec/unit/provider/service/bsd_spec.rb +27 -29
- data/spec/unit/provider/service/daemontools_spec.rb +35 -35
- data/spec/unit/provider/service/debian_spec.rb +38 -38
- data/spec/unit/provider/service/freebsd_spec.rb +18 -18
- data/spec/unit/provider/service/gentoo_spec.rb +50 -55
- data/spec/unit/provider/service/init_spec.rb +53 -52
- data/spec/unit/provider/service/launchd_spec.rb +138 -116
- data/spec/unit/provider/service/openbsd_spec.rb +50 -50
- data/spec/unit/provider/service/openrc_spec.rb +43 -45
- data/spec/unit/provider/service/openwrt_spec.rb +26 -31
- data/spec/unit/provider/service/rcng_spec.rb +14 -14
- data/spec/unit/provider/service/redhat_spec.rb +45 -43
- data/spec/unit/provider/service/runit_spec.rb +29 -27
- data/spec/unit/provider/service/smf_spec.rb +74 -66
- data/spec/unit/provider/service/src_spec.rb +46 -47
- data/spec/unit/provider/service/systemd_spec.rb +113 -122
- data/spec/unit/provider/service/upstart_spec.rb +74 -71
- data/spec/unit/provider/service/windows_spec.rb +33 -41
- data/spec/unit/provider/user/aix_spec.rb +31 -31
- data/spec/unit/provider/user/directoryservice_spec.rb +109 -114
- data/spec/unit/provider/user/hpux_spec.rb +16 -16
- data/spec/unit/provider/user/ldap_spec.rb +57 -57
- data/spec/unit/provider/user/openbsd_spec.rb +10 -12
- data/spec/unit/provider/user/pw_spec.rb +37 -35
- data/spec/unit/provider/user/user_role_add_spec.rb +93 -93
- data/spec/unit/provider/user/useradd_spec.rb +93 -92
- data/spec/unit/provider/user/windows_adsi_spec.rb +59 -60
- data/spec/unit/provider_spec.rb +35 -35
- data/spec/unit/puppet_pal_2pec.rb +4 -5
- data/spec/unit/puppet_pal_spec.rb +0 -1
- data/spec/unit/puppet_spec.rb +6 -7
- data/spec/unit/relationship_spec.rb +0 -1
- data/spec/unit/reports/http_spec.rb +22 -24
- data/spec/unit/reports/store_spec.rb +3 -4
- data/spec/unit/reports_spec.rb +12 -14
- data/spec/unit/resource/capability_finder_spec.rb +15 -17
- data/spec/unit/resource/catalog_spec.rb +72 -68
- data/spec/unit/resource/status_spec.rb +6 -8
- data/spec/unit/resource/type_collection_spec.rb +17 -18
- data/spec/unit/resource/type_spec.rb +34 -35
- data/spec/unit/resource_spec.rb +36 -32
- data/spec/unit/rest/client_spec.rb +56 -25
- data/spec/unit/rest/route_spec.rb +5 -5
- data/spec/unit/scheduler/job_spec.rb +0 -1
- data/spec/unit/scheduler/scheduler_spec.rb +0 -1
- data/spec/unit/scheduler/splay_job_spec.rb +1 -2
- data/spec/unit/settings/array_setting_spec.rb +1 -1
- data/spec/unit/settings/autosign_setting_spec.rb +9 -9
- data/spec/unit/settings/certificate_revocation_setting_spec.rb +1 -1
- data/spec/unit/settings/config_file_spec.rb +0 -1
- data/spec/unit/settings/directory_setting_spec.rb +2 -7
- data/spec/unit/settings/duration_setting_spec.rb +1 -2
- data/spec/unit/settings/enum_setting_spec.rb +1 -1
- data/spec/unit/settings/environment_conf_spec.rb +4 -6
- data/spec/unit/settings/file_setting_spec.rb +44 -46
- data/spec/unit/settings/path_setting_spec.rb +1 -2
- data/spec/unit/settings/priority_setting_spec.rb +1 -2
- data/spec/unit/settings/string_setting_spec.rb +14 -15
- data/spec/unit/settings/terminus_setting_spec.rb +1 -2
- data/spec/unit/settings/value_translator_spec.rb +0 -1
- data/spec/unit/settings_spec.rb +228 -235
- data/spec/unit/ssl/base_spec.rb +14 -15
- data/spec/unit/ssl/certificate_request_spec.rb +62 -58
- data/spec/unit/ssl/certificate_spec.rb +23 -25
- data/spec/unit/ssl/digest_spec.rb +0 -1
- data/spec/unit/ssl/host_spec.rb +147 -130
- data/spec/unit/ssl/key_spec.rb +30 -31
- data/spec/unit/ssl/ssl_provider_spec.rb +24 -24
- data/spec/unit/ssl/state_machine_spec.rb +50 -58
- data/spec/unit/ssl/validator_spec.rb +43 -54
- data/spec/unit/ssl/verifier_spec.rb +10 -10
- data/spec/unit/task_spec.rb +44 -45
- data/spec/unit/transaction/additional_resource_generator_spec.rb +3 -5
- data/spec/unit/transaction/event_manager_spec.rb +87 -88
- data/spec/unit/transaction/event_spec.rb +16 -15
- data/spec/unit/transaction/persistence_spec.rb +16 -17
- data/spec/unit/transaction/report_spec.rb +11 -12
- data/spec/unit/transaction/resource_harness_spec.rb +28 -33
- data/spec/unit/transaction_spec.rb +100 -101
- data/spec/unit/type/component_spec.rb +0 -1
- data/spec/unit/type/exec_spec.rb +60 -56
- data/spec/unit/type/file/checksum_spec.rb +9 -10
- data/spec/unit/type/file/checksum_value_spec.rb +31 -32
- data/spec/unit/type/file/content_spec.rb +58 -61
- data/spec/unit/type/file/ctime_spec.rb +0 -1
- data/spec/unit/type/file/ensure_spec.rb +12 -13
- data/spec/unit/type/file/group_spec.rb +5 -7
- data/spec/unit/type/file/mode_spec.rb +4 -6
- data/spec/unit/type/file/mtime_spec.rb +0 -1
- data/spec/unit/type/file/owner_spec.rb +6 -8
- data/spec/unit/type/file/selinux_spec.rb +17 -19
- data/spec/unit/type/file/source_spec.rb +104 -101
- data/spec/unit/type/file/type_spec.rb +0 -1
- data/spec/unit/type/file_spec.rb +195 -185
- data/spec/unit/type/filebucket_spec.rb +4 -5
- data/spec/unit/type/group_spec.rb +6 -8
- data/spec/unit/type/noop_metaparam_spec.rb +1 -2
- data/spec/unit/type/package/package_settings_spec.rb +44 -23
- data/spec/unit/type/package_spec.rb +56 -57
- data/spec/unit/type/resources_spec.rb +72 -74
- data/spec/unit/type/schedule_spec.rb +24 -26
- data/spec/unit/type/service_spec.rb +49 -49
- data/spec/unit/type/stage_spec.rb +0 -1
- data/spec/unit/type/tidy_spec.rb +61 -62
- data/spec/unit/type/user_spec.rb +24 -25
- data/spec/unit/type/whit_spec.rb +0 -1
- data/spec/unit/type_spec.rb +55 -54
- data/spec/unit/util/at_fork_spec.rb +18 -19
- data/spec/unit/util/autoload_spec.rb +55 -56
- data/spec/unit/util/backups_spec.rb +34 -35
- data/spec/unit/util/character_encoding_spec.rb +5 -5
- data/spec/unit/util/checksums_spec.rb +38 -39
- data/spec/unit/util/colors_spec.rb +1 -2
- data/spec/unit/util/command_line_spec.rb +24 -25
- data/spec/unit/util/constant_inflector_spec.rb +0 -1
- data/spec/unit/util/diff_spec.rb +7 -8
- data/spec/unit/util/errors_spec.rb +0 -1
- data/spec/unit/util/execution_spec.rb +185 -161
- data/spec/unit/util/execution_stub_spec.rb +0 -1
- data/spec/unit/util/feature_spec.rb +23 -14
- data/spec/unit/util/filetype_spec.rb +49 -49
- data/spec/unit/util/http_proxy_spec.rb +12 -12
- data/spec/unit/util/inifile_spec.rb +26 -31
- data/spec/unit/util/json_lockfile_spec.rb +3 -5
- data/spec/unit/util/ldap/connection_spec.rb +26 -25
- data/spec/unit/util/ldap/generator_spec.rb +0 -1
- data/spec/unit/util/ldap/manager_spec.rb +102 -101
- data/spec/unit/util/lockfile_spec.rb +0 -1
- data/spec/unit/util/log/destinations_spec.rb +30 -33
- data/spec/unit/util/log_spec.rb +35 -36
- data/spec/unit/util/logging_spec.rb +58 -72
- data/spec/unit/util/metric_spec.rb +0 -1
- data/spec/unit/util/monkey_patches_spec.rb +7 -9
- data/spec/unit/util/multi_match_spec.rb +0 -1
- data/spec/unit/util/network_device/config_spec.rb +0 -1
- data/spec/unit/util/network_device/transport/base_spec.rb +5 -6
- data/spec/unit/util/network_device_spec.rb +7 -9
- data/spec/unit/util/package_spec.rb +0 -1
- data/spec/unit/util/pidlock_spec.rb +21 -22
- data/spec/unit/util/plist_spec.rb +40 -33
- data/spec/unit/util/posix_spec.rb +54 -51
- data/spec/unit/util/rdoc_spec.rb +9 -10
- data/spec/unit/util/reference_spec.rb +0 -1
- data/spec/unit/util/resource_template_spec.rb +20 -20
- data/spec/unit/util/retry_action_spec.rb +7 -8
- data/spec/unit/util/rubygems_spec.rb +7 -8
- data/spec/unit/util/run_mode_spec.rb +3 -4
- data/spec/unit/util/selinux_spec.rb +79 -72
- data/spec/unit/util/splayer_spec.rb +8 -9
- data/spec/unit/util/ssl_spec.rb +0 -1
- data/spec/unit/util/storage_spec.rb +3 -4
- data/spec/unit/util/suidmanager_spec.rb +45 -54
- data/spec/unit/util/symbolic_file_mode_spec.rb +0 -1
- data/spec/unit/util/tag_set_spec.rb +0 -1
- data/spec/unit/util/tagging_spec.rb +0 -1
- data/spec/unit/util/terminal_spec.rb +9 -10
- data/spec/unit/util/user_attr_spec.rb +1 -2
- data/spec/unit/util/warnings_spec.rb +3 -4
- data/spec/unit/util/watcher/periodic_watcher_spec.rb +2 -2
- data/spec/unit/util/watcher_spec.rb +51 -21
- data/spec/unit/util/windows/access_control_entry_spec.rb +0 -1
- data/spec/unit/util/windows/access_control_list_spec.rb +0 -1
- data/spec/unit/util/windows/adsi_spec.rb +136 -138
- data/spec/unit/util/windows/api_types_spec.rb +0 -1
- data/spec/unit/util/windows/eventlog_spec.rb +9 -12
- data/spec/unit/util/windows/file_spec.rb +0 -1
- data/spec/unit/util/windows/root_certs_spec.rb +1 -2
- data/spec/unit/util/windows/security_descriptor_spec.rb +0 -2
- data/spec/unit/util/windows/service_spec.rb +66 -68
- data/spec/unit/util/windows/sid_spec.rb +11 -13
- data/spec/unit/util/windows/string_spec.rb +0 -1
- data/spec/unit/util_spec.rb +55 -57
- data/spec/unit/version_spec.rb +6 -6
- data/spec/unit/x509/cert_provider_spec.rb +14 -14
- data/spec/unit/x509/pem_store_spec.rb +5 -5
- metadata +2 -2
data/spec/unit/type/file_spec.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
#! /usr/bin/env ruby
|
2
1
|
require 'spec_helper'
|
3
2
|
|
4
3
|
describe Puppet::Type.type(:file) do
|
@@ -10,7 +9,7 @@ describe Puppet::Type.type(:file) do
|
|
10
9
|
let(:catalog) { Puppet::Resource::Catalog.new }
|
11
10
|
|
12
11
|
before do
|
13
|
-
Puppet.features.
|
12
|
+
allow(Puppet.features).to receive("posix?").and_return(true)
|
14
13
|
end
|
15
14
|
|
16
15
|
describe "the path parameter" do
|
@@ -211,8 +210,8 @@ describe Puppet::Type.type(:file) do
|
|
211
210
|
|
212
211
|
it "should return the default filebucket if using the 'puppet' filebucket" do
|
213
212
|
file[:backup] = 'puppet'
|
214
|
-
bucket =
|
215
|
-
file.
|
213
|
+
bucket = double('bucket')
|
214
|
+
allow(file).to receive(:default_bucket).and_return(bucket)
|
216
215
|
|
217
216
|
expect(file.bucket).to eq(bucket)
|
218
217
|
end
|
@@ -243,19 +242,19 @@ describe Puppet::Type.type(:file) do
|
|
243
242
|
before :each do
|
244
243
|
# Mocha won't let me just stub SUIDManager.asuser to yield and return,
|
245
244
|
# but it will do exactly that if we're not root.
|
246
|
-
Puppet::Util::SUIDManager.
|
245
|
+
allow(Puppet::Util::SUIDManager).to receive(:root?).and_return(false)
|
247
246
|
end
|
248
247
|
|
249
248
|
it "should return the desired owner if they can write to the parent directory" do
|
250
249
|
file[:owner] = 1001
|
251
|
-
FileTest.
|
250
|
+
allow(FileTest).to receive(:writable?).with(File.dirname file[:path]).and_return(true)
|
252
251
|
|
253
252
|
expect(file.asuser).to eq(1001)
|
254
253
|
end
|
255
254
|
|
256
255
|
it "should return nil if the desired owner can't write to the parent directory" do
|
257
256
|
file[:owner] = 1001
|
258
|
-
FileTest.
|
257
|
+
allow(FileTest).to receive(:writable?).with(File.dirname file[:path]).and_return(false)
|
259
258
|
|
260
259
|
expect(file.asuser).to eq(nil)
|
261
260
|
end
|
@@ -267,25 +266,25 @@ describe Puppet::Type.type(:file) do
|
|
267
266
|
|
268
267
|
describe "#exist?" do
|
269
268
|
it "should be considered existent if it can be stat'ed" do
|
270
|
-
file.
|
269
|
+
expect(file).to receive(:stat).and_return(double('stat'))
|
271
270
|
expect(file).to be_exist
|
272
271
|
end
|
273
272
|
|
274
273
|
it "should be considered nonexistent if it can not be stat'ed" do
|
275
|
-
file.
|
274
|
+
expect(file).to receive(:stat).and_return(nil)
|
276
275
|
expect(file).to_not be_exist
|
277
276
|
end
|
278
277
|
end
|
279
278
|
|
280
279
|
describe "#eval_generate" do
|
281
280
|
before do
|
282
|
-
@graph =
|
283
|
-
catalog.
|
281
|
+
@graph = double('graph', :add_edge => nil)
|
282
|
+
allow(catalog).to receive(:relationship_graph).and_return(@graph)
|
284
283
|
end
|
285
284
|
|
286
285
|
it "should recurse if recursion is enabled" do
|
287
|
-
resource =
|
288
|
-
file.
|
286
|
+
resource = double('resource', :[] => 'resource')
|
287
|
+
expect(file).to receive(:recurse).and_return([resource])
|
289
288
|
|
290
289
|
file[:recurse] = true
|
291
290
|
|
@@ -293,7 +292,7 @@ describe Puppet::Type.type(:file) do
|
|
293
292
|
end
|
294
293
|
|
295
294
|
it "should not recurse if recursion is disabled" do
|
296
|
-
file.
|
295
|
+
expect(file).not_to receive(:recurse)
|
297
296
|
|
298
297
|
file[:recurse] = false
|
299
298
|
|
@@ -319,7 +318,7 @@ describe Puppet::Type.type(:file) do
|
|
319
318
|
describe "#flush" do
|
320
319
|
it "should flush all properties that respond to :flush" do
|
321
320
|
file[:source] = File.expand_path(__FILE__)
|
322
|
-
file.parameter(:source).
|
321
|
+
expect(file.parameter(:source)).to receive(:flush)
|
323
322
|
file.flush
|
324
323
|
end
|
325
324
|
|
@@ -447,12 +446,14 @@ describe Puppet::Type.type(:file) do
|
|
447
446
|
it "should not copy values to the child which were set by the source" do
|
448
447
|
source = File.expand_path(__FILE__)
|
449
448
|
file[:source] = source
|
450
|
-
metadata =
|
451
|
-
file.parameter(:source).
|
449
|
+
metadata = double('metadata', :owner => "root", :group => "root", :mode => '0755', :ftype => "file", :checksum => "{md5}whatever", :checksum_type => "md5", :source => source)
|
450
|
+
allow(file.parameter(:source)).to receive(:metadata).and_return(metadata)
|
452
451
|
|
453
452
|
file.parameter(:source).copy_source_values
|
454
453
|
|
455
|
-
file.class.
|
454
|
+
expect(file.class).to receive(:new) do |arg|
|
455
|
+
expect(arg[:group]).to be_nil
|
456
|
+
end
|
456
457
|
file.newchild("my/path")
|
457
458
|
end
|
458
459
|
end
|
@@ -484,8 +485,8 @@ describe Puppet::Type.type(:file) do
|
|
484
485
|
describe "and a source is set" do
|
485
486
|
it "should pass the already-discovered resources to recurse_remote" do
|
486
487
|
file[:source] = File.expand_path(__FILE__)
|
487
|
-
file.
|
488
|
-
file.
|
488
|
+
allow(file).to receive(:recurse_local).and_return(:foo => "bar")
|
489
|
+
expect(file).to receive(:recurse_remote).with(:foo => "bar").and_return([])
|
489
490
|
file.recurse
|
490
491
|
end
|
491
492
|
end
|
@@ -493,28 +494,28 @@ describe Puppet::Type.type(:file) do
|
|
493
494
|
describe "and a target is set" do
|
494
495
|
it "should use recurse_link" do
|
495
496
|
file[:target] = File.expand_path(__FILE__)
|
496
|
-
file.
|
497
|
-
file.
|
497
|
+
allow(file).to receive(:recurse_local).and_return(:foo => "bar")
|
498
|
+
expect(file).to receive(:recurse_link).with(:foo => "bar").and_return([])
|
498
499
|
file.recurse
|
499
500
|
end
|
500
501
|
end
|
501
502
|
|
502
503
|
it "should use recurse_local if recurse is not remote" do
|
503
|
-
file.
|
504
|
+
expect(file).to receive(:recurse_local).and_return({})
|
504
505
|
file.recurse
|
505
506
|
end
|
506
507
|
|
507
508
|
it "should not use recurse_local if recurse is remote" do
|
508
509
|
file[:recurse] = :remote
|
509
|
-
file.
|
510
|
+
expect(file).not_to receive(:recurse_local)
|
510
511
|
file.recurse
|
511
512
|
end
|
512
513
|
|
513
514
|
it "should return the generated resources as an array sorted by file path" do
|
514
|
-
one =
|
515
|
-
two =
|
516
|
-
three =
|
517
|
-
file.
|
515
|
+
one = double('one', :[] => "/one")
|
516
|
+
two = double('two', :[] => "/one/two")
|
517
|
+
three = double('three', :[] => "/three")
|
518
|
+
expect(file).to receive(:recurse_local).and_return(:one => one, :two => two, :three => three)
|
518
519
|
expect(file.recurse).to eq([one, two, three])
|
519
520
|
end
|
520
521
|
|
@@ -525,19 +526,20 @@ describe Puppet::Type.type(:file) do
|
|
525
526
|
|
526
527
|
it "should mark each file for removal" do
|
527
528
|
local = described_class.new(:path => path, :ensure => :present)
|
528
|
-
file.
|
529
|
+
expect(file).to receive(:recurse_local).and_return("local" => local)
|
529
530
|
|
530
531
|
file.recurse
|
531
532
|
expect(local[:ensure]).to eq(:absent)
|
532
533
|
end
|
533
534
|
|
534
535
|
it "should not remove files that exist in the remote repository" do
|
536
|
+
pending("FIXME: This test has been broken since it was introduced in c189b46e3f1 because of = vs ==")
|
535
537
|
file[:source] = File.expand_path(__FILE__)
|
536
|
-
file.
|
538
|
+
expect(file).to receive(:recurse_local).and_return({})
|
537
539
|
|
538
540
|
remote = described_class.new(:path => path, :source => File.expand_path(__FILE__), :ensure => :present)
|
539
541
|
|
540
|
-
file.
|
542
|
+
expect(file).to receive(:recurse_remote).with(hash_including("remote" => remote))
|
541
543
|
|
542
544
|
file.recurse
|
543
545
|
|
@@ -580,42 +582,42 @@ describe Puppet::Type.type(:file) do
|
|
580
582
|
|
581
583
|
describe "#recurse_link" do
|
582
584
|
before do
|
583
|
-
@first =
|
584
|
-
@second =
|
585
|
+
@first = double('first', :relative_path => "first", :full_path => "/my/first", :ftype => "directory")
|
586
|
+
@second = double('second', :relative_path => "second", :full_path => "/my/second", :ftype => "file")
|
585
587
|
|
586
|
-
@resource =
|
588
|
+
@resource = double('file', :[]= => nil)
|
587
589
|
end
|
588
590
|
|
589
591
|
it "should pass its target to the :perform_recursion method" do
|
590
592
|
file[:target] = "mylinks"
|
591
|
-
file.
|
592
|
-
file.
|
593
|
+
expect(file).to receive(:perform_recursion).with("mylinks").and_return([@first])
|
594
|
+
allow(file).to receive(:newchild).and_return(@resource)
|
593
595
|
file.recurse_link({})
|
594
596
|
end
|
595
597
|
|
596
598
|
it "should ignore the recursively-found '.' file and configure the top-level file to create a directory" do
|
597
|
-
@first.
|
599
|
+
allow(@first).to receive(:relative_path).and_return(".")
|
598
600
|
file[:target] = "mylinks"
|
599
|
-
file.
|
600
|
-
file.
|
601
|
-
file.
|
601
|
+
expect(file).to receive(:perform_recursion).with("mylinks").and_return([@first])
|
602
|
+
expect(file).not_to receive(:newchild)
|
603
|
+
expect(file).to receive(:[]=).with(:ensure, :directory)
|
602
604
|
file.recurse_link({})
|
603
605
|
end
|
604
606
|
|
605
607
|
it "should create a new child resource for each generated metadata instance's relative path that doesn't already exist in the children hash" do
|
606
|
-
file.
|
607
|
-
file.
|
608
|
+
expect(file).to receive(:perform_recursion).and_return([@first, @second])
|
609
|
+
expect(file).to receive(:newchild).with(@first.relative_path).and_return(@resource)
|
608
610
|
file.recurse_link("second" => @resource)
|
609
611
|
end
|
610
612
|
|
611
613
|
it "should not create a new child resource for paths that already exist in the children hash" do
|
612
|
-
file.
|
613
|
-
file.
|
614
|
+
expect(file).to receive(:perform_recursion).and_return([@first])
|
615
|
+
expect(file).not_to receive(:newchild)
|
614
616
|
file.recurse_link("first" => @resource)
|
615
617
|
end
|
616
618
|
|
617
619
|
it "should set the target to the full path of discovered file and set :ensure to :link if the file is not a directory", :if => described_class.defaultprovider.feature?(:manages_symlinks) do
|
618
|
-
file.
|
620
|
+
allow(file).to receive(:perform_recursion).and_return([@first, @second])
|
619
621
|
file.recurse_link("first" => @resource, "second" => file)
|
620
622
|
|
621
623
|
expect(file[:ensure]).to eq(:link)
|
@@ -623,59 +625,59 @@ describe Puppet::Type.type(:file) do
|
|
623
625
|
end
|
624
626
|
|
625
627
|
it "should :ensure to :directory if the file is a directory" do
|
626
|
-
file.
|
628
|
+
allow(file).to receive(:perform_recursion).and_return([@first, @second])
|
627
629
|
file.recurse_link("first" => file, "second" => @resource)
|
628
630
|
|
629
631
|
expect(file[:ensure]).to eq(:directory)
|
630
632
|
end
|
631
633
|
|
632
634
|
it "should return a hash with both created and existing resources with the relative paths as the hash keys" do
|
633
|
-
file.
|
634
|
-
file.
|
635
|
+
expect(file).to receive(:perform_recursion).and_return([@first, @second])
|
636
|
+
allow(file).to receive(:newchild).and_return(file)
|
635
637
|
expect(file.recurse_link("second" => @resource)).to eq({"second" => @resource, "first" => file})
|
636
638
|
end
|
637
639
|
end
|
638
640
|
|
639
641
|
describe "#recurse_local" do
|
640
642
|
before do
|
641
|
-
@metadata =
|
643
|
+
@metadata = double('metadata', :relative_path => "my/file")
|
642
644
|
end
|
643
645
|
|
644
646
|
it "should pass its path to the :perform_recursion method" do
|
645
|
-
file.
|
646
|
-
file.
|
647
|
+
expect(file).to receive(:perform_recursion).with(file[:path]).and_return([@metadata])
|
648
|
+
allow(file).to receive(:newchild)
|
647
649
|
file.recurse_local
|
648
650
|
end
|
649
651
|
|
650
652
|
it "should return an empty hash if the recursion returns nothing" do
|
651
|
-
file.
|
653
|
+
expect(file).to receive(:perform_recursion).and_return(nil)
|
652
654
|
expect(file.recurse_local).to eq({})
|
653
655
|
end
|
654
656
|
|
655
657
|
it "should create a new child resource with each generated metadata instance's relative path" do
|
656
|
-
file.
|
657
|
-
file.
|
658
|
+
expect(file).to receive(:perform_recursion).and_return([@metadata])
|
659
|
+
expect(file).to receive(:newchild).with(@metadata.relative_path).and_return("fiebar")
|
658
660
|
file.recurse_local
|
659
661
|
end
|
660
662
|
|
661
663
|
it "should not create a new child resource for the '.' directory" do
|
662
|
-
@metadata.
|
664
|
+
allow(@metadata).to receive(:relative_path).and_return(".")
|
663
665
|
|
664
|
-
file.
|
665
|
-
file.
|
666
|
+
expect(file).to receive(:perform_recursion).and_return([@metadata])
|
667
|
+
expect(file).not_to receive(:newchild)
|
666
668
|
file.recurse_local
|
667
669
|
end
|
668
670
|
|
669
671
|
it "should return a hash of the created resources with the relative paths as the hash keys" do
|
670
|
-
file.
|
671
|
-
file.
|
672
|
+
expect(file).to receive(:perform_recursion).and_return([@metadata])
|
673
|
+
expect(file).to receive(:newchild).with("my/file").and_return("fiebar")
|
672
674
|
expect(file.recurse_local).to eq({"my/file" => "fiebar"})
|
673
675
|
end
|
674
676
|
|
675
677
|
it "should set checksum_type to none if this file checksum is none" do
|
676
678
|
file[:checksum] = :none
|
677
|
-
Puppet::FileServing::Metadata.indirection.
|
678
|
-
file.
|
679
|
+
expect(Puppet::FileServing::Metadata.indirection).to receive(:search).with(anything, hash_including(checksum_type: :none)).and_return([@metadata])
|
680
|
+
expect(file).to receive(:newchild).with("my/file").and_return("fiebar")
|
679
681
|
file.recurse_local
|
680
682
|
end
|
681
683
|
end
|
@@ -688,94 +690,94 @@ describe Puppet::Type.type(:file) do
|
|
688
690
|
|
689
691
|
@first = Puppet::FileServing::Metadata.new(my, :relative_path => "first")
|
690
692
|
@second = Puppet::FileServing::Metadata.new(my, :relative_path => "second")
|
691
|
-
@first.
|
692
|
-
@second.
|
693
|
+
allow(@first).to receive(:ftype).and_return("directory")
|
694
|
+
allow(@second).to receive(:ftype).and_return("directory")
|
693
695
|
|
694
|
-
@parameter =
|
695
|
-
@resource =
|
696
|
+
@parameter = double('property', :metadata= => nil)
|
697
|
+
@resource = double('file', :[]= => nil, :parameter => @parameter)
|
696
698
|
end
|
697
699
|
|
698
700
|
it "should pass its source to the :perform_recursion method" do
|
699
701
|
data = Puppet::FileServing::Metadata.new(File.expand_path("/whatever"), :relative_path => "foobar")
|
700
|
-
file.
|
701
|
-
file.
|
702
|
+
expect(file).to receive(:perform_recursion).with("puppet://foo/bar").and_return([data])
|
703
|
+
allow(file).to receive(:newchild).and_return(@resource)
|
702
704
|
file.recurse_remote({})
|
703
705
|
end
|
704
706
|
|
705
707
|
it "should not recurse when the remote file is not a directory" do
|
706
708
|
data = Puppet::FileServing::Metadata.new(File.expand_path("/whatever"), :relative_path => ".")
|
707
|
-
data.
|
708
|
-
file.
|
709
|
-
file.
|
709
|
+
allow(data).to receive(:ftype).and_return("file")
|
710
|
+
expect(file).to receive(:perform_recursion).with("puppet://foo/bar").and_return([data])
|
711
|
+
expect(file).not_to receive(:newchild)
|
710
712
|
file.recurse_remote({})
|
711
713
|
end
|
712
714
|
|
713
715
|
it "should set the source of each returned file to the searched-for URI plus the found relative path" do
|
714
|
-
@first.
|
715
|
-
file.
|
716
|
-
file.
|
716
|
+
expect(@first).to receive(:source=).with(File.join("puppet://foo/bar", @first.relative_path))
|
717
|
+
expect(file).to receive(:perform_recursion).and_return([@first])
|
718
|
+
allow(file).to receive(:newchild).and_return(@resource)
|
717
719
|
file.recurse_remote({})
|
718
720
|
end
|
719
721
|
|
720
722
|
it "should create a new resource for any relative file paths that do not already have a resource" do
|
721
|
-
file.
|
722
|
-
file.
|
723
|
+
allow(file).to receive(:perform_recursion).and_return([@first])
|
724
|
+
expect(file).to receive(:newchild).with("first").and_return(@resource)
|
723
725
|
expect(file.recurse_remote({})).to eq({"first" => @resource})
|
724
726
|
end
|
725
727
|
|
726
728
|
it "should not create a new resource for any relative file paths that do already have a resource" do
|
727
|
-
file.
|
728
|
-
file.
|
729
|
+
allow(file).to receive(:perform_recursion).and_return([@first])
|
730
|
+
expect(file).not_to receive(:newchild)
|
729
731
|
file.recurse_remote("first" => @resource)
|
730
732
|
end
|
731
733
|
|
732
734
|
it "should set the source of each resource to the source of the metadata" do
|
733
|
-
file.
|
734
|
-
@resource.
|
735
|
-
@resource.
|
735
|
+
allow(file).to receive(:perform_recursion).and_return([@first])
|
736
|
+
allow(@resource).to receive(:[]=)
|
737
|
+
expect(@resource).to receive(:[]=).with(:source, File.join("puppet://foo/bar", @first.relative_path))
|
736
738
|
file.recurse_remote("first" => @resource)
|
737
739
|
end
|
738
740
|
|
739
741
|
it "should set the checksum parameter based on the metadata" do
|
740
|
-
file.
|
741
|
-
@resource.
|
742
|
-
@resource.
|
742
|
+
allow(file).to receive(:perform_recursion).and_return([@first])
|
743
|
+
allow(@resource).to receive(:[]=)
|
744
|
+
expect(@resource).to receive(:[]=).with(:checksum, "md5")
|
743
745
|
file.recurse_remote("first" => @resource)
|
744
746
|
end
|
745
747
|
|
746
748
|
it "should store the metadata in the source property for each resource so the source does not have to requery the metadata" do
|
747
|
-
file.
|
748
|
-
@resource.
|
749
|
+
allow(file).to receive(:perform_recursion).and_return([@first])
|
750
|
+
expect(@resource).to receive(:parameter).with(:source).and_return(@parameter)
|
749
751
|
|
750
|
-
@parameter.
|
752
|
+
expect(@parameter).to receive(:metadata=).with(@first)
|
751
753
|
|
752
754
|
file.recurse_remote("first" => @resource)
|
753
755
|
end
|
754
756
|
|
755
757
|
it "should not create a new resource for the '.' file" do
|
756
|
-
@first.
|
757
|
-
file.
|
758
|
+
allow(@first).to receive(:relative_path).and_return(".")
|
759
|
+
allow(file).to receive(:perform_recursion).and_return([@first])
|
758
760
|
|
759
|
-
file.
|
761
|
+
expect(file).not_to receive(:newchild)
|
760
762
|
|
761
763
|
file.recurse_remote({})
|
762
764
|
end
|
763
765
|
|
764
766
|
it "should store the metadata in the main file's source property if the relative path is '.'" do
|
765
|
-
@first.
|
766
|
-
file.
|
767
|
+
allow(@first).to receive(:relative_path).and_return(".")
|
768
|
+
allow(file).to receive(:perform_recursion).and_return([@first])
|
767
769
|
|
768
|
-
file.parameter(:source).
|
770
|
+
expect(file.parameter(:source)).to receive(:metadata=).with(@first)
|
769
771
|
|
770
772
|
file.recurse_remote("first" => @resource)
|
771
773
|
end
|
772
774
|
|
773
775
|
it "should update the main file's checksum parameter if the relative path is '.'" do
|
774
|
-
@first.
|
775
|
-
file.
|
776
|
+
allow(@first).to receive(:relative_path).and_return(".")
|
777
|
+
allow(file).to receive(:perform_recursion).and_return([@first])
|
776
778
|
|
777
|
-
file.
|
778
|
-
file.
|
779
|
+
allow(file).to receive(:[]=)
|
780
|
+
expect(file). to receive(:[]=).with(:checksum, "md5")
|
779
781
|
|
780
782
|
file.recurse_remote("first" => @resource)
|
781
783
|
end
|
@@ -793,11 +795,11 @@ describe Puppet::Type.type(:file) do
|
|
793
795
|
it "should create file instances for the results for the first source to return any values" do
|
794
796
|
data = Puppet::FileServing::Metadata.new(File.expand_path("/whatever"), :relative_path => "foobar")
|
795
797
|
file[:source] = sources.keys.sort.map { |key| File.expand_path(key) }
|
796
|
-
file.
|
797
|
-
file.
|
798
|
-
file.
|
799
|
-
file.
|
800
|
-
file.
|
798
|
+
expect(file).to receive(:perform_recursion).with(sources['/a']).and_return(nil)
|
799
|
+
expect(file).to receive(:perform_recursion).with(sources['/b']).and_return([])
|
800
|
+
expect(file).to receive(:perform_recursion).with(sources['/c']).and_return([data])
|
801
|
+
expect(file).not_to receive(:perform_recursion).with(sources['/d'])
|
802
|
+
expect(file).to receive(:newchild).with("foobar").and_return(@resource)
|
801
803
|
file.recurse_remote({})
|
802
804
|
end
|
803
805
|
end
|
@@ -811,21 +813,20 @@ describe Puppet::Type.type(:file) do
|
|
811
813
|
klass = Puppet::FileServing::Metadata
|
812
814
|
|
813
815
|
file[:source] = abs_path = %w{/a /b /c /d}.map {|f| File.expand_path(f) }
|
814
|
-
file.
|
816
|
+
allow(file).to receive(:newchild).and_return(@resource)
|
815
817
|
|
816
818
|
one = [klass.new(abs_path[0], :relative_path => "a")]
|
817
|
-
file.
|
818
|
-
file.
|
819
|
+
expect(file).to receive(:perform_recursion).with(sources['/a']).and_return(one)
|
820
|
+
expect(file).to receive(:newchild).with("a").and_return(@resource)
|
819
821
|
|
820
822
|
two = [klass.new(abs_path[1], :relative_path => "a"), klass.new(abs_path[1], :relative_path => "b")]
|
821
|
-
file.
|
822
|
-
file.
|
823
|
+
expect(file).to receive(:perform_recursion).with(sources['/b']).and_return(two)
|
824
|
+
expect(file).to receive(:newchild).with("b").and_return(@resource)
|
823
825
|
|
824
826
|
three = [klass.new(abs_path[2], :relative_path => "a"), klass.new(abs_path[2], :relative_path => "c")]
|
825
|
-
file.
|
826
|
-
file.
|
827
|
-
|
828
|
-
file.expects(:perform_recursion).with(sources['/d']).returns []
|
827
|
+
expect(file).to receive(:perform_recursion).with(sources['/c']).and_return(three)
|
828
|
+
expect(file).to receive(:newchild).with("c").and_return(@resource)
|
829
|
+
expect(file).to receive(:perform_recursion).with(sources['/d']).and_return([])
|
829
830
|
|
830
831
|
file.recurse_remote({})
|
831
832
|
end
|
@@ -835,54 +836,54 @@ describe Puppet::Type.type(:file) do
|
|
835
836
|
|
836
837
|
describe "#perform_recursion", :uses_checksums => true do
|
837
838
|
it "should use Metadata to do its recursion" do
|
838
|
-
Puppet::FileServing::Metadata.indirection.
|
839
|
+
expect(Puppet::FileServing::Metadata.indirection).to receive(:search)
|
839
840
|
file.perform_recursion(file[:path])
|
840
841
|
end
|
841
842
|
|
842
843
|
it "should use the provided path as the key to the search" do
|
843
|
-
Puppet::FileServing::Metadata.indirection.
|
844
|
+
expect(Puppet::FileServing::Metadata.indirection).to receive(:search).with("/foo", anything)
|
844
845
|
file.perform_recursion("/foo")
|
845
846
|
end
|
846
847
|
|
847
848
|
it "should return the results of the metadata search" do
|
848
|
-
Puppet::FileServing::Metadata.indirection.
|
849
|
+
expect(Puppet::FileServing::Metadata.indirection).to receive(:search).and_return("foobar")
|
849
850
|
expect(file.perform_recursion(file[:path])).to eq("foobar")
|
850
851
|
end
|
851
852
|
|
852
853
|
it "should pass its recursion value to the search" do
|
853
854
|
file[:recurse] = true
|
854
|
-
Puppet::FileServing::Metadata.indirection.
|
855
|
+
expect(Puppet::FileServing::Metadata.indirection).to receive(:search).with(anything, hash_including(recurse: true))
|
855
856
|
file.perform_recursion(file[:path])
|
856
857
|
end
|
857
858
|
|
858
859
|
it "should pass true if recursion is remote" do
|
859
860
|
file[:recurse] = :remote
|
860
|
-
Puppet::FileServing::Metadata.indirection.
|
861
|
+
expect(Puppet::FileServing::Metadata.indirection).to receive(:search).with(anything, hash_including(recurse: true))
|
861
862
|
file.perform_recursion(file[:path])
|
862
863
|
end
|
863
864
|
|
864
865
|
it "should pass its recursion limit value to the search" do
|
865
866
|
file[:recurselimit] = 10
|
866
|
-
Puppet::FileServing::Metadata.indirection.
|
867
|
+
expect(Puppet::FileServing::Metadata.indirection).to receive(:search).with(anything, hash_including(recurselimit: 10))
|
867
868
|
file.perform_recursion(file[:path])
|
868
869
|
end
|
869
870
|
|
870
871
|
it "should configure the search to ignore or manage links" do
|
871
872
|
file[:links] = :manage
|
872
|
-
Puppet::FileServing::Metadata.indirection.
|
873
|
+
expect(Puppet::FileServing::Metadata.indirection).to receive(:search).with(anything, hash_including(links: :manage))
|
873
874
|
file.perform_recursion(file[:path])
|
874
875
|
end
|
875
876
|
|
876
877
|
it "should pass its 'ignore' setting to the search if it has one" do
|
877
878
|
file[:ignore] = %w{.svn CVS}
|
878
|
-
Puppet::FileServing::Metadata.indirection.
|
879
|
+
expect(Puppet::FileServing::Metadata.indirection).to receive(:search).with(anything, hash_including(ignore: %w{.svn CVS}))
|
879
880
|
file.perform_recursion(file[:path])
|
880
881
|
end
|
881
882
|
|
882
883
|
with_digest_algorithms do
|
883
884
|
it "it should pass its 'checksum' setting #{metadata[:digest_algorithm]} to the search" do
|
884
885
|
file[:source] = File.expand_path('/foo')
|
885
|
-
Puppet::FileServing::Metadata.indirection.
|
886
|
+
expect(Puppet::FileServing::Metadata.indirection).to receive(:search).with(anything, hash_including(checksum_type: digest_algorithm.intern))
|
886
887
|
file.perform_recursion(file[:path])
|
887
888
|
end
|
888
889
|
end
|
@@ -895,8 +896,8 @@ describe Puppet::Type.type(:file) do
|
|
895
896
|
|
896
897
|
it "should fail if it can't backup the file" do
|
897
898
|
# Default: file[:backup] = true
|
898
|
-
file.
|
899
|
-
file.
|
899
|
+
allow(file).to receive(:stat).and_return(double('stat', :ftype => 'file'))
|
900
|
+
allow(file).to receive(:perform_backup).and_return(false)
|
900
901
|
|
901
902
|
expect { file.remove_existing(:file) }.to raise_error(Puppet::Error, /Could not back up; will not remove/)
|
902
903
|
end
|
@@ -905,27 +906,27 @@ describe Puppet::Type.type(:file) do
|
|
905
906
|
it "should not backup directories if backup is true and force is false" do
|
906
907
|
# Default: file[:backup] = true
|
907
908
|
file[:force] = false
|
908
|
-
file.
|
909
|
+
allow(file).to receive(:stat).and_return(double('stat', :ftype => 'directory'))
|
909
910
|
|
910
|
-
file.
|
911
|
-
file.
|
911
|
+
expect(file).not_to receive(:perform_backup)
|
912
|
+
expect(file).to receive(:warning).with("Could not back up file of type directory")
|
912
913
|
expect(file.remove_existing(:file)).to eq(false)
|
913
914
|
end
|
914
915
|
|
915
916
|
it "should backup directories if backup is true and force is true" do
|
916
917
|
# Default: file[:backup] = true
|
917
918
|
file[:force] = true
|
918
|
-
file.
|
919
|
+
allow(file).to receive(:stat).and_return(double('stat', :ftype => 'directory'))
|
919
920
|
|
920
|
-
FileUtils.
|
921
|
-
file.
|
921
|
+
expect(FileUtils).to receive(:rmtree).with(file[:path])
|
922
|
+
expect(file).to receive(:perform_backup).and_return(true)
|
922
923
|
|
923
924
|
expect(file.remove_existing(:file)).to eq(true)
|
924
925
|
end
|
925
926
|
end
|
926
927
|
|
927
928
|
it "should not do anything if the file is already the right type and not a link" do
|
928
|
-
file.
|
929
|
+
allow(file).to receive(:stat).and_return(double('stat', :ftype => 'file'))
|
929
930
|
|
930
931
|
expect(file.remove_existing(:file)).to eq(false)
|
931
932
|
end
|
@@ -934,7 +935,7 @@ describe Puppet::Type.type(:file) do
|
|
934
935
|
file[:force] = false
|
935
936
|
# Actually call stat to set @needs_stat to nil
|
936
937
|
file.stat
|
937
|
-
file.
|
938
|
+
allow(file).to receive(:stat).and_return(double('stat', :ftype => 'directory'))
|
938
939
|
|
939
940
|
expect(file.instance_variable_get(:@stat)).to eq(nil)
|
940
941
|
end
|
@@ -942,15 +943,15 @@ describe Puppet::Type.type(:file) do
|
|
942
943
|
it "should remove a directory if backup is true and force is true" do
|
943
944
|
# Default: file[:backup] = true
|
944
945
|
file[:force] = true
|
945
|
-
file.
|
946
|
+
allow(file).to receive(:stat).and_return(double('stat', :ftype => 'directory'))
|
946
947
|
|
947
|
-
FileUtils.
|
948
|
+
expect(FileUtils).to receive(:rmtree).with(file[:path])
|
948
949
|
|
949
950
|
expect(file.remove_existing(:file)).to eq(true)
|
950
951
|
end
|
951
952
|
|
952
953
|
it "should remove an existing file" do
|
953
|
-
file.
|
954
|
+
allow(file).to receive(:perform_backup).and_return(true)
|
954
955
|
FileUtils.touch(path)
|
955
956
|
|
956
957
|
expect(file.remove_existing(:directory)).to eq(true)
|
@@ -959,7 +960,7 @@ describe Puppet::Type.type(:file) do
|
|
959
960
|
end
|
960
961
|
|
961
962
|
it "should remove an existing link", :if => described_class.defaultprovider.feature?(:manages_symlinks) do
|
962
|
-
file.
|
963
|
+
allow(file).to receive(:perform_backup).and_return(true)
|
963
964
|
|
964
965
|
target = tmpfile('link_target')
|
965
966
|
FileUtils.touch(target)
|
@@ -972,18 +973,18 @@ describe Puppet::Type.type(:file) do
|
|
972
973
|
end
|
973
974
|
|
974
975
|
it "should fail if the file is not a directory, link, file, fifo, socket, or is unknown" do
|
975
|
-
file.
|
976
|
+
allow(file).to receive(:stat).and_return(double('stat', :ftype => 'blockSpecial'))
|
976
977
|
|
977
|
-
file.
|
978
|
+
expect(file).to receive(:warning).with("Could not back up file of type blockSpecial")
|
978
979
|
expect { file.remove_existing(:file) }.to raise_error(Puppet::Error, /Could not remove files of type blockSpecial/)
|
979
980
|
end
|
980
981
|
|
981
982
|
it "should invalidate the existing stat of the file" do
|
982
983
|
# Actually call stat to set @needs_stat to nil
|
983
984
|
file.stat
|
984
|
-
file.
|
985
|
+
allow(file).to receive(:stat).and_return(double('stat', :ftype => 'file'))
|
985
986
|
|
986
|
-
Puppet::FileSystem.
|
987
|
+
allow(Puppet::FileSystem).to receive(:unlink)
|
987
988
|
|
988
989
|
expect(file.remove_existing(:directory)).to eq(true)
|
989
990
|
expect(file.instance_variable_get(:@stat)).to eq(:needs_stat)
|
@@ -993,7 +994,7 @@ describe Puppet::Type.type(:file) do
|
|
993
994
|
describe "#retrieve" do
|
994
995
|
it "should copy the source values if the 'source' parameter is set" do
|
995
996
|
file[:source] = File.expand_path('/foo/bar')
|
996
|
-
file.parameter(:source).
|
997
|
+
expect(file.parameter(:source)).to receive(:copy_source_values)
|
997
998
|
file.retrieve
|
998
999
|
end
|
999
1000
|
end
|
@@ -1009,7 +1010,7 @@ describe Puppet::Type.type(:file) do
|
|
1009
1010
|
end
|
1010
1011
|
|
1011
1012
|
it "should be a file if :ensure is set to :present and the file exists as a normal file" do
|
1012
|
-
file.
|
1013
|
+
allow(file).to receive(:stat).and_return(double('stat', :ftype => "file"))
|
1013
1014
|
file[:ensure] = :present
|
1014
1015
|
expect(file).to be_should_be_file
|
1015
1016
|
end
|
@@ -1020,7 +1021,7 @@ describe Puppet::Type.type(:file) do
|
|
1020
1021
|
end
|
1021
1022
|
|
1022
1023
|
it "should not be a file if :ensure is set to :present and the file exists but is not a normal file" do
|
1023
|
-
file.
|
1024
|
+
allow(file).to receive(:stat).and_return(double('stat', :ftype => "directory"))
|
1024
1025
|
file[:ensure] = :present
|
1025
1026
|
expect(file).to_not be_should_be_file
|
1026
1027
|
end
|
@@ -1031,12 +1032,12 @@ describe Puppet::Type.type(:file) do
|
|
1031
1032
|
end
|
1032
1033
|
|
1033
1034
|
it "should be a file if neither :ensure nor :content is set but the file exists as a normal file" do
|
1034
|
-
file.
|
1035
|
+
allow(file).to receive(:stat).and_return(double("stat", :ftype => "file"))
|
1035
1036
|
expect(file).to be_should_be_file
|
1036
1037
|
end
|
1037
1038
|
|
1038
1039
|
it "should not be a file if neither :ensure nor :content is set but the file exists but not as a normal file" do
|
1039
|
-
file.
|
1040
|
+
allow(file).to receive(:stat).and_return(double("stat", :ftype => "directory"))
|
1040
1041
|
expect(file).to_not be_should_be_file
|
1041
1042
|
end
|
1042
1043
|
end
|
@@ -1103,73 +1104,80 @@ describe Puppet::Type.type(:file) do
|
|
1103
1104
|
|
1104
1105
|
describe "#write" do
|
1105
1106
|
describe "when validating the checksum" do
|
1106
|
-
before { file.
|
1107
|
+
before { allow(file).to receive(:validate_checksum?).and_return(true) }
|
1107
1108
|
|
1108
1109
|
it "should fail if the checksum parameter and content checksums do not match" do
|
1109
|
-
checksum =
|
1110
|
-
file.
|
1111
|
-
file.
|
1110
|
+
checksum = double('checksum_parameter', :sum => 'checksum_b', :sum_file => 'checksum_b')
|
1111
|
+
allow(file).to receive(:parameter).with(:checksum).and_return(checksum)
|
1112
|
+
allow(file).to receive(:parameter).with(:source).and_return(nil)
|
1112
1113
|
|
1113
1114
|
|
1114
|
-
property =
|
1115
|
-
file.
|
1115
|
+
property = double('content_property', :actual_content => "something", :length => "something".length, :write => 'checksum_a')
|
1116
|
+
allow(file).to receive(:property).with(:content).and_return(property)
|
1116
1117
|
|
1117
|
-
expect { file.write property }.to raise_error(Puppet::Error)
|
1118
|
-
end
|
1118
|
+
expect { file.write property }.to raise_error(Puppet::Error) end
|
1119
1119
|
end
|
1120
1120
|
|
1121
1121
|
describe "when not validating the checksum" do
|
1122
|
-
before
|
1122
|
+
before do
|
1123
|
+
allow(file).to receive(:validate_checksum?).and_return(false)
|
1124
|
+
end
|
1123
1125
|
|
1124
1126
|
it "should not fail if the checksum property and content checksums do not match" do
|
1125
|
-
checksum =
|
1126
|
-
file.
|
1127
|
-
file.
|
1127
|
+
checksum = double('checksum_parameter', :sum => 'checksum_b')
|
1128
|
+
allow(file).to receive(:parameter).with(:checksum).and_return(checksum)
|
1129
|
+
allow(file).to receive(:parameter).with(:source).and_return(nil)
|
1128
1130
|
|
1129
|
-
property =
|
1130
|
-
file.
|
1131
|
+
property = double('content_property', :actual_content => "something", :length => "something".length, :write => 'checksum_a')
|
1132
|
+
allow(file).to receive(:property).with(:content).and_return(property)
|
1131
1133
|
|
1132
1134
|
expect { file.write property }.to_not raise_error
|
1133
1135
|
end
|
1134
1136
|
end
|
1135
1137
|
|
1136
1138
|
describe "when resource mode is supplied" do
|
1137
|
-
before
|
1139
|
+
before do
|
1140
|
+
allow(file).to receive(:property_fix)
|
1141
|
+
end
|
1138
1142
|
|
1139
1143
|
context "and writing temporary files" do
|
1140
|
-
before
|
1144
|
+
before do
|
1145
|
+
allow(file).to receive(:write_temporary_file?).and_return(true)
|
1146
|
+
end
|
1141
1147
|
|
1142
1148
|
it "should convert symbolic mode to int" do
|
1143
1149
|
file[:mode] = 'oga=r'
|
1144
|
-
Puppet::Util.
|
1150
|
+
expect(Puppet::Util).to receive(:replace_file).with(file[:path], 0444)
|
1145
1151
|
file.write
|
1146
1152
|
end
|
1147
1153
|
|
1148
1154
|
it "should support int modes" do
|
1149
1155
|
file[:mode] = '0444'
|
1150
|
-
Puppet::Util.
|
1156
|
+
expect(Puppet::Util).to receive(:replace_file).with(file[:path], 0444)
|
1151
1157
|
file.write
|
1152
1158
|
end
|
1153
1159
|
end
|
1154
1160
|
|
1155
1161
|
context "and not writing temporary files" do
|
1156
|
-
before
|
1162
|
+
before do
|
1163
|
+
allow(file).to receive(:write_temporary_file?).and_return(false)
|
1164
|
+
end
|
1157
1165
|
|
1158
1166
|
it "should set a umask of 0" do
|
1159
1167
|
file[:mode] = 'oga=r'
|
1160
|
-
Puppet::Util.
|
1168
|
+
expect(Puppet::Util).to receive(:withumask).with(0)
|
1161
1169
|
file.write
|
1162
1170
|
end
|
1163
1171
|
|
1164
1172
|
it "should convert symbolic mode to int" do
|
1165
1173
|
file[:mode] = 'oga=r'
|
1166
|
-
File.
|
1174
|
+
expect(File).to receive(:open).with(file[:path], anything, 0444)
|
1167
1175
|
file.write
|
1168
1176
|
end
|
1169
1177
|
|
1170
1178
|
it "should support int modes" do
|
1171
1179
|
file[:mode] = '0444'
|
1172
|
-
File.
|
1180
|
+
expect(File).to receive(:open).with(file[:path], anything, 0444)
|
1173
1181
|
file.write
|
1174
1182
|
end
|
1175
1183
|
end
|
@@ -1204,8 +1212,8 @@ describe Puppet::Type.type(:file) do
|
|
1204
1212
|
describe "#fail_if_checksum_is_wrong" do
|
1205
1213
|
it "should fail if the checksum of the file doesn't match the expected one" do
|
1206
1214
|
expect do
|
1215
|
+
allow(file.parameter(:checksum)).to receive(:sum_file).and_return('wrong!!')
|
1207
1216
|
file.instance_eval do
|
1208
|
-
parameter(:checksum).stubs(:sum_file).returns('wrong!!')
|
1209
1217
|
fail_if_checksum_is_wrong(self[:path], 'anything!')
|
1210
1218
|
end
|
1211
1219
|
end.to raise_error(Puppet::Error, /File written to disk did not match checksum/)
|
@@ -1213,8 +1221,8 @@ describe Puppet::Type.type(:file) do
|
|
1213
1221
|
|
1214
1222
|
it "should not fail if the checksum is correct" do
|
1215
1223
|
expect do
|
1224
|
+
allow(file.parameter(:checksum)).to receive(:sum_file).and_return('anything!')
|
1216
1225
|
file.instance_eval do
|
1217
|
-
parameter(:checksum).stubs(:sum_file).returns('anything!')
|
1218
1226
|
fail_if_checksum_is_wrong(self[:path], 'anything!')
|
1219
1227
|
end
|
1220
1228
|
end.not_to raise_error
|
@@ -1222,8 +1230,8 @@ describe Puppet::Type.type(:file) do
|
|
1222
1230
|
|
1223
1231
|
it "should not fail if the checksum is absent" do
|
1224
1232
|
expect do
|
1233
|
+
allow(file.parameter(:checksum)).to receive(:sum_file).and_return(nil)
|
1225
1234
|
file.instance_eval do
|
1226
|
-
parameter(:checksum).stubs(:sum_file).returns(nil)
|
1227
1235
|
fail_if_checksum_is_wrong(self[:path], 'anything!')
|
1228
1236
|
end
|
1229
1237
|
end.not_to raise_error
|
@@ -1262,9 +1270,9 @@ describe Puppet::Type.type(:file) do
|
|
1262
1270
|
file[name] = value
|
1263
1271
|
|
1264
1272
|
prop = file.property(name)
|
1265
|
-
prop.
|
1266
|
-
prop.
|
1267
|
-
prop.
|
1273
|
+
expect(prop).to receive(:retrieve)
|
1274
|
+
expect(prop).to receive(:safe_insync?).and_return(false)
|
1275
|
+
expect(prop).to receive(:sync)
|
1268
1276
|
|
1269
1277
|
file.send(:property_fix)
|
1270
1278
|
end
|
@@ -1398,7 +1406,7 @@ describe Puppet::Type.type(:file) do
|
|
1398
1406
|
catalog.add_resource @link_resource
|
1399
1407
|
|
1400
1408
|
# to prevent the catalog from trying to write state.yaml
|
1401
|
-
Puppet::Util::Storage.
|
1409
|
+
allow(Puppet::Util::Storage).to receive(:store)
|
1402
1410
|
end
|
1403
1411
|
|
1404
1412
|
it "should preserve the original file mode and ignore the one set by the link" do
|
@@ -1435,17 +1443,21 @@ describe Puppet::Type.type(:file) do
|
|
1435
1443
|
file[:source] = source
|
1436
1444
|
|
1437
1445
|
# intercept the indirector call to provide back mocked metadata for the given URI
|
1438
|
-
metadata =
|
1439
|
-
metadata.
|
1440
|
-
Puppet::FileServing::Metadata.indirection.
|
1441
|
-
path == source
|
1442
|
-
end.returns metadata
|
1446
|
+
metadata = double('metadata', :source => source)
|
1447
|
+
expect(metadata).to receive(:source=)
|
1448
|
+
expect(Puppet::FileServing::Metadata.indirection).to receive(:find).with(source, anything).and_return(metadata)
|
1443
1449
|
|
1444
1450
|
uri = file.parameters[:source].uri
|
1445
1451
|
expect(URI.unescape(uri.path)).to eq(filename)
|
1446
1452
|
expect(uri.path.encoding).to eq(Encoding::UTF_8)
|
1447
1453
|
end
|
1448
1454
|
|
1455
|
+
matcher :request_key do |expected|
|
1456
|
+
match do |actual|
|
1457
|
+
values_match? expected, actual.key
|
1458
|
+
end
|
1459
|
+
end
|
1460
|
+
|
1449
1461
|
it 'should allow UTF-8 characters inside the indirector / terminus code' do
|
1450
1462
|
filename = "/bar #{mixed_utf8}"
|
1451
1463
|
source = "puppet://foo#{filename}"
|
@@ -1454,12 +1466,10 @@ describe Puppet::Type.type(:file) do
|
|
1454
1466
|
# for this test to properly trigger previously errant behavior, the code for
|
1455
1467
|
# Puppet::FileServing::Metadata.indirection.find must run and produce an
|
1456
1468
|
# instance of Puppet::Indirector::FileMetadata::Rest that can be amended
|
1457
|
-
metadata =
|
1458
|
-
metadata.
|
1469
|
+
metadata = double('metadata', :source => source)
|
1470
|
+
expect(metadata).to receive(:source=)
|
1459
1471
|
require 'puppet/indirector/file_metadata/rest'
|
1460
|
-
Puppet::Indirector::FileMetadata::Rest.
|
1461
|
-
req.key == filename[1..-1]
|
1462
|
-
end.returns(metadata)
|
1472
|
+
expect_any_instance_of(Puppet::Indirector::FileMetadata::Rest).to receive(:find).with(request_key(filename[1..-1])).and_return(metadata)
|
1463
1473
|
|
1464
1474
|
uri = file.parameters[:source].uri
|
1465
1475
|
expect(URI.unescape(uri.path)).to eq(filename)
|
@@ -1511,7 +1521,7 @@ describe Puppet::Type.type(:file) do
|
|
1511
1521
|
|
1512
1522
|
describe "on Windows when source_permissions is `use`" do
|
1513
1523
|
before :each do
|
1514
|
-
Puppet::Util::Platform.
|
1524
|
+
allow(Puppet::Util::Platform).to receive(:windows?).and_return(true)
|
1515
1525
|
|
1516
1526
|
file[:source_permissions] = "use"
|
1517
1527
|
end
|
@@ -1549,8 +1559,8 @@ describe Puppet::Type.type(:file) do
|
|
1549
1559
|
file[:group] = 2
|
1550
1560
|
file[:mode] = "0003"
|
1551
1561
|
|
1552
|
-
file.parameter(:source).
|
1553
|
-
file.
|
1562
|
+
expect(file.parameter(:source)).to receive(:copy_source_values)
|
1563
|
+
expect(file).to receive(:warning).with(err_message)
|
1554
1564
|
expect { file.retrieve }.not_to raise_error
|
1555
1565
|
end
|
1556
1566
|
end
|
@@ -1638,7 +1648,7 @@ describe Puppet::Type.type(:file) do
|
|
1638
1648
|
describe "when auditing" do
|
1639
1649
|
before :each do
|
1640
1650
|
# to prevent the catalog from trying to write state.yaml
|
1641
|
-
Puppet::Util::Storage.
|
1651
|
+
allow(Puppet::Util::Storage).to receive(:store)
|
1642
1652
|
end
|
1643
1653
|
|
1644
1654
|
it "should not fail if creating a new file if group is not set" do
|