puppet 6.0.10-universal-darwin → 6.1.0-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 +1 -0
- data/Gemfile.lock +31 -27
- data/Guardfile.example +76 -0
- data/LICENSE +189 -4
- data/MAINTAINERS +47 -0
- data/README.md +3 -3
- data/lib/hiera/scope.rb +0 -7
- data/lib/puppet.rb +6 -5
- data/lib/puppet/application.rb +3 -3
- data/lib/puppet/application/cert.rb +2 -2
- data/lib/puppet/application/device.rb +83 -109
- data/lib/puppet/application/filebucket.rb +1 -10
- data/lib/puppet/application/ssl.rb +0 -2
- data/lib/puppet/configurer.rb +9 -10
- data/lib/puppet/confine/false.rb +1 -7
- data/lib/puppet/confine/true.rb +1 -7
- data/lib/puppet/defaults.rb +39 -51
- data/lib/puppet/forge.rb +1 -4
- data/lib/puppet/functions/abs.rb +1 -1
- data/lib/puppet/functions/call.rb +1 -2
- data/lib/puppet/functions/new.rb +1 -1
- data/lib/puppet/indirector/request.rb +15 -26
- data/lib/puppet/network/http/connection.rb +12 -32
- data/lib/puppet/network/http/factory.rb +0 -5
- data/lib/puppet/pal/catalog_compiler.rb +96 -0
- data/lib/puppet/pal/compiler.rb +221 -0
- data/lib/puppet/pal/function_signature.rb +52 -0
- data/lib/puppet/pal/json_catalog_encoder.rb +67 -0
- data/lib/puppet/pal/pal_api.rb +15 -0
- data/lib/puppet/pal/pal_impl.rb +523 -0
- data/lib/puppet/pal/plan_signature.rb +71 -0
- data/lib/puppet/pal/script_compiler.rb +71 -0
- data/lib/puppet/pal/task_signature.rb +58 -0
- data/lib/puppet/parser/functions/generate.rb +7 -6
- data/lib/puppet/plugins/configuration.rb +5 -1
- data/lib/puppet/pops/evaluator/evaluator_impl.rb +5 -1
- data/lib/puppet/pops/evaluator/external_syntax_support.rb +3 -3
- data/lib/puppet/pops/issues.rb +0 -4
- data/lib/puppet/pops/loader/ruby_legacy_function_instantiator.rb +4 -60
- data/lib/puppet/pops/model/factory.rb +4 -38
- data/lib/puppet/pops/model/pn_transformer.rb +0 -5
- data/lib/puppet/pops/parser/egrammar.ra +2 -2
- data/lib/puppet/pops/parser/heredoc_support.rb +7 -17
- data/lib/puppet/pops/parser/lexer2.rb +1 -6
- data/lib/puppet/pops/parser/locator.rb +86 -106
- data/lib/puppet/pops/parser/parser_support.rb +2 -11
- data/lib/puppet/pops/types/string_converter.rb +7 -2
- data/lib/puppet/pops/types/type_mismatch_describer.rb +1 -1
- data/lib/puppet/pops/types/types.rb +3 -5
- data/lib/puppet/pops/validation/checker4_0.rb +13 -0
- data/lib/puppet/provider.rb +2 -1
- data/lib/puppet/provider/exec.rb +6 -1
- data/lib/puppet/provider/file/windows.rb +1 -49
- data/lib/puppet/provider/group/windows_adsi.rb +1 -4
- data/lib/puppet/provider/package.rb +0 -2
- data/lib/puppet/provider/package/dpkg.rb +2 -15
- data/lib/puppet/provider/package/gem.rb +42 -102
- data/lib/puppet/provider/package/pip.rb +111 -135
- data/lib/puppet/provider/package/pip3.rb +1 -1
- data/lib/puppet/provider/package/pkgng.rb +37 -21
- data/lib/puppet/provider/package/puppet_gem.rb +1 -1
- data/lib/puppet/provider/package/rpm.rb +16 -27
- data/lib/puppet/provider/package/windows.rb +1 -5
- data/lib/puppet/provider/package/yum.rb +1 -2
- data/lib/puppet/provider/service/systemd.rb +17 -0
- data/lib/puppet/provider/service/upstart.rb +5 -17
- data/lib/puppet/provider/service/windows.rb +8 -3
- data/lib/puppet/provider/user/directoryservice.rb +4 -16
- data/lib/puppet/provider/user/useradd.rb +13 -16
- data/lib/puppet/resource.rb +3 -1
- data/lib/puppet/rest/client.rb +83 -0
- data/lib/puppet/rest/route.rb +1 -1
- data/lib/puppet/settings.rb +5 -10
- data/lib/puppet/settings/server_list_setting.rb +0 -9
- data/lib/puppet/ssl/host.rb +11 -0
- data/lib/puppet/ssl/validator/default_validator.rb +0 -31
- data/lib/puppet/syntax_checkers/epp.rb +34 -0
- data/lib/puppet/syntax_checkers/pp.rb +34 -0
- data/lib/puppet/transaction.rb +7 -12
- data/lib/puppet/transaction/event_manager.rb +5 -1
- data/lib/puppet/transaction/resource_harness.rb +0 -1
- data/lib/puppet/type.rb +6 -0
- data/lib/puppet/type/exec.rb +5 -27
- data/lib/puppet/type/file/mode.rb +1 -6
- data/lib/puppet/type/file/source.rb +1 -0
- data/lib/puppet/type/filebucket.rb +8 -12
- data/lib/puppet/type/package.rb +11 -44
- data/lib/puppet/type/schedule.rb +0 -4
- data/lib/puppet/type/service.rb +12 -0
- data/lib/puppet/type/user.rb +1 -1
- data/lib/puppet/util/command_line.rb +1 -5
- data/lib/puppet/util/connection.rb +6 -15
- data/lib/puppet/util/http_proxy.rb +2 -3
- data/lib/puppet/util/log.rb +2 -7
- data/lib/puppet/util/pidlock.rb +1 -15
- data/lib/puppet/util/windows/process.rb +5 -73
- data/lib/puppet/util/windows/registry.rb +1 -7
- data/lib/puppet/util/windows/security.rb +8 -29
- data/lib/puppet/util/windows/service.rb +33 -27
- data/lib/puppet/util/windows/user.rb +4 -14
- data/lib/puppet/version.rb +1 -1
- data/lib/puppet_pal.rb +5 -1132
- data/locales/ja/puppet.po +297 -363
- data/locales/puppet.pot +445 -517
- data/man/man5/puppet.conf.5 +12 -20
- 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 +2 -6
- 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/fixtures/unit/provider/package/pkgng/pkg.query +7 -1
- data/spec/fixtures/unit/provider/package/pkgng/pkg.query.zsh +1 -0
- data/spec/integration/agent/logging_spec.rb +7 -5
- data/spec/integration/application/apply_spec.rb +16 -18
- data/spec/integration/application/doc_spec.rb +2 -1
- data/spec/integration/application/lookup_spec.rb +5 -5
- data/spec/integration/configurer_spec.rb +6 -5
- data/spec/integration/defaults_spec.rb +6 -5
- data/spec/integration/directory_environments_spec.rb +1 -1
- data/spec/integration/faces/config_spec.rb +4 -3
- data/spec/integration/faces/documentation_spec.rb +1 -0
- data/spec/integration/faces/plugin_spec.rb +1 -1
- data/spec/integration/file_bucket/file_spec.rb +4 -2
- data/spec/integration/file_serving/content_spec.rb +1 -0
- data/spec/integration/file_serving/fileset_spec.rb +1 -0
- data/spec/integration/file_serving/metadata_spec.rb +1 -0
- data/spec/integration/file_serving/terminus_helper_spec.rb +1 -0
- data/spec/integration/indirector/catalog/compiler_spec.rb +11 -10
- data/spec/integration/indirector/direct_file_server_spec.rb +1 -1
- data/spec/integration/indirector/facts/facter_spec.rb +5 -4
- data/spec/integration/indirector/file_content/file_server_spec.rb +8 -7
- data/spec/integration/indirector/file_metadata/file_server_spec.rb +8 -7
- data/spec/integration/network/authconfig_spec.rb +24 -23
- data/spec/integration/network/formats_spec.rb +1 -0
- data/spec/integration/node/environment_spec.rb +1 -0
- data/spec/integration/node/facts_spec.rb +10 -9
- data/spec/integration/node_spec.rb +7 -6
- data/spec/integration/parser/catalog_spec.rb +5 -1
- data/spec/integration/parser/collection_spec.rb +2 -1
- 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 +5 -4
- data/spec/integration/provider/service/systemd_spec.rb +2 -0
- data/spec/integration/provider/service/windows_spec.rb +2 -1
- data/spec/integration/reference/providers_spec.rb +2 -1
- data/spec/integration/reports_spec.rb +2 -1
- data/spec/integration/resource/catalog_spec.rb +17 -14
- data/spec/integration/resource/type_collection_spec.rb +5 -4
- data/spec/integration/ssl/certificate_request_spec.rb +1 -0
- data/spec/integration/ssl/host_spec.rb +2 -1
- data/spec/integration/ssl/key_spec.rb +1 -0
- data/spec/integration/test/test_helper_spec.rb +1 -0
- data/spec/integration/transaction/report_spec.rb +11 -6
- data/spec/integration/transaction_spec.rb +19 -18
- data/spec/integration/type/exec_spec.rb +1 -0
- data/spec/integration/type/file_spec.rb +33 -13
- data/spec/integration/type/package_spec.rb +24 -20
- data/spec/integration/type/tidy_spec.rb +2 -1
- data/spec/integration/type_spec.rb +1 -0
- data/spec/integration/util/autoload_spec.rb +2 -1
- data/spec/integration/util/rdoc/parser_spec.rb +1 -0
- data/spec/integration/util/settings_spec.rb +1 -0
- data/spec/integration/util/windows/adsi_spec.rb +5 -3
- data/spec/integration/util/windows/principal_spec.rb +1 -0
- data/spec/integration/util/windows/process_spec.rb +6 -4
- data/spec/integration/util/windows/registry_spec.rb +51 -93
- data/spec/integration/util/windows/security_spec.rb +4 -2
- data/spec/integration/util/windows/user_spec.rb +20 -37
- data/spec/integration/util_spec.rb +7 -4
- data/spec/lib/puppet_spec/compiler.rb +1 -1
- data/spec/lib/puppet_spec/files.rb +1 -0
- data/spec/lib/puppet_spec/module_tool/shared_functions.rb +1 -1
- data/spec/lib/puppet_spec/scope.rb +2 -1
- data/spec/shared_behaviours/all_parsedfile_providers.rb +1 -1
- data/spec/shared_behaviours/file_server_terminus.rb +9 -8
- data/spec/shared_behaviours/file_serving.rb +8 -6
- data/spec/shared_behaviours/file_serving_model.rb +5 -3
- data/spec/shared_behaviours/hiera_indirections.rb +4 -3
- data/spec/shared_behaviours/iterative_functions.rb +1 -0
- data/spec/shared_behaviours/memory_terminus.rb +2 -2
- data/spec/shared_examples/rhel_package_provider.rb +70 -112
- data/spec/spec_helper.rb +2 -11
- data/spec/unit/agent/disabler_spec.rb +5 -4
- data/spec/unit/agent/locker_spec.rb +13 -12
- data/spec/unit/agent_spec.rb +85 -80
- data/spec/unit/application/agent_spec.rb +93 -88
- data/spec/unit/application/apply_spec.rb +83 -82
- data/spec/unit/application/config_spec.rb +1 -0
- data/spec/unit/application/describe_spec.rb +7 -6
- data/spec/unit/application/device_spec.rb +419 -395
- data/spec/unit/application/doc_spec.rb +46 -44
- data/spec/unit/application/face_base_spec.rb +62 -61
- data/spec/unit/application/facts_spec.rb +4 -3
- data/spec/unit/application/filebucket_spec.rb +74 -66
- data/spec/unit/application/indirection_base_spec.rb +6 -8
- data/spec/unit/application/lookup_spec.rb +26 -26
- data/spec/unit/application/resource_spec.rb +48 -42
- data/spec/unit/application/ssl_spec.rb +3 -8
- data/spec/unit/application_spec.rb +98 -86
- data/spec/unit/capability_spec.rb +6 -6
- data/spec/unit/certificate_factory_spec.rb +5 -3
- data/spec/unit/configurer/downloader_spec.rb +21 -20
- data/spec/unit/configurer/fact_handler_spec.rb +3 -2
- data/spec/unit/configurer/plugin_handler_spec.rb +8 -41
- data/spec/unit/configurer_spec.rb +198 -194
- data/spec/unit/confine/exists_spec.rb +15 -17
- data/spec/unit/confine/false_spec.rb +6 -32
- data/spec/unit/confine/feature_spec.rb +5 -7
- data/spec/unit/confine/true_spec.rb +6 -32
- data/spec/unit/confine/variable_spec.rb +15 -14
- data/spec/unit/confine_collection_spec.rb +29 -28
- data/spec/unit/confine_spec.rb +14 -13
- data/spec/unit/confiner_spec.rb +11 -10
- data/spec/unit/context/trusted_information_spec.rb +1 -1
- data/spec/unit/daemon_spec.rb +36 -35
- data/spec/unit/data_providers/function_data_provider_spec.rb +1 -0
- data/spec/unit/data_providers/hiera_data_provider_spec.rb +1 -0
- data/spec/unit/datatypes_spec.rb +4 -3
- data/spec/unit/defaults_spec.rb +27 -18
- data/spec/unit/environments_spec.rb +7 -7
- data/spec/unit/etc_spec.rb +32 -30
- data/spec/unit/external/pson_spec.rb +1 -0
- data/spec/unit/face/catalog_spec.rb +1 -0
- data/spec/unit/face/config_spec.rb +35 -31
- data/spec/unit/face/epp_face_spec.rb +4 -3
- data/spec/unit/face/facts_spec.rb +6 -5
- data/spec/unit/face/generate_spec.rb +5 -4
- data/spec/unit/face/help_spec.rb +8 -7
- data/spec/unit/face/key_spec.rb +1 -0
- data/spec/unit/face/man_spec.rb +2 -1
- data/spec/unit/face/module/install_spec.rb +5 -3
- data/spec/unit/face/module/list_spec.rb +12 -2
- data/spec/unit/face/module/search_spec.rb +9 -11
- data/spec/unit/face/module/uninstall_spec.rb +8 -4
- data/spec/unit/face/node_spec.rb +24 -23
- data/spec/unit/face/parser_spec.rb +18 -3
- data/spec/unit/face/plugin_spec.rb +9 -36
- data/spec/unit/face/status_spec.rb +1 -0
- data/spec/unit/file_bucket/dipper_spec.rb +20 -24
- data/spec/unit/file_bucket/file_spec.rb +2 -0
- data/spec/unit/file_serving/base_spec.rb +15 -14
- data/spec/unit/file_serving/configuration/parser_spec.rb +28 -27
- data/spec/unit/file_serving/configuration_spec.rb +66 -63
- data/spec/unit/file_serving/content_spec.rb +11 -10
- data/spec/unit/file_serving/fileset_spec.rb +58 -63
- data/spec/unit/file_serving/http_metadata_spec.rb +7 -8
- data/spec/unit/file_serving/metadata_spec.rb +36 -36
- data/spec/unit/file_serving/mount/file_spec.rb +32 -31
- data/spec/unit/file_serving/mount/locales_spec.rb +24 -23
- data/spec/unit/file_serving/mount/modules_spec.rb +15 -14
- data/spec/unit/file_serving/mount/pluginfacts_spec.rb +24 -23
- data/spec/unit/file_serving/mount/plugins_spec.rb +24 -23
- data/spec/unit/file_serving/mount/tasks_spec.rb +15 -14
- data/spec/unit/file_serving/mount_spec.rb +1 -0
- data/spec/unit/file_serving/terminus_helper_spec.rb +42 -37
- data/spec/unit/file_serving/terminus_selector_spec.rb +13 -12
- data/spec/unit/file_system/uniquefile_spec.rb +4 -4
- data/spec/unit/file_system_spec.rb +2 -2
- data/spec/unit/forge/errors_spec.rb +1 -1
- data/spec/unit/forge/forge_spec.rb +16 -17
- data/spec/unit/forge/module_release_spec.rb +18 -18
- data/spec/unit/forge/repository_spec.rb +30 -29
- data/spec/unit/forge_spec.rb +11 -15
- data/spec/unit/functions/binary_file_spec.rb +3 -3
- data/spec/unit/functions/contain_spec.rb +2 -0
- data/spec/unit/functions/defined_spec.rb +1 -0
- 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 +4 -0
- data/spec/unit/functions/lookup_fixture_spec.rb +1 -0
- data/spec/unit/functions/lookup_spec.rb +2 -1
- data/spec/unit/functions/module_directory_spec.rb +12 -12
- data/spec/unit/functions/new_spec.rb +0 -15
- data/spec/unit/functions/require_spec.rb +3 -0
- data/spec/unit/functions/shared.rb +8 -5
- data/spec/unit/functions/versioncmp_spec.rb +2 -1
- data/spec/unit/functions4_spec.rb +10 -9
- 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 +2 -0
- data/spec/unit/graph/relationship_graph_spec.rb +2 -1
- data/spec/unit/graph/simple_graph_spec.rb +10 -9
- data/spec/unit/hiera/scope_spec.rb +0 -7
- data/spec/unit/hiera_puppet_spec.rb +20 -20
- data/spec/unit/indirector/catalog/compiler_spec.rb +149 -147
- data/spec/unit/indirector/catalog/json_spec.rb +2 -1
- data/spec/unit/indirector/catalog/msgpack_spec.rb +1 -0
- data/spec/unit/indirector/catalog/rest_spec.rb +1 -0
- data/spec/unit/indirector/catalog/store_configs_spec.rb +1 -0
- data/spec/unit/indirector/catalog/yaml_spec.rb +1 -0
- data/spec/unit/indirector/certificate/file_spec.rb +1 -0
- data/spec/unit/indirector/certificate/rest_spec.rb +10 -8
- data/spec/unit/indirector/certificate_request/file_spec.rb +1 -0
- data/spec/unit/indirector/certificate_request/rest_spec.rb +1 -0
- data/spec/unit/indirector/direct_file_server_spec.rb +18 -17
- data/spec/unit/indirector/envelope_spec.rb +2 -1
- data/spec/unit/indirector/exec_spec.rb +5 -4
- data/spec/unit/indirector/face_spec.rb +9 -9
- data/spec/unit/indirector/facts/facter_spec.rb +43 -37
- data/spec/unit/indirector/facts/network_device_spec.rb +9 -8
- data/spec/unit/indirector/facts/rest_spec.rb +8 -7
- data/spec/unit/indirector/facts/store_configs_spec.rb +1 -0
- data/spec/unit/indirector/facts/yaml_spec.rb +1 -0
- data/spec/unit/indirector/file_bucket_file/file_spec.rb +4 -3
- data/spec/unit/indirector/file_bucket_file/rest_spec.rb +1 -0
- data/spec/unit/indirector/file_bucket_file/selector_spec.rb +5 -4
- data/spec/unit/indirector/file_content/file_server_spec.rb +1 -0
- data/spec/unit/indirector/file_content/file_spec.rb +1 -0
- data/spec/unit/indirector/file_content/rest_spec.rb +1 -0
- data/spec/unit/indirector/file_content/selector_spec.rb +1 -0
- data/spec/unit/indirector/file_metadata/file_server_spec.rb +1 -0
- data/spec/unit/indirector/file_metadata/file_spec.rb +13 -12
- data/spec/unit/indirector/file_metadata/rest_spec.rb +1 -0
- data/spec/unit/indirector/file_metadata/selector_spec.rb +1 -0
- data/spec/unit/indirector/file_server_spec.rb +87 -87
- data/spec/unit/indirector/indirection_spec.rb +226 -242
- data/spec/unit/indirector/json_spec.rb +9 -7
- data/spec/unit/indirector/key/file_spec.rb +22 -21
- data/spec/unit/indirector/memory_spec.rb +7 -6
- data/spec/unit/indirector/msgpack_spec.rb +9 -7
- data/spec/unit/indirector/node/exec_spec.rb +3 -2
- data/spec/unit/indirector/node/memory_spec.rb +4 -2
- data/spec/unit/indirector/node/msgpack_spec.rb +1 -0
- data/spec/unit/indirector/node/plain_spec.rb +4 -2
- data/spec/unit/indirector/node/rest_spec.rb +1 -0
- data/spec/unit/indirector/node/store_configs_spec.rb +1 -0
- data/spec/unit/indirector/node/yaml_spec.rb +1 -0
- data/spec/unit/indirector/none_spec.rb +5 -5
- data/spec/unit/indirector/plain_spec.rb +8 -7
- data/spec/unit/indirector/report/msgpack_spec.rb +1 -0
- data/spec/unit/indirector/report/processor_spec.rb +22 -21
- data/spec/unit/indirector/report/rest_spec.rb +12 -11
- data/spec/unit/indirector/report/yaml_spec.rb +1 -0
- data/spec/unit/indirector/request_spec.rb +12 -11
- data/spec/unit/indirector/resource/ral_spec.rb +54 -47
- data/spec/unit/indirector/resource/store_configs_spec.rb +1 -0
- data/spec/unit/indirector/rest_spec.rb +110 -113
- data/spec/unit/indirector/ssl_file_spec.rb +65 -64
- data/spec/unit/indirector/status/local_spec.rb +1 -0
- data/spec/unit/indirector/status/rest_spec.rb +1 -0
- data/spec/unit/indirector/store_configs_spec.rb +1 -0
- data/spec/unit/indirector/terminus_spec.rb +27 -27
- data/spec/unit/indirector/yaml_spec.rb +6 -5
- data/spec/unit/indirector_spec.rb +2 -1
- data/spec/unit/info_service_spec.rb +1 -1
- data/spec/unit/interface/action_builder_spec.rb +1 -0
- data/spec/unit/interface/action_manager_spec.rb +1 -0
- data/spec/unit/interface/action_spec.rb +3 -2
- data/spec/unit/interface/documentation_spec.rb +1 -0
- data/spec/unit/interface/face_collection_spec.rb +12 -19
- data/spec/unit/interface_spec.rb +3 -3
- data/spec/unit/man_spec.rb +4 -3
- data/spec/unit/module_spec.rb +51 -46
- data/spec/unit/module_tool/applications/installer_spec.rb +11 -10
- data/spec/unit/module_tool/applications/searcher_spec.rb +3 -3
- data/spec/unit/module_tool/applications/uninstaller_spec.rb +2 -1
- 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 +13 -12
- data/spec/unit/module_tool_spec.rb +12 -7
- data/spec/unit/network/auth_config_parser_spec.rb +13 -11
- data/spec/unit/network/authconfig_spec.rb +18 -17
- data/spec/unit/network/authorization_spec.rb +5 -4
- data/spec/unit/network/authstore_spec.rb +1 -0
- data/spec/unit/network/format_handler_spec.rb +1 -0
- data/spec/unit/network/format_spec.rb +10 -9
- data/spec/unit/network/format_support_spec.rb +29 -28
- data/spec/unit/network/formats_spec.rb +5 -4
- data/spec/unit/network/http/api/indirected_routes_spec.rb +29 -24
- 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 +7 -6
- data/spec/unit/network/http/api_spec.rb +2 -0
- data/spec/unit/network/http/compression_spec.rb +22 -21
- data/spec/unit/network/http/connection_spec.rb +121 -30
- data/spec/unit/network/http/factory_spec.rb +6 -11
- data/spec/unit/network/http/handler_spec.rb +18 -9
- data/spec/unit/network/http/nocache_pool_spec.rb +7 -6
- data/spec/unit/network/http/pool_spec.rb +29 -28
- data/spec/unit/network/http/request_spec.rb +2 -0
- data/spec/unit/network/http/response_spec.rb +13 -11
- data/spec/unit/network/http/route_spec.rb +1 -0
- data/spec/unit/network/http/session_spec.rb +2 -1
- data/spec/unit/network/http/site_spec.rb +1 -0
- data/spec/unit/network/http_pool_spec.rb +9 -18
- data/spec/unit/network/http_spec.rb +1 -0
- data/spec/unit/network/resolver_spec.rb +26 -25
- data/spec/unit/network/rights_spec.rb +53 -52
- data/spec/unit/node/environment_spec.rb +15 -14
- data/spec/unit/node/facts_spec.rb +7 -5
- data/spec/unit/node_spec.rb +10 -4
- data/spec/unit/other/selinux_spec.rb +1 -0
- data/spec/unit/parameter/boolean_spec.rb +2 -1
- data/spec/unit/parameter/package_options_spec.rb +2 -1
- data/spec/unit/parameter/path_spec.rb +1 -0
- data/spec/unit/parameter/value_collection_spec.rb +1 -0
- data/spec/unit/parameter/value_spec.rb +1 -0
- data/spec/unit/parameter_spec.rb +9 -9
- data/spec/unit/parser/ast/block_expression_spec.rb +8 -6
- data/spec/unit/parser/ast/leaf_spec.rb +21 -20
- data/spec/unit/parser/compiler_spec.rb +96 -84
- data/spec/unit/parser/environment_compiler_spec.rb +8 -7
- data/spec/unit/parser/files_spec.rb +1 -0
- data/spec/unit/parser/functions/create_resources_spec.rb +1 -1
- data/spec/unit/parser/functions/digest_spec.rb +1 -0
- data/spec/unit/parser/functions/fail_spec.rb +2 -1
- data/spec/unit/parser/functions/file_spec.rb +14 -13
- data/spec/unit/parser/functions/fqdn_rand_spec.rb +6 -5
- data/spec/unit/parser/functions/generate_spec.rb +8 -7
- data/spec/unit/parser/functions/inline_template_spec.rb +1 -0
- data/spec/unit/parser/functions/regsubst_spec.rb +1 -0
- data/spec/unit/parser/functions/scanf_spec.rb +1 -0
- data/spec/unit/parser/functions/shellquote_spec.rb +1 -0
- data/spec/unit/parser/functions/split_spec.rb +1 -0
- data/spec/unit/parser/functions/sprintf_spec.rb +1 -0
- data/spec/unit/parser/functions/tag_spec.rb +2 -1
- data/spec/unit/parser/functions/tagged_spec.rb +3 -2
- data/spec/unit/parser/functions/template_spec.rb +13 -13
- data/spec/unit/parser/functions/versioncmp_spec.rb +2 -1
- data/spec/unit/parser/functions_spec.rb +7 -6
- data/spec/unit/parser/relationship_spec.rb +1 -0
- data/spec/unit/parser/resource_spec.rb +42 -42
- data/spec/unit/parser/scope_spec.rb +35 -39
- data/spec/unit/parser/templatewrapper_spec.rb +12 -11
- data/spec/unit/parser/type_loader_spec.rb +19 -17
- data/spec/unit/pops/adaptable_spec.rb +1 -0
- data/spec/unit/pops/benchmark_spec.rb +1 -0
- data/spec/unit/pops/evaluator/access_ops_spec.rb +1 -0
- data/spec/unit/pops/evaluator/arithmetic_ops_spec.rb +1 -0
- data/spec/unit/pops/evaluator/basic_expressions_spec.rb +1 -0
- data/spec/unit/pops/evaluator/collections_ops_spec.rb +1 -0
- data/spec/unit/pops/evaluator/comparison_ops_spec.rb +1 -0
- data/spec/unit/pops/evaluator/conditionals_spec.rb +1 -0
- data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +47 -10
- data/spec/unit/pops/evaluator/logical_ops_spec.rb +1 -0
- data/spec/unit/pops/evaluator/runtime3_converter_spec.rb +1 -0
- data/spec/unit/pops/evaluator/string_interpolation_spec.rb +1 -0
- data/spec/unit/pops/evaluator/variables_spec.rb +1 -0
- data/spec/unit/pops/factory_spec.rb +4 -3
- data/spec/unit/pops/issues_spec.rb +20 -19
- data/spec/unit/pops/loaders/loader_spec.rb +4 -8
- data/spec/unit/pops/loaders/loaders_spec.rb +31 -101
- data/spec/unit/pops/lookup/context_spec.rb +1 -0
- data/spec/unit/pops/lookup/interpolation_spec.rb +3 -2
- data/spec/unit/pops/merge_strategy_spec.rb +1 -0
- data/spec/unit/pops/migration_spec.rb +5 -3
- data/spec/unit/pops/model/model_spec.rb +1 -0
- data/spec/unit/pops/model/pn_transformer_spec.rb +1 -4
- data/spec/unit/pops/parser/locator_spec.rb +6 -48
- data/spec/unit/pops/parser/parse_application_spec.rb +1 -0
- data/spec/unit/pops/parser/parse_basic_expressions_spec.rb +1 -0
- data/spec/unit/pops/parser/parse_calls_spec.rb +1 -0
- data/spec/unit/pops/parser/parse_capabilities_spec.rb +1 -0
- data/spec/unit/pops/parser/parse_conditionals_spec.rb +1 -0
- data/spec/unit/pops/parser/parse_containers_spec.rb +1 -0
- data/spec/unit/pops/parser/parse_heredoc_spec.rb +15 -111
- data/spec/unit/pops/parser/parse_plan_spec.rb +1 -0
- data/spec/unit/pops/parser/parse_resource_spec.rb +1 -0
- data/spec/unit/pops/parser/parse_site_spec.rb +1 -0
- data/spec/unit/pops/parser/pn_parser_spec.rb +1 -0
- data/spec/unit/pops/pn_spec.rb +1 -0
- data/spec/unit/pops/resource/resource_type_impl_spec.rb +1 -0
- 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/string_converter_spec.rb +5 -1
- 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_mismatch_describer_spec.rb +0 -9
- data/spec/unit/pops/types/type_parser_spec.rb +13 -13
- data/spec/unit/pops/validator/validator_spec.rb +2 -1
- data/spec/unit/pops/visitor_spec.rb +1 -0
- data/spec/unit/property/boolean_spec.rb +1 -1
- data/spec/unit/property/ensure_spec.rb +1 -0
- data/spec/unit/property/keyvalue_spec.rb +34 -32
- data/spec/unit/property/list_spec.rb +27 -26
- data/spec/unit/property/ordered_list_spec.rb +14 -10
- data/spec/unit/property_spec.rb +43 -42
- data/spec/unit/provider/aix_object_spec.rb +45 -47
- data/spec/unit/provider/command_spec.rb +9 -9
- data/spec/unit/provider/exec/posix_spec.rb +31 -6
- data/spec/unit/provider/exec/shell_spec.rb +1 -0
- data/spec/unit/provider/exec/windows_spec.rb +4 -2
- data/spec/unit/provider/exec_spec.rb +1 -0
- data/spec/unit/provider/file/posix_spec.rb +24 -22
- data/spec/unit/provider/file/windows_spec.rb +17 -15
- data/spec/unit/provider/group/aix_spec.rb +2 -3
- data/spec/unit/provider/group/groupadd_spec.rb +26 -30
- 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 +53 -59
- data/spec/unit/provider/ldap_spec.rb +62 -61
- data/spec/unit/provider/nameservice/directoryservice_spec.rb +36 -35
- data/spec/unit/provider/nameservice_spec.rb +40 -38
- 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 +27 -44
- data/spec/unit/provider/package/aptitude_spec.rb +7 -6
- data/spec/unit/provider/package/aptrpm_spec.rb +12 -7
- data/spec/unit/provider/package/base_spec.rb +4 -4
- data/spec/unit/provider/package/dnf_spec.rb +20 -18
- data/spec/unit/provider/package/dpkg_spec.rb +53 -70
- data/spec/unit/provider/package/freebsd_spec.rb +11 -11
- data/spec/unit/provider/package/gem_spec.rb +55 -132
- data/spec/unit/provider/package/hpux_spec.rb +8 -8
- data/spec/unit/provider/package/macports_spec.rb +42 -46
- data/spec/unit/provider/package/nim_spec.rb +39 -30
- data/spec/unit/provider/package/openbsd_spec.rb +39 -36
- data/spec/unit/provider/package/opkg_spec.rb +26 -23
- data/spec/unit/provider/package/pacman_spec.rb +118 -97
- data/spec/unit/provider/package/pip3_spec.rb +0 -17
- data/spec/unit/provider/package/pip_spec.rb +106 -95
- data/spec/unit/provider/package/pkg_spec.rb +109 -109
- data/spec/unit/provider/package/pkgdmg_spec.rb +63 -65
- data/spec/unit/provider/package/pkgin_spec.rb +8 -10
- data/spec/unit/provider/package/pkgng_spec.rb +31 -22
- data/spec/unit/provider/package/pkgutil_spec.rb +49 -45
- data/spec/unit/provider/package/portage_spec.rb +74 -70
- data/spec/unit/provider/package/puppet_gem_spec.rb +13 -37
- data/spec/unit/provider/package/rpm_spec.rb +76 -154
- data/spec/unit/provider/package/sun_spec.rb +18 -16
- data/spec/unit/provider/package/tdnf_spec.rb +2 -2
- data/spec/unit/provider/package/up2date_spec.rb +4 -2
- data/spec/unit/provider/package/urpmi_spec.rb +17 -15
- data/spec/unit/provider/package/windows/exe_package_spec.rb +15 -12
- data/spec/unit/provider/package/windows/msi_package_spec.rb +22 -19
- data/spec/unit/provider/package/windows/package_spec.rb +42 -37
- data/spec/unit/provider/package/windows_spec.rb +32 -47
- 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 +45 -44
- data/spec/unit/provider/service/base_spec.rb +5 -4
- data/spec/unit/provider/service/bsd_spec.rb +29 -27
- 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 +55 -50
- data/spec/unit/provider/service/init_spec.rb +52 -53
- data/spec/unit/provider/service/launchd_spec.rb +116 -138
- data/spec/unit/provider/service/openbsd_spec.rb +50 -50
- data/spec/unit/provider/service/openrc_spec.rb +45 -43
- data/spec/unit/provider/service/openwrt_spec.rb +31 -26
- data/spec/unit/provider/service/rcng_spec.rb +14 -14
- data/spec/unit/provider/service/redhat_spec.rb +43 -45
- data/spec/unit/provider/service/runit_spec.rb +27 -29
- data/spec/unit/provider/service/smf_spec.rb +66 -74
- data/spec/unit/provider/service/src_spec.rb +47 -46
- data/spec/unit/provider/service/systemd_spec.rb +136 -109
- data/spec/unit/provider/service/upstart_spec.rb +93 -77
- data/spec/unit/provider/service/windows_spec.rb +41 -33
- data/spec/unit/provider/user/aix_spec.rb +31 -31
- data/spec/unit/provider/user/directoryservice_spec.rb +114 -146
- 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 +12 -10
- data/spec/unit/provider/user/pw_spec.rb +35 -37
- data/spec/unit/provider/user/user_role_add_spec.rb +93 -93
- data/spec/unit/provider/user/useradd_spec.rb +92 -93
- data/spec/unit/provider/user/windows_adsi_spec.rb +60 -59
- data/spec/unit/provider_spec.rb +35 -35
- data/spec/unit/puppet_pal_2pec.rb +5 -4
- data/spec/unit/puppet_pal_spec.rb +1 -0
- data/spec/unit/puppet_spec.rb +7 -6
- data/spec/unit/relationship_spec.rb +1 -0
- data/spec/unit/reports/http_spec.rb +23 -21
- data/spec/unit/reports/store_spec.rb +4 -3
- data/spec/unit/reports_spec.rb +14 -12
- data/spec/unit/resource/capability_finder_spec.rb +17 -15
- data/spec/unit/resource/catalog_spec.rb +68 -72
- data/spec/unit/resource/status_spec.rb +8 -6
- data/spec/unit/resource/type_collection_spec.rb +18 -17
- data/spec/unit/resource/type_spec.rb +35 -34
- data/spec/unit/resource_spec.rb +63 -36
- data/spec/unit/rest/client_spec.rb +135 -0
- data/spec/unit/rest/route_spec.rb +6 -6
- data/spec/unit/scheduler/job_spec.rb +1 -0
- data/spec/unit/scheduler/scheduler_spec.rb +1 -0
- data/spec/unit/scheduler/splay_job_spec.rb +2 -1
- 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 +1 -0
- data/spec/unit/settings/directory_setting_spec.rb +7 -2
- data/spec/unit/settings/duration_setting_spec.rb +2 -1
- data/spec/unit/settings/enum_setting_spec.rb +1 -1
- data/spec/unit/settings/environment_conf_spec.rb +6 -4
- data/spec/unit/settings/file_setting_spec.rb +46 -44
- data/spec/unit/settings/path_setting_spec.rb +2 -1
- data/spec/unit/settings/priority_setting_spec.rb +2 -1
- data/spec/unit/settings/string_setting_spec.rb +15 -14
- data/spec/unit/settings/terminus_setting_spec.rb +2 -1
- data/spec/unit/settings/value_translator_spec.rb +1 -0
- data/spec/unit/settings_spec.rb +224 -253
- data/spec/unit/ssl/base_spec.rb +15 -14
- data/spec/unit/ssl/certificate_request_spec.rb +58 -62
- data/spec/unit/ssl/certificate_spec.rb +25 -23
- data/spec/unit/ssl/digest_spec.rb +1 -0
- data/spec/unit/ssl/host_spec.rb +149 -166
- data/spec/unit/ssl/key_spec.rb +31 -30
- data/spec/unit/ssl/validator_spec.rb +39 -40
- data/spec/unit/task_spec.rb +45 -44
- data/spec/unit/transaction/additional_resource_generator_spec.rb +5 -3
- data/spec/unit/transaction/event_manager_spec.rb +88 -87
- data/spec/unit/transaction/event_spec.rb +15 -16
- data/spec/unit/transaction/persistence_spec.rb +17 -16
- data/spec/unit/transaction/report_spec.rb +12 -11
- data/spec/unit/transaction/resource_harness_spec.rb +31 -52
- data/spec/unit/transaction_spec.rb +87 -140
- data/spec/unit/type/component_spec.rb +1 -0
- data/spec/unit/type/exec_spec.rb +50 -101
- data/spec/unit/type/file/checksum_spec.rb +10 -9
- data/spec/unit/type/file/checksum_value_spec.rb +32 -31
- data/spec/unit/type/file/content_spec.rb +61 -58
- data/spec/unit/type/file/ctime_spec.rb +1 -0
- data/spec/unit/type/file/ensure_spec.rb +13 -12
- data/spec/unit/type/file/group_spec.rb +7 -5
- data/spec/unit/type/file/mode_spec.rb +6 -4
- data/spec/unit/type/file/mtime_spec.rb +1 -0
- data/spec/unit/type/file/owner_spec.rb +8 -6
- data/spec/unit/type/file/selinux_spec.rb +19 -17
- data/spec/unit/type/file/source_spec.rb +101 -104
- data/spec/unit/type/file/type_spec.rb +1 -0
- data/spec/unit/type/file_spec.rb +185 -195
- data/spec/unit/type/filebucket_spec.rb +10 -11
- data/spec/unit/type/group_spec.rb +8 -6
- data/spec/unit/type/noop_metaparam_spec.rb +2 -1
- data/spec/unit/type/package/package_settings_spec.rb +23 -44
- data/spec/unit/type/package_spec.rb +57 -56
- data/spec/unit/type/resources_spec.rb +74 -72
- data/spec/unit/type/schedule_spec.rb +26 -24
- data/spec/unit/type/service_spec.rb +75 -49
- data/spec/unit/type/stage_spec.rb +1 -0
- data/spec/unit/type/tidy_spec.rb +62 -61
- data/spec/unit/type/user_spec.rb +25 -24
- data/spec/unit/type/whit_spec.rb +1 -0
- data/spec/unit/type_spec.rb +54 -55
- data/spec/unit/util/at_fork_spec.rb +19 -18
- data/spec/unit/util/autoload_spec.rb +56 -55
- data/spec/unit/util/backups_spec.rb +35 -34
- data/spec/unit/util/character_encoding_spec.rb +5 -5
- data/spec/unit/util/checksums_spec.rb +39 -38
- data/spec/unit/util/colors_spec.rb +2 -1
- data/spec/unit/util/command_line_spec.rb +20 -40
- data/spec/unit/util/constant_inflector_spec.rb +1 -0
- data/spec/unit/util/diff_spec.rb +8 -7
- data/spec/unit/util/errors_spec.rb +1 -0
- data/spec/unit/util/execution_spec.rb +163 -187
- data/spec/unit/util/execution_stub_spec.rb +1 -0
- data/spec/unit/util/feature_spec.rb +14 -21
- 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 +31 -26
- data/spec/unit/util/json_lockfile_spec.rb +5 -3
- data/spec/unit/util/ldap/connection_spec.rb +25 -26
- data/spec/unit/util/ldap/generator_spec.rb +1 -0
- data/spec/unit/util/ldap/manager_spec.rb +101 -102
- data/spec/unit/util/lockfile_spec.rb +1 -0
- data/spec/unit/util/log/destinations_spec.rb +33 -30
- data/spec/unit/util/log_spec.rb +34 -48
- data/spec/unit/util/logging_spec.rb +72 -58
- data/spec/unit/util/metric_spec.rb +1 -0
- data/spec/unit/util/monkey_patches_spec.rb +9 -7
- data/spec/unit/util/multi_match_spec.rb +1 -0
- data/spec/unit/util/network_device/config_spec.rb +1 -0
- data/spec/unit/util/network_device/transport/base_spec.rb +6 -5
- data/spec/unit/util/network_device_spec.rb +9 -7
- data/spec/unit/util/package_spec.rb +1 -0
- data/spec/unit/util/pidlock_spec.rb +15 -60
- data/spec/unit/util/plist_spec.rb +33 -40
- data/spec/unit/util/posix_spec.rb +51 -54
- data/spec/unit/util/rdoc_spec.rb +10 -9
- data/spec/unit/util/reference_spec.rb +1 -0
- data/spec/unit/util/resource_template_spec.rb +20 -20
- data/spec/unit/util/retry_action_spec.rb +8 -7
- data/spec/unit/util/rubygems_spec.rb +8 -7
- data/spec/unit/util/run_mode_spec.rb +4 -3
- data/spec/unit/util/selinux_spec.rb +72 -79
- data/spec/unit/util/splayer_spec.rb +9 -8
- data/spec/unit/util/ssl_spec.rb +1 -0
- data/spec/unit/util/storage_spec.rb +23 -22
- data/spec/unit/util/suidmanager_spec.rb +54 -45
- data/spec/unit/util/symbolic_file_mode_spec.rb +1 -0
- data/spec/unit/util/tag_set_spec.rb +1 -0
- data/spec/unit/util/tagging_spec.rb +1 -0
- data/spec/unit/util/terminal_spec.rb +10 -9
- data/spec/unit/util/user_attr_spec.rb +2 -1
- data/spec/unit/util/warnings_spec.rb +4 -3
- data/spec/unit/util/watcher/periodic_watcher_spec.rb +2 -2
- data/spec/unit/util/watcher_spec.rb +21 -51
- data/spec/unit/util/windows/access_control_entry_spec.rb +1 -0
- data/spec/unit/util/windows/access_control_list_spec.rb +1 -0
- data/spec/unit/util/windows/adsi_spec.rb +138 -136
- data/spec/unit/util/windows/api_types_spec.rb +1 -0
- data/spec/unit/util/windows/eventlog_spec.rb +12 -9
- data/spec/unit/util/windows/file_spec.rb +1 -0
- data/spec/unit/util/windows/root_certs_spec.rb +1 -0
- data/spec/unit/util/windows/security_descriptor_spec.rb +2 -0
- data/spec/unit/util/windows/service_spec.rb +103 -100
- data/spec/unit/util/windows/sid_spec.rb +13 -11
- data/spec/unit/util/windows/string_spec.rb +1 -0
- data/spec/unit/util_spec.rb +57 -55
- data/spec/unit/version_spec.rb +6 -6
- metadata +20 -32
- data/CODEOWNERS +0 -30
- data/ext/autotest/Rakefile +0 -8
- data/ext/autotest/config +0 -43
- data/ext/autotest/readme.rst +0 -16
- data/lib/puppet/confine/boolean.rb +0 -45
- data/lib/puppet/provider/package_targetable.rb +0 -68
- data/spec/fixtures/unit/pops/loaders/loaders/mix_4x_and_3x_functions/usee/lib/puppet/parser/functions/bad_func_load2.rb +0 -11
- data/spec/fixtures/unit/pops/loaders/loaders/mix_4x_and_3x_functions/usee/lib/puppet/parser/functions/bad_func_load3.rb +0 -11
- data/spec/fixtures/unit/pops/loaders/loaders/mix_4x_and_3x_functions/usee/lib/puppet/parser/functions/bad_func_load4.rb +0 -11
- data/spec/fixtures/unit/pops/loaders/loaders/mix_4x_and_3x_functions/usee/lib/puppet/parser/functions/bad_func_load5.rb +0 -12
- data/spec/fixtures/unit/pops/loaders/loaders/mix_4x_and_3x_functions/usee/lib/puppet/parser/functions/good_func_load.rb +0 -9
- data/spec/fixtures/unit/provider/package/pkgng/pkg.info +0 -7
- data/spec/fixtures/unit/provider/package/pkgng/pkg.query_absent +0 -1
- data/spec/integration/network/http_pool_spec.rb +0 -120
- data/spec/integration/provider/file/windows_spec.rb +0 -162
- data/spec/lib/puppet_spec/https.rb +0 -166
- data/spec/unit/settings/server_list_setting_spec.rb +0 -21
- data/spec/watchr.rb +0 -137
@@ -1,3 +1,4 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
1
2
|
require 'spec_helper'
|
2
3
|
require 'puppet_spec/compiler'
|
3
4
|
|
@@ -8,7 +9,7 @@ describe 'Capability types' do
|
|
8
9
|
let(:loaders) { Puppet::Pops::Loaders.new(env) }
|
9
10
|
|
10
11
|
before(:each) do
|
11
|
-
|
12
|
+
Puppet::Parser::Compiler.any_instance.stubs(:loaders).returns(loaders)
|
12
13
|
Puppet.push_context({:loaders => loaders, :current_environment => env})
|
13
14
|
Puppet::Type.newtype :cap, :is_capability => true do
|
14
15
|
newparam :name
|
@@ -85,7 +86,7 @@ describe 'Capability types' do
|
|
85
86
|
parse_results << parser.parse
|
86
87
|
|
87
88
|
main = Puppet::Parser::AST::Hostclass.new('', :code => Puppet::Parser::ParserFactory.code_merger.concatenate(parse_results))
|
88
|
-
|
89
|
+
Puppet::Node::Environment.any_instance.stubs(:perform_initial_import).returns main
|
89
90
|
|
90
91
|
type = compile_to_catalog(nil).environment_instance.known_resource_types.definition(:test)
|
91
92
|
expect(type.produces).to be_instance_of(Array)
|
@@ -119,7 +120,7 @@ describe 'Capability types' do
|
|
119
120
|
parse_results << parser.parse
|
120
121
|
|
121
122
|
main = Puppet::Parser::AST::Hostclass.new('', :code => Puppet::Parser::ParserFactory.code_merger.concatenate(parse_results))
|
122
|
-
|
123
|
+
Puppet::Node::Environment.any_instance.stubs(:perform_initial_import).returns main
|
123
124
|
|
124
125
|
type = compile_to_catalog(nil).environment_instance.known_resource_types.definition('Mod::Test')
|
125
126
|
expect(type.produces).to be_instance_of(Array)
|
@@ -130,7 +131,6 @@ describe 'Capability types' do
|
|
130
131
|
expect(cns[:mappings]).to be_instance_of(Hash)
|
131
132
|
expect(cns[:mappings]['host']).to be_instance_of(Puppet::Parser::AST::PopsBridge::Expression)
|
132
133
|
end
|
133
|
-
|
134
134
|
it "does not allow operator '+>' in a mapping" do
|
135
135
|
expect do
|
136
136
|
compile_to_catalog(<<-MANIFEST, node)
|
@@ -256,12 +256,12 @@ test { one: hostname => "ahost", export => Cap[two] }
|
|
256
256
|
def mock_cap_finding
|
257
257
|
cap = Puppet::Resource.new("Cap", "two")
|
258
258
|
cap["host"] = "ahost"
|
259
|
-
|
259
|
+
Puppet::Resource::CapabilityFinder.expects(:find).returns(cap)
|
260
260
|
cap
|
261
261
|
end
|
262
262
|
|
263
263
|
it "does not fetch a consumed resource when consume metaparam not set" do
|
264
|
-
|
264
|
+
Puppet::Resource::CapabilityFinder.expects(:find).never
|
265
265
|
catalog = make_catalog("test { one: }")
|
266
266
|
expect(catalog.resource_keys.find { |type, _| type == "Cap" }).to be_nil
|
267
267
|
expect(catalog.resource("Test", "one")["hostname"]).to eq("nohost")
|
@@ -1,3 +1,4 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
1
2
|
require 'spec_helper'
|
2
3
|
require 'puppet/test_ca'
|
3
4
|
|
@@ -19,7 +20,7 @@ describe Puppet::CertificateFactory, :unless => RUBY_PLATFORM == 'java' do
|
|
19
20
|
it "should return a new X509 certificate" do
|
20
21
|
a = subject.build(:server, csr, issuer, serial)
|
21
22
|
b = subject.build(:server, csr, issuer, serial)
|
22
|
-
# The two instances are equal in every aspect except that they are
|
23
|
+
# The two instances are equal in every aspect except that they are
|
23
24
|
# different instances - they are `==`, but not hash `eql?`
|
24
25
|
expect(a).not_to eql(b)
|
25
26
|
end
|
@@ -62,7 +63,7 @@ describe Puppet::CertificateFactory, :unless => RUBY_PLATFORM == 'java' do
|
|
62
63
|
|
63
64
|
it "should respect a custom TTL for the CA" do
|
64
65
|
now = Time.now.utc
|
65
|
-
|
66
|
+
Time.expects(:now).at_least_once.returns(now)
|
66
67
|
cert = subject.build(:server, csr, issuer, serial, 12)
|
67
68
|
expect(cert.not_after.to_i).to eq(now.to_i + 12)
|
68
69
|
end
|
@@ -86,6 +87,7 @@ describe Puppet::CertificateFactory, :unless => RUBY_PLATFORM == 'java' do
|
|
86
87
|
)
|
87
88
|
end
|
88
89
|
|
90
|
+
|
89
91
|
it "should add an extension for the authorityKeyIdentifer" do
|
90
92
|
cert = subject.build(:server, csr, issuer, serial)
|
91
93
|
ef = OpenSSL::X509::ExtensionFactory.new(issuer, cert)
|
@@ -129,7 +131,7 @@ describe Puppet::CertificateFactory, :unless => RUBY_PLATFORM == 'java' do
|
|
129
131
|
csr = Puppet::SSL::CertificateRequest.new(name)
|
130
132
|
csr.generate(key)
|
131
133
|
|
132
|
-
|
134
|
+
csr.stubs(:request_extensions).returns([
|
133
135
|
{'oid' => '1.3.6.1.4.1.34380.1.2.1', 'value' => 'some-value'},
|
134
136
|
{'oid' => 'pp_uuid', 'value' => 'some-uuid'},
|
135
137
|
])
|
@@ -1,3 +1,4 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
1
2
|
require 'spec_helper'
|
2
3
|
|
3
4
|
require 'puppet/configurer/downloader'
|
@@ -89,14 +90,14 @@ describe Puppet::Configurer::Downloader do
|
|
89
90
|
end
|
90
91
|
|
91
92
|
it "should always set the owner to the current UID" do
|
92
|
-
|
93
|
+
Process.expects(:uid).returns 51
|
93
94
|
|
94
95
|
file = generate_file_resource(:path => '/path')
|
95
96
|
expect(file[:owner]).to eq(51)
|
96
97
|
end
|
97
98
|
|
98
99
|
it "should always set the group to the current GID" do
|
99
|
-
|
100
|
+
Process.expects(:gid).returns 61
|
100
101
|
|
101
102
|
file = generate_file_resource(:path => '/path')
|
102
103
|
expect(file[:group]).to eq(61)
|
@@ -160,7 +161,7 @@ describe Puppet::Configurer::Downloader do
|
|
160
161
|
end
|
161
162
|
|
162
163
|
it "should not issue a deprecation warning for source_permissions" do
|
163
|
-
|
164
|
+
Puppet.expects(:puppet_deprecation_warning).never
|
164
165
|
catalog = @dler.catalog
|
165
166
|
expect(catalog.resources.size).to eq(1) # Must consume catalog to fix warnings
|
166
167
|
end
|
@@ -183,37 +184,37 @@ describe Puppet::Configurer::Downloader do
|
|
183
184
|
end
|
184
185
|
|
185
186
|
it "should log that it is downloading" do
|
186
|
-
|
187
|
+
Puppet.expects(:info)
|
187
188
|
|
188
189
|
@dler.evaluate
|
189
190
|
end
|
190
191
|
|
191
192
|
it "should return all changed file paths" do
|
192
|
-
trans =
|
193
|
+
trans = mock 'transaction'
|
193
194
|
|
194
|
-
catalog =
|
195
|
-
|
196
|
-
|
195
|
+
catalog = mock 'catalog'
|
196
|
+
@dler.expects(:catalog).returns(catalog)
|
197
|
+
catalog.expects(:apply).yields(trans)
|
197
198
|
|
198
|
-
resource =
|
199
|
-
|
199
|
+
resource = mock 'resource'
|
200
|
+
resource.expects(:[]).with(:path).returns "/changed/file"
|
200
201
|
|
201
|
-
|
202
|
+
trans.expects(:changed?).returns([resource])
|
202
203
|
|
203
204
|
expect(@dler.evaluate).to eq(%w{/changed/file})
|
204
205
|
end
|
205
206
|
|
206
207
|
it "should yield the resources if a block is given" do
|
207
|
-
trans =
|
208
|
+
trans = mock 'transaction'
|
208
209
|
|
209
|
-
catalog =
|
210
|
-
|
211
|
-
|
210
|
+
catalog = mock 'catalog'
|
211
|
+
@dler.expects(:catalog).returns(catalog)
|
212
|
+
catalog.expects(:apply).yields(trans)
|
212
213
|
|
213
|
-
resource =
|
214
|
-
|
214
|
+
resource = mock 'resource'
|
215
|
+
resource.expects(:[]).with(:path).returns "/changed/file"
|
215
216
|
|
216
|
-
|
217
|
+
trans.expects(:changed?).returns([resource])
|
217
218
|
|
218
219
|
yielded = nil
|
219
220
|
@dler.evaluate { |r| yielded = r }
|
@@ -221,10 +222,10 @@ describe Puppet::Configurer::Downloader do
|
|
221
222
|
end
|
222
223
|
|
223
224
|
it "should catch and log exceptions" do
|
224
|
-
|
225
|
+
Puppet.expects(:log_exception)
|
225
226
|
# The downloader creates a new catalog for each apply, and really the only object
|
226
227
|
# that it is possible to stub for the purpose of generating a puppet error
|
227
|
-
|
228
|
+
Puppet::Resource::Catalog.any_instance.stubs(:apply).raises(Puppet::Error, "testing")
|
228
229
|
|
229
230
|
expect { @dler.evaluate }.not_to raise_error
|
230
231
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
1
2
|
require 'spec_helper'
|
2
3
|
require 'puppet/configurer'
|
3
4
|
require 'puppet/configurer/fact_handler'
|
@@ -57,13 +58,13 @@ describe Puppet::Configurer::FactHandler do
|
|
57
58
|
end
|
58
59
|
|
59
60
|
it "should fail if finding facts fails" do
|
60
|
-
|
61
|
+
Puppet::Node::Facts.indirection.expects(:find).raises RuntimeError
|
61
62
|
|
62
63
|
expect { facthandler.find_facts }.to raise_error(Puppet::Error, /Could not retrieve local facts/)
|
63
64
|
end
|
64
65
|
|
65
66
|
it "should only load fact plugins once" do
|
66
|
-
|
67
|
+
Puppet::Node::Facts.indirection.expects(:find).once
|
67
68
|
facthandler.find_facts
|
68
69
|
end
|
69
70
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
1
2
|
require 'spec_helper'
|
2
3
|
require 'puppet/configurer'
|
3
4
|
require 'puppet/configurer/plugin_handler'
|
@@ -10,35 +11,21 @@ describe Puppet::Configurer::PluginHandler do
|
|
10
11
|
before :each do
|
11
12
|
# PluginHandler#load_plugin has an extra-strong rescue clause
|
12
13
|
# this mock is to make sure that we don't silently ignore errors
|
13
|
-
|
14
|
+
Puppet.expects(:err).never
|
14
15
|
# Server_agent version needs to be at 5.3.4 in order to mount locales
|
15
16
|
Puppet.push_context({:server_agent_version => "5.3.4"})
|
16
17
|
end
|
17
18
|
|
18
19
|
it "downloads plugins, facts, and locales" do
|
19
|
-
|
20
|
-
allow_any_instance_of(Puppet::Configurer::Downloader).to receive(:evaluate) { times_called += 1 }.and_return([])
|
20
|
+
Puppet::Configurer::Downloader.any_instance.expects(:evaluate).times(3).returns([])
|
21
21
|
|
22
22
|
pluginhandler.download_plugins(environment)
|
23
|
-
expect(times_called).to eq(3)
|
24
23
|
end
|
25
24
|
|
26
25
|
it "returns downloaded plugin, fact, and locale filenames" do
|
27
|
-
|
28
|
-
allow_any_instance_of(Puppet::Configurer::Downloader).to receive(:evaluate) do
|
29
|
-
times_called += 1
|
30
|
-
|
31
|
-
if times_called == 1
|
32
|
-
%w[/a]
|
33
|
-
elsif times_called == 2
|
34
|
-
%w[/b]
|
35
|
-
else
|
36
|
-
%w[/c]
|
37
|
-
end
|
38
|
-
end
|
26
|
+
Puppet::Configurer::Downloader.any_instance.expects(:evaluate).times(3).returns(%w[/a]).then.returns(%w[/b]).then.returns(%w[/c])
|
39
27
|
|
40
28
|
expect(pluginhandler.download_plugins(environment)).to match_array(%w[/a /b /c])
|
41
|
-
expect(times_called).to eq(3)
|
42
29
|
end
|
43
30
|
end
|
44
31
|
|
@@ -46,25 +33,15 @@ describe Puppet::Configurer::PluginHandler do
|
|
46
33
|
before :each do
|
47
34
|
# PluginHandler#load_plugin has an extra-strong rescue clause
|
48
35
|
# this mock is to make sure that we don't silently ignore errors
|
49
|
-
|
36
|
+
Puppet.expects(:err).never
|
50
37
|
# Server_agent version needs to be at 5.3.4 in order to mount locales
|
51
38
|
Puppet.push_context({:server_agent_version => "5.3.3"})
|
52
39
|
end
|
53
40
|
|
54
41
|
it "returns downloaded plugin, fact, but not locale filenames" do
|
55
|
-
|
56
|
-
allow_any_instance_of(Puppet::Configurer::Downloader).to receive(:evaluate) do
|
57
|
-
times_called += 1
|
58
|
-
|
59
|
-
if times_called == 1
|
60
|
-
%w[/a]
|
61
|
-
else
|
62
|
-
%w[/b]
|
63
|
-
end
|
64
|
-
end
|
42
|
+
Puppet::Configurer::Downloader.any_instance.expects(:evaluate).times(2).returns(%w[/a]).then.returns(%w[/b])
|
65
43
|
|
66
44
|
expect(pluginhandler.download_plugins(environment)).to match_array(%w[/a /b])
|
67
|
-
expect(times_called).to eq(2)
|
68
45
|
end
|
69
46
|
end
|
70
47
|
|
@@ -72,26 +49,16 @@ describe Puppet::Configurer::PluginHandler do
|
|
72
49
|
before :each do
|
73
50
|
# PluginHandler#load_plugin has an extra-strong rescue clause
|
74
51
|
# this mock is to make sure that we don't silently ignore errors
|
75
|
-
|
52
|
+
Puppet.expects(:err).never
|
76
53
|
# Server_agent version needs to be at 5.3.4 in order to mount locales
|
77
54
|
# A blank version will default to 0.0
|
78
55
|
Puppet.push_context({:server_agent_version => ""})
|
79
56
|
end
|
80
57
|
|
81
58
|
it "returns downloaded plugin, fact, but not locale filenames" do
|
82
|
-
|
83
|
-
allow_any_instance_of(Puppet::Configurer::Downloader).to receive(:evaluate) do
|
84
|
-
times_called += 1
|
85
|
-
|
86
|
-
if times_called == 1
|
87
|
-
%w[/a]
|
88
|
-
else
|
89
|
-
%w[/b]
|
90
|
-
end
|
91
|
-
end
|
59
|
+
Puppet::Configurer::Downloader.any_instance.expects(:evaluate).times(2).returns(%w[/a]).then.returns(%w[/b])
|
92
60
|
|
93
61
|
expect(pluginhandler.download_plugins(environment)).to match_array(%w[/a /b])
|
94
|
-
expect(times_called).to eq(2)
|
95
62
|
end
|
96
63
|
end
|
97
64
|
end
|
@@ -1,12 +1,13 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
1
2
|
require 'spec_helper'
|
2
3
|
require 'puppet/configurer'
|
3
4
|
|
4
5
|
describe Puppet::Configurer do
|
5
6
|
before do
|
6
|
-
|
7
|
+
Puppet.settings.stubs(:use).returns(true)
|
7
8
|
@agent = Puppet::Configurer.new
|
8
|
-
|
9
|
-
|
9
|
+
@agent.stubs(:init_storage)
|
10
|
+
Puppet::Util::Storage.stubs(:store)
|
10
11
|
Puppet[:server] = "puppetmaster"
|
11
12
|
Puppet[:report] = true
|
12
13
|
end
|
@@ -18,21 +19,21 @@ describe Puppet::Configurer do
|
|
18
19
|
describe "when executing a pre-run hook" do
|
19
20
|
it "should do nothing if the hook is set to an empty string" do
|
20
21
|
Puppet.settings[:prerun_command] = ""
|
21
|
-
|
22
|
+
Puppet::Util.expects(:exec).never
|
22
23
|
|
23
24
|
@agent.execute_prerun_command
|
24
25
|
end
|
25
26
|
|
26
27
|
it "should execute any pre-run command provided via the 'prerun_command' setting" do
|
27
28
|
Puppet.settings[:prerun_command] = "/my/command"
|
28
|
-
|
29
|
+
Puppet::Util::Execution.expects(:execute).with(["/my/command"]).raises(Puppet::ExecutionFailure, "Failed")
|
29
30
|
|
30
31
|
@agent.execute_prerun_command
|
31
32
|
end
|
32
33
|
|
33
34
|
it "should fail if the command fails" do
|
34
35
|
Puppet.settings[:prerun_command] = "/my/command"
|
35
|
-
|
36
|
+
Puppet::Util::Execution.expects(:execute).with(["/my/command"]).raises(Puppet::ExecutionFailure, "Failed")
|
36
37
|
|
37
38
|
expect(@agent.execute_prerun_command).to be_falsey
|
38
39
|
end
|
@@ -41,21 +42,21 @@ describe Puppet::Configurer do
|
|
41
42
|
describe "when executing a post-run hook" do
|
42
43
|
it "should do nothing if the hook is set to an empty string" do
|
43
44
|
Puppet.settings[:postrun_command] = ""
|
44
|
-
|
45
|
+
Puppet::Util.expects(:exec).never
|
45
46
|
|
46
47
|
@agent.execute_postrun_command
|
47
48
|
end
|
48
49
|
|
49
50
|
it "should execute any post-run command provided via the 'postrun_command' setting" do
|
50
51
|
Puppet.settings[:postrun_command] = "/my/command"
|
51
|
-
|
52
|
+
Puppet::Util::Execution.expects(:execute).with(["/my/command"]).raises(Puppet::ExecutionFailure, "Failed")
|
52
53
|
|
53
54
|
@agent.execute_postrun_command
|
54
55
|
end
|
55
56
|
|
56
57
|
it "should fail if the command fails" do
|
57
58
|
Puppet.settings[:postrun_command] = "/my/command"
|
58
|
-
|
59
|
+
Puppet::Util::Execution.expects(:execute).with(["/my/command"]).raises(Puppet::ExecutionFailure, "Failed")
|
59
60
|
|
60
61
|
expect(@agent.execute_postrun_command).to be_falsey
|
61
62
|
end
|
@@ -63,20 +64,20 @@ describe Puppet::Configurer do
|
|
63
64
|
|
64
65
|
describe "when executing a catalog run" do
|
65
66
|
before do
|
66
|
-
|
67
|
-
|
67
|
+
Puppet.settings.stubs(:use).returns(true)
|
68
|
+
@agent.stubs(:download_plugins)
|
68
69
|
Puppet::Node::Facts.indirection.terminus_class = :memory
|
69
70
|
@facts = Puppet::Node::Facts.new(Puppet[:node_name_value])
|
70
71
|
Puppet::Node::Facts.indirection.save(@facts)
|
71
72
|
|
72
73
|
@catalog = Puppet::Resource::Catalog.new("tester", Puppet::Node::Environment.remote(Puppet[:environment].to_sym))
|
73
|
-
|
74
|
+
@catalog.stubs(:to_ral).returns(@catalog)
|
74
75
|
Puppet::Resource::Catalog.indirection.terminus_class = :rest
|
75
|
-
|
76
|
-
|
77
|
-
|
76
|
+
Puppet::Resource::Catalog.indirection.stubs(:find).returns(@catalog)
|
77
|
+
@agent.stubs(:send_report)
|
78
|
+
@agent.stubs(:save_last_run_summary)
|
78
79
|
|
79
|
-
|
80
|
+
Puppet::Util::Log.stubs(:close_all)
|
80
81
|
end
|
81
82
|
|
82
83
|
after :all do
|
@@ -85,39 +86,39 @@ describe Puppet::Configurer do
|
|
85
86
|
end
|
86
87
|
|
87
88
|
it "should initialize storage" do
|
88
|
-
|
89
|
+
Puppet::Util::Storage.expects(:load)
|
89
90
|
@agent.run
|
90
91
|
end
|
91
92
|
|
92
93
|
it "downloads plugins when told" do
|
93
|
-
|
94
|
+
@agent.expects(:download_plugins)
|
94
95
|
@agent.run(:pluginsync => true)
|
95
96
|
end
|
96
97
|
|
97
98
|
it "does not download plugins when told" do
|
98
|
-
|
99
|
+
@agent.expects(:download_plugins).never
|
99
100
|
@agent.run(:pluginsync => false)
|
100
101
|
end
|
101
102
|
|
102
103
|
it "should carry on when it can't fetch its node definition" do
|
103
104
|
error = Net::HTTPError.new(400, 'dummy server communication error')
|
104
|
-
|
105
|
+
Puppet::Node.indirection.expects(:find).raises(error)
|
105
106
|
expect(@agent.run).to eq(0)
|
106
107
|
end
|
107
108
|
|
108
109
|
it "applies a cached catalog when it can't connect to the master" do
|
109
110
|
error = Errno::ECONNREFUSED.new('Connection refused - connect(2)')
|
110
111
|
|
111
|
-
|
112
|
-
|
113
|
-
|
112
|
+
Puppet::Node.indirection.expects(:find).raises(error)
|
113
|
+
Puppet::Resource::Catalog.indirection.expects(:find).with(anything, has_entry(:ignore_cache => true)).raises(error)
|
114
|
+
Puppet::Resource::Catalog.indirection.expects(:find).with(anything, has_entry(:ignore_terminus => true)).returns(@catalog)
|
114
115
|
|
115
116
|
expect(@agent.run).to eq(0)
|
116
117
|
end
|
117
118
|
|
118
119
|
it "should initialize a transaction report if one is not provided" do
|
119
120
|
report = Puppet::Transaction::Report.new
|
120
|
-
|
121
|
+
Puppet::Transaction::Report.expects(:new).returns report
|
121
122
|
|
122
123
|
@agent.run
|
123
124
|
end
|
@@ -134,15 +135,15 @@ describe Puppet::Configurer do
|
|
134
135
|
|
135
136
|
it "should pass the new report to the catalog" do
|
136
137
|
report = Puppet::Transaction::Report.new
|
137
|
-
|
138
|
-
|
138
|
+
Puppet::Transaction::Report.stubs(:new).returns report
|
139
|
+
@catalog.expects(:apply).with{|options| options[:report] == report}
|
139
140
|
|
140
141
|
@agent.run
|
141
142
|
end
|
142
143
|
|
143
144
|
it "should use the provided report if it was passed one" do
|
144
145
|
report = Puppet::Transaction::Report.new
|
145
|
-
|
146
|
+
@catalog.expects(:apply).with {|options| options[:report] == report}
|
146
147
|
|
147
148
|
@agent.run(:report => report)
|
148
149
|
end
|
@@ -150,69 +151,69 @@ describe Puppet::Configurer do
|
|
150
151
|
it "should set the report as a log destination" do
|
151
152
|
report = Puppet::Transaction::Report.new
|
152
153
|
|
153
|
-
|
154
|
+
report.expects(:<<).with(instance_of(Puppet::Util::Log)).at_least_once
|
154
155
|
|
155
156
|
@agent.run(:report => report)
|
156
157
|
end
|
157
158
|
|
158
159
|
it "should retrieve the catalog" do
|
159
|
-
|
160
|
+
@agent.expects(:retrieve_catalog)
|
160
161
|
|
161
162
|
@agent.run
|
162
163
|
end
|
163
164
|
|
164
165
|
it "should log a failure and do nothing if no catalog can be retrieved" do
|
165
|
-
|
166
|
+
@agent.expects(:retrieve_catalog).returns nil
|
166
167
|
|
167
|
-
|
168
|
+
Puppet.expects(:err).with "Could not retrieve catalog; skipping run"
|
168
169
|
|
169
170
|
@agent.run
|
170
171
|
end
|
171
172
|
|
172
173
|
it "should apply the catalog with all options to :run" do
|
173
|
-
|
174
|
+
@agent.expects(:retrieve_catalog).returns @catalog
|
174
175
|
|
175
|
-
|
176
|
+
@catalog.expects(:apply).with { |args| args[:one] == true }
|
176
177
|
@agent.run :one => true
|
177
178
|
end
|
178
179
|
|
179
180
|
it "should accept a catalog and use it instead of retrieving a different one" do
|
180
|
-
|
181
|
+
@agent.expects(:retrieve_catalog).never
|
181
182
|
|
182
|
-
|
183
|
+
@catalog.expects(:apply)
|
183
184
|
@agent.run :one => true, :catalog => @catalog
|
184
185
|
end
|
185
186
|
|
186
187
|
it "should benchmark how long it takes to apply the catalog" do
|
187
|
-
|
188
|
+
@agent.expects(:benchmark).with(:notice, instance_of(String))
|
188
189
|
|
189
|
-
|
190
|
+
@agent.expects(:retrieve_catalog).returns @catalog
|
190
191
|
|
191
|
-
|
192
|
+
@catalog.expects(:apply).never # because we're not yielding
|
192
193
|
@agent.run
|
193
194
|
end
|
194
195
|
|
195
196
|
it "should execute post-run hooks after the run" do
|
196
|
-
|
197
|
+
@agent.expects(:execute_postrun_command)
|
197
198
|
|
198
199
|
@agent.run
|
199
200
|
end
|
200
201
|
|
201
202
|
it "should create report with passed transaction_uuid and job_id" do
|
202
203
|
@agent = Puppet::Configurer.new("test_tuuid", "test_jid")
|
203
|
-
|
204
|
+
@agent.stubs(:init_storage)
|
204
205
|
|
205
206
|
report = Puppet::Transaction::Report.new(nil, "test", "aaaa")
|
206
|
-
|
207
|
-
|
207
|
+
Puppet::Transaction::Report.expects(:new).with(anything, anything, 'test_tuuid', 'test_jid').returns(report)
|
208
|
+
@agent.expects(:send_report).with(report)
|
208
209
|
|
209
210
|
@agent.run
|
210
211
|
end
|
211
212
|
|
212
213
|
it "should send the report" do
|
213
214
|
report = Puppet::Transaction::Report.new(nil, "test", "aaaa")
|
214
|
-
|
215
|
-
|
215
|
+
Puppet::Transaction::Report.expects(:new).returns(report)
|
216
|
+
@agent.expects(:send_report).with(report)
|
216
217
|
|
217
218
|
expect(report.environment).to eq("test")
|
218
219
|
expect(report.transaction_uuid).to eq("aaaa")
|
@@ -221,11 +222,11 @@ describe Puppet::Configurer do
|
|
221
222
|
end
|
222
223
|
|
223
224
|
it "should send the transaction report even if the catalog could not be retrieved" do
|
224
|
-
|
225
|
+
@agent.expects(:retrieve_catalog).returns nil
|
225
226
|
|
226
227
|
report = Puppet::Transaction::Report.new(nil, "test", "aaaa")
|
227
|
-
|
228
|
-
|
228
|
+
Puppet::Transaction::Report.expects(:new).returns(report)
|
229
|
+
@agent.expects(:send_report).with(report)
|
229
230
|
|
230
231
|
expect(report.environment).to eq("test")
|
231
232
|
expect(report.transaction_uuid).to eq("aaaa")
|
@@ -234,11 +235,11 @@ describe Puppet::Configurer do
|
|
234
235
|
end
|
235
236
|
|
236
237
|
it "should send the transaction report even if there is a failure" do
|
237
|
-
|
238
|
+
@agent.expects(:retrieve_catalog).raises "whatever"
|
238
239
|
|
239
240
|
report = Puppet::Transaction::Report.new(nil, "test", "aaaa")
|
240
|
-
|
241
|
-
|
241
|
+
Puppet::Transaction::Report.expects(:new).returns(report)
|
242
|
+
@agent.expects(:send_report).with(report)
|
242
243
|
|
243
244
|
expect(report.environment).to eq("test")
|
244
245
|
expect(report.transaction_uuid).to eq("aaaa")
|
@@ -248,7 +249,7 @@ describe Puppet::Configurer do
|
|
248
249
|
|
249
250
|
it "should remove the report as a log destination when the run is finished" do
|
250
251
|
report = Puppet::Transaction::Report.new
|
251
|
-
|
252
|
+
Puppet::Transaction::Report.expects(:new).returns(report)
|
252
253
|
|
253
254
|
@agent.run
|
254
255
|
|
@@ -257,35 +258,35 @@ describe Puppet::Configurer do
|
|
257
258
|
|
258
259
|
it "should return the report exit_status as the result of the run" do
|
259
260
|
report = Puppet::Transaction::Report.new
|
260
|
-
|
261
|
-
|
261
|
+
Puppet::Transaction::Report.expects(:new).returns(report)
|
262
|
+
report.expects(:exit_status).returns(1234)
|
262
263
|
|
263
264
|
expect(@agent.run).to eq(1234)
|
264
265
|
end
|
265
266
|
|
266
267
|
it "should return nil if catalog application fails" do
|
267
|
-
|
268
|
+
@catalog.expects(:apply).raises(Puppet::Error, 'One or more resource dependency cycles detected in graph')
|
268
269
|
report = Puppet::Transaction::Report.new
|
269
270
|
expect(@agent.run(catalog: @catalog, report: report)).to be_nil
|
270
271
|
end
|
271
272
|
|
272
273
|
it "should send the transaction report even if the pre-run command fails" do
|
273
274
|
report = Puppet::Transaction::Report.new
|
274
|
-
|
275
|
+
Puppet::Transaction::Report.expects(:new).returns(report)
|
275
276
|
|
276
277
|
Puppet.settings[:prerun_command] = "/my/command"
|
277
|
-
|
278
|
-
|
278
|
+
Puppet::Util::Execution.expects(:execute).with(["/my/command"]).raises(Puppet::ExecutionFailure, "Failed")
|
279
|
+
@agent.expects(:send_report).with(report)
|
279
280
|
|
280
281
|
expect(@agent.run).to be_nil
|
281
282
|
end
|
282
283
|
|
283
284
|
it "should include the pre-run command failure in the report" do
|
284
285
|
report = Puppet::Transaction::Report.new
|
285
|
-
|
286
|
+
Puppet::Transaction::Report.expects(:new).returns(report)
|
286
287
|
|
287
288
|
Puppet.settings[:prerun_command] = "/my/command"
|
288
|
-
|
289
|
+
Puppet::Util::Execution.expects(:execute).with(["/my/command"]).raises(Puppet::ExecutionFailure, "Failed")
|
289
290
|
|
290
291
|
expect(@agent.run).to be_nil
|
291
292
|
expect(report.logs.find { |x| x.message =~ /Could not run command from prerun_command/ }).to be
|
@@ -293,23 +294,23 @@ describe Puppet::Configurer do
|
|
293
294
|
|
294
295
|
it "should send the transaction report even if the post-run command fails" do
|
295
296
|
report = Puppet::Transaction::Report.new
|
296
|
-
|
297
|
+
Puppet::Transaction::Report.expects(:new).returns(report)
|
297
298
|
|
298
299
|
Puppet.settings[:postrun_command] = "/my/command"
|
299
|
-
|
300
|
-
|
300
|
+
Puppet::Util::Execution.expects(:execute).with(["/my/command"]).raises(Puppet::ExecutionFailure, "Failed")
|
301
|
+
@agent.expects(:send_report).with(report)
|
301
302
|
|
302
303
|
expect(@agent.run).to be_nil
|
303
304
|
end
|
304
305
|
|
305
306
|
it "should include the post-run command failure in the report" do
|
306
307
|
report = Puppet::Transaction::Report.new
|
307
|
-
|
308
|
+
Puppet::Transaction::Report.expects(:new).returns(report)
|
308
309
|
|
309
310
|
Puppet.settings[:postrun_command] = "/my/command"
|
310
|
-
|
311
|
+
Puppet::Util::Execution.expects(:execute).with(["/my/command"]).raises(Puppet::ExecutionFailure, "Failed")
|
311
312
|
|
312
|
-
|
313
|
+
report.expects(:<<).with { |log| log.message.include?("Could not run command from postrun_command") }
|
313
314
|
|
314
315
|
expect(@agent.run).to be_nil
|
315
316
|
end
|
@@ -317,49 +318,49 @@ describe Puppet::Configurer do
|
|
317
318
|
it "should execute post-run command even if the pre-run command fails" do
|
318
319
|
Puppet.settings[:prerun_command] = "/my/precommand"
|
319
320
|
Puppet.settings[:postrun_command] = "/my/postcommand"
|
320
|
-
|
321
|
-
|
321
|
+
Puppet::Util::Execution.expects(:execute).with(["/my/precommand"]).raises(Puppet::ExecutionFailure, "Failed")
|
322
|
+
Puppet::Util::Execution.expects(:execute).with(["/my/postcommand"])
|
322
323
|
|
323
324
|
expect(@agent.run).to be_nil
|
324
325
|
end
|
325
326
|
|
326
327
|
it "should finalize the report" do
|
327
328
|
report = Puppet::Transaction::Report.new
|
328
|
-
|
329
|
+
Puppet::Transaction::Report.expects(:new).returns(report)
|
329
330
|
|
330
|
-
|
331
|
+
report.expects(:finalize_report)
|
331
332
|
@agent.run
|
332
333
|
end
|
333
334
|
|
334
335
|
it "should not apply the catalog if the pre-run command fails" do
|
335
336
|
report = Puppet::Transaction::Report.new
|
336
|
-
|
337
|
+
Puppet::Transaction::Report.expects(:new).returns(report)
|
337
338
|
|
338
339
|
Puppet.settings[:prerun_command] = "/my/command"
|
339
|
-
|
340
|
+
Puppet::Util::Execution.expects(:execute).with(["/my/command"]).raises(Puppet::ExecutionFailure, "Failed")
|
340
341
|
|
341
|
-
|
342
|
-
|
342
|
+
@catalog.expects(:apply).never()
|
343
|
+
@agent.expects(:send_report)
|
343
344
|
|
344
345
|
expect(@agent.run).to be_nil
|
345
346
|
end
|
346
347
|
|
347
348
|
it "should apply the catalog, send the report, and return nil if the post-run command fails" do
|
348
349
|
report = Puppet::Transaction::Report.new
|
349
|
-
|
350
|
+
Puppet::Transaction::Report.expects(:new).returns(report)
|
350
351
|
|
351
352
|
Puppet.settings[:postrun_command] = "/my/command"
|
352
|
-
|
353
|
+
Puppet::Util::Execution.expects(:execute).with(["/my/command"]).raises(Puppet::ExecutionFailure, "Failed")
|
353
354
|
|
354
|
-
|
355
|
-
|
355
|
+
@catalog.expects(:apply)
|
356
|
+
@agent.expects(:send_report)
|
356
357
|
|
357
358
|
expect(@agent.run).to be_nil
|
358
359
|
end
|
359
360
|
|
360
361
|
it 'includes total time metrics in the report after successfully applying the catalog' do
|
361
362
|
report = Puppet::Transaction::Report.new
|
362
|
-
|
363
|
+
@catalog.stubs(:apply).with() {|options| options[:report] == report }
|
363
364
|
@agent.run(report: report)
|
364
365
|
|
365
366
|
expect(report.metrics['time']).to be
|
@@ -368,7 +369,7 @@ describe Puppet::Configurer do
|
|
368
369
|
|
369
370
|
it 'includes total time metrics in the report even if prerun fails' do
|
370
371
|
Puppet.settings[:prerun_command] = "/my/command"
|
371
|
-
|
372
|
+
Puppet::Util::Execution.expects(:execute).with(["/my/command"]).raises(Puppet::ExecutionFailure, "Failed")
|
372
373
|
|
373
374
|
report = Puppet::Transaction::Report.new
|
374
375
|
@agent.run(report: report)
|
@@ -379,7 +380,7 @@ describe Puppet::Configurer do
|
|
379
380
|
|
380
381
|
it 'includes total time metrics in the report even if catalog retrieval fails' do
|
381
382
|
report = Puppet::Transaction::Report.new
|
382
|
-
|
383
|
+
@agent.stubs(:prepare_and_retrieve_catalog_from_cache).raises
|
383
384
|
@agent.run(:report => report)
|
384
385
|
|
385
386
|
expect(report.metrics['time']).to be
|
@@ -388,13 +389,13 @@ describe Puppet::Configurer do
|
|
388
389
|
|
389
390
|
it "should refetch the catalog if the server specifies a new environment in the catalog" do
|
390
391
|
catalog = Puppet::Resource::Catalog.new("tester", Puppet::Node::Environment.remote('second_env'))
|
391
|
-
|
392
|
+
@agent.expects(:retrieve_catalog).returns(catalog).twice
|
392
393
|
|
393
394
|
@agent.run
|
394
395
|
end
|
395
396
|
|
396
397
|
it "should change the environment setting if the server specifies a new environment in the catalog" do
|
397
|
-
|
398
|
+
@catalog.stubs(:environment).returns("second_env")
|
398
399
|
|
399
400
|
@agent.run
|
400
401
|
|
@@ -403,11 +404,11 @@ describe Puppet::Configurer do
|
|
403
404
|
|
404
405
|
it "should fix the report if the server specifies a new environment in the catalog" do
|
405
406
|
report = Puppet::Transaction::Report.new(nil, "test", "aaaa")
|
406
|
-
|
407
|
-
|
407
|
+
Puppet::Transaction::Report.expects(:new).returns(report)
|
408
|
+
@agent.expects(:send_report).with(report)
|
408
409
|
|
409
|
-
|
410
|
-
|
410
|
+
@catalog.stubs(:environment).returns("second_env")
|
411
|
+
@agent.stubs(:retrieve_catalog).returns(@catalog)
|
411
412
|
|
412
413
|
@agent.run
|
413
414
|
|
@@ -416,24 +417,24 @@ describe Puppet::Configurer do
|
|
416
417
|
|
417
418
|
it "sends the transaction uuid in a catalog request" do
|
418
419
|
@agent.instance_variable_set(:@transaction_uuid, 'aaa')
|
419
|
-
|
420
|
+
Puppet::Resource::Catalog.indirection.expects(:find).with(anything, has_entries(:transaction_uuid => 'aaa'))
|
420
421
|
@agent.run
|
421
422
|
end
|
422
423
|
|
423
424
|
it "sends the transaction uuid in a catalog request" do
|
424
425
|
@agent.instance_variable_set(:@job_id, 'aaa')
|
425
|
-
|
426
|
+
Puppet::Resource::Catalog.indirection.expects(:find).with(anything, has_entries(:job_id => 'aaa'))
|
426
427
|
@agent.run
|
427
428
|
end
|
428
429
|
|
429
430
|
it "sets the static_catalog query param to true in a catalog request" do
|
430
|
-
|
431
|
+
Puppet::Resource::Catalog.indirection.expects(:find).with(anything, has_entries(:static_catalog => true))
|
431
432
|
@agent.run
|
432
433
|
end
|
433
434
|
|
434
435
|
it "sets the checksum_type query param to the default supported_checksum_types in a catalog request" do
|
435
|
-
|
436
|
-
|
436
|
+
Puppet::Resource::Catalog.indirection.expects(:find).with(anything,
|
437
|
+
has_entries(:checksum_type => 'md5.sha256.sha384.sha512.sha224'))
|
437
438
|
@agent.run
|
438
439
|
end
|
439
440
|
|
@@ -441,22 +442,22 @@ describe Puppet::Configurer do
|
|
441
442
|
# Regenerate the agent to pick up the new setting
|
442
443
|
Puppet[:supported_checksum_types] = ['sha256']
|
443
444
|
@agent = Puppet::Configurer.new
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
445
|
+
@agent.stubs(:init_storage)
|
446
|
+
@agent.stubs(:download_plugins)
|
447
|
+
@agent.stubs(:send_report)
|
448
|
+
@agent.stubs(:save_last_run_summary)
|
448
449
|
|
449
|
-
|
450
|
+
Puppet::Resource::Catalog.indirection.expects(:find).with(anything, has_entries(:checksum_type => 'sha256'))
|
450
451
|
@agent.run
|
451
452
|
end
|
452
453
|
|
453
454
|
describe "when not using a REST terminus for catalogs" do
|
454
455
|
it "should not pass any facts when retrieving the catalog" do
|
455
456
|
Puppet::Resource::Catalog.indirection.terminus_class = :compiler
|
456
|
-
|
457
|
-
|
457
|
+
@agent.expects(:facts_for_uploading).never
|
458
|
+
Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options|
|
458
459
|
options[:facts].nil?
|
459
|
-
|
460
|
+
}.returns @catalog
|
460
461
|
|
461
462
|
@agent.run
|
462
463
|
end
|
@@ -470,9 +471,11 @@ describe Puppet::Configurer do
|
|
470
471
|
# call to "encode" - the encode in turn returns mocked data that is asserted as being
|
471
472
|
# presented to the catalog terminus as options.
|
472
473
|
#
|
473
|
-
|
474
|
-
|
475
|
-
|
474
|
+
@agent.expects(:find_facts).returns(12345)
|
475
|
+
@agent.expects(:encode_facts).with(12345).returns(:facts => "myfacts", :facts_format => :foo)
|
476
|
+
Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options|
|
477
|
+
options[:facts] == "myfacts" and options[:facts_format] == :foo
|
478
|
+
}.returns @catalog
|
476
479
|
|
477
480
|
@agent.run
|
478
481
|
end
|
@@ -481,7 +484,7 @@ describe Puppet::Configurer do
|
|
481
484
|
|
482
485
|
describe "when initialized with a transaction_uuid" do
|
483
486
|
it "stores it" do
|
484
|
-
|
487
|
+
SecureRandom.expects(:uuid).never
|
485
488
|
configurer = Puppet::Configurer.new('foo')
|
486
489
|
expect(configurer.instance_variable_get(:@transaction_uuid) == 'foo')
|
487
490
|
end
|
@@ -491,7 +494,7 @@ describe Puppet::Configurer do
|
|
491
494
|
include PuppetSpec::Files
|
492
495
|
|
493
496
|
before do
|
494
|
-
|
497
|
+
Puppet.settings.stubs(:use).returns(true)
|
495
498
|
@configurer = Puppet::Configurer.new
|
496
499
|
Puppet[:lastrunfile] = tmpfile('last_run_file')
|
497
500
|
|
@@ -502,53 +505,53 @@ describe Puppet::Configurer do
|
|
502
505
|
it "should print a report summary if configured to do so" do
|
503
506
|
Puppet.settings[:summarize] = true
|
504
507
|
|
505
|
-
|
508
|
+
@report.expects(:summary).returns "stuff"
|
506
509
|
|
507
|
-
|
510
|
+
@configurer.expects(:puts).with("stuff")
|
508
511
|
@configurer.send_report(@report)
|
509
512
|
end
|
510
513
|
|
511
514
|
it "should not print a report summary if not configured to do so" do
|
512
515
|
Puppet.settings[:summarize] = false
|
513
516
|
|
514
|
-
|
517
|
+
@configurer.expects(:puts).never
|
515
518
|
@configurer.send_report(@report)
|
516
519
|
end
|
517
520
|
|
518
521
|
it "should save the report if reporting is enabled" do
|
519
522
|
Puppet.settings[:report] = true
|
520
523
|
|
521
|
-
|
524
|
+
Puppet::Transaction::Report.indirection.expects(:save).with(@report, nil, instance_of(Hash))
|
522
525
|
@configurer.send_report(@report)
|
523
526
|
end
|
524
527
|
|
525
528
|
it "should not save the report if reporting is disabled" do
|
526
529
|
Puppet.settings[:report] = false
|
527
530
|
|
528
|
-
|
531
|
+
Puppet::Transaction::Report.indirection.expects(:save).with(@report, nil, instance_of(Hash)).never
|
529
532
|
@configurer.send_report(@report)
|
530
533
|
end
|
531
534
|
|
532
535
|
it "should save the last run summary if reporting is enabled" do
|
533
536
|
Puppet.settings[:report] = true
|
534
537
|
|
535
|
-
|
538
|
+
@configurer.expects(:save_last_run_summary).with(@report)
|
536
539
|
@configurer.send_report(@report)
|
537
540
|
end
|
538
541
|
|
539
542
|
it "should save the last run summary if reporting is disabled" do
|
540
543
|
Puppet.settings[:report] = false
|
541
544
|
|
542
|
-
|
545
|
+
@configurer.expects(:save_last_run_summary).with(@report)
|
543
546
|
@configurer.send_report(@report)
|
544
547
|
end
|
545
548
|
|
546
549
|
it "should log but not fail if saving the report fails" do
|
547
550
|
Puppet.settings[:report] = true
|
548
551
|
|
549
|
-
|
552
|
+
Puppet::Transaction::Report.indirection.expects(:save).raises("whatever")
|
550
553
|
|
551
|
-
|
554
|
+
Puppet.expects(:send_log).with(:err, 'Could not send report: whatever')
|
552
555
|
@configurer.send_report(@report)
|
553
556
|
end
|
554
557
|
end
|
@@ -557,10 +560,10 @@ describe Puppet::Configurer do
|
|
557
560
|
include PuppetSpec::Files
|
558
561
|
|
559
562
|
before do
|
560
|
-
|
563
|
+
Puppet.settings.stubs(:use).returns(true)
|
561
564
|
@configurer = Puppet::Configurer.new
|
562
565
|
|
563
|
-
@report =
|
566
|
+
@report = stub 'report', :raw_summary => {}
|
564
567
|
|
565
568
|
Puppet[:lastrunfile] = tmpfile('last_run_file')
|
566
569
|
end
|
@@ -571,7 +574,7 @@ describe Puppet::Configurer do
|
|
571
574
|
end
|
572
575
|
|
573
576
|
it "should write the raw summary as yaml" do
|
574
|
-
|
577
|
+
@report.expects(:raw_summary).returns("summary")
|
575
578
|
@configurer.save_last_run_summary(@report)
|
576
579
|
expect(File.read(Puppet[:lastrunfile])).to eq(YAML.dump("summary"))
|
577
580
|
end
|
@@ -585,14 +588,14 @@ describe Puppet::Configurer do
|
|
585
588
|
end
|
586
589
|
end.new
|
587
590
|
|
588
|
-
|
591
|
+
Puppet::Util.expects(:replace_file).yields(fh)
|
589
592
|
|
590
|
-
|
593
|
+
Puppet.expects(:send_log).with(:err, 'Could not save last run local report: failed to do print')
|
591
594
|
@configurer.save_last_run_summary(@report)
|
592
595
|
end
|
593
596
|
|
594
597
|
it "should create the last run file with the correct mode" do
|
595
|
-
|
598
|
+
Puppet.settings.setting(:lastrunfile).expects(:mode).returns('664')
|
596
599
|
@configurer.save_last_run_summary(@report)
|
597
600
|
|
598
601
|
if Puppet::Util::Platform.windows?
|
@@ -605,66 +608,66 @@ describe Puppet::Configurer do
|
|
605
608
|
end
|
606
609
|
|
607
610
|
it "should report invalid last run file permissions" do
|
608
|
-
|
609
|
-
|
611
|
+
Puppet.settings.setting(:lastrunfile).expects(:mode).returns('892')
|
612
|
+
Puppet.expects(:send_log).with(:err, regexp_matches(/Could not save last run local report.*892 is invalid/))
|
610
613
|
@configurer.save_last_run_summary(@report)
|
611
614
|
end
|
612
615
|
end
|
613
616
|
|
614
617
|
describe "when requesting a node" do
|
615
618
|
it "uses the transaction uuid in the request" do
|
616
|
-
|
619
|
+
Puppet::Node.indirection.expects(:find).with(anything, has_entries(:transaction_uuid => anything)).twice
|
617
620
|
@agent.run
|
618
621
|
end
|
619
622
|
|
620
623
|
it "sends an explicitly configured environment request" do
|
621
|
-
|
622
|
-
|
624
|
+
Puppet.settings.expects(:set_by_config?).with(:environment).returns(true)
|
625
|
+
Puppet::Node.indirection.expects(:find).with(anything, has_entries(:configured_environment => Puppet[:environment])).twice
|
623
626
|
@agent.run
|
624
627
|
end
|
625
628
|
|
626
629
|
it "does not send a configured_environment when using the default" do
|
627
|
-
|
630
|
+
Puppet::Node.indirection.expects(:find).with(anything, has_entries(:configured_environment => nil)).twice
|
628
631
|
@agent.run
|
629
632
|
end
|
630
633
|
end
|
631
634
|
|
632
635
|
def expects_new_catalog_only(catalog)
|
633
|
-
|
634
|
-
|
636
|
+
Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_cache] == true }.returns catalog
|
637
|
+
Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_terminus] == true }.never
|
635
638
|
end
|
636
639
|
|
637
640
|
def expects_cached_catalog_only(catalog)
|
638
|
-
|
639
|
-
|
641
|
+
Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_terminus] == true }.returns catalog
|
642
|
+
Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_cache] == true }.never
|
640
643
|
end
|
641
644
|
|
642
645
|
def expects_fallback_to_cached_catalog(catalog)
|
643
|
-
|
644
|
-
|
646
|
+
Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_cache] == true }.returns nil
|
647
|
+
Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_terminus] == true }.returns catalog
|
645
648
|
end
|
646
649
|
|
647
650
|
def expects_fallback_to_new_catalog(catalog)
|
648
|
-
|
649
|
-
|
651
|
+
Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_terminus] == true }.returns nil
|
652
|
+
Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_cache] == true }.returns catalog
|
650
653
|
end
|
651
654
|
|
652
655
|
def expects_neither_new_or_cached_catalog
|
653
|
-
|
654
|
-
|
656
|
+
Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_cache] == true }.returns nil
|
657
|
+
Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_terminus] == true }.returns nil
|
655
658
|
end
|
656
659
|
|
657
660
|
describe "when retrieving a catalog" do
|
658
661
|
before do
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
+
Puppet.settings.stubs(:use).returns(true)
|
663
|
+
@agent.stubs(:facts_for_uploading).returns({})
|
664
|
+
@agent.stubs(:download_plugins)
|
662
665
|
|
663
666
|
# retrieve a catalog in the current environment, so we don't try to converge unexpectedly
|
664
667
|
@catalog = Puppet::Resource::Catalog.new("tester", Puppet::Node::Environment.remote(Puppet[:environment].to_sym))
|
665
668
|
|
666
669
|
# this is the default when using a Configurer instance
|
667
|
-
|
670
|
+
Puppet::Resource::Catalog.indirection.stubs(:terminus_class).returns :rest
|
668
671
|
end
|
669
672
|
|
670
673
|
describe "and configured to only retrieve a catalog from the cache" do
|
@@ -679,17 +682,17 @@ describe Puppet::Configurer do
|
|
679
682
|
end
|
680
683
|
|
681
684
|
it "should not make a node request or pluginsync when a cached catalog is successfully retrieved" do
|
682
|
-
|
685
|
+
Puppet::Node.indirection.expects(:find).never
|
683
686
|
expects_cached_catalog_only(@catalog)
|
684
|
-
|
687
|
+
@agent.expects(:download_plugins).never
|
685
688
|
|
686
689
|
@agent.run
|
687
690
|
end
|
688
691
|
|
689
692
|
it "should make a node request and pluginsync when a cached catalog cannot be retrieved" do
|
690
|
-
|
693
|
+
Puppet::Node.indirection.expects(:find).returns nil
|
691
694
|
expects_fallback_to_new_catalog(@catalog)
|
692
|
-
|
695
|
+
@agent.expects(:download_plugins)
|
693
696
|
|
694
697
|
@agent.run
|
695
698
|
end
|
@@ -723,7 +726,7 @@ describe Puppet::Configurer do
|
|
723
726
|
end
|
724
727
|
|
725
728
|
it "should not attempt to retrieve a cached catalog again if the first attempt failed" do
|
726
|
-
|
729
|
+
Puppet::Node.indirection.expects(:find).returns(nil)
|
727
730
|
expects_neither_new_or_cached_catalog
|
728
731
|
|
729
732
|
@agent.run
|
@@ -733,23 +736,23 @@ describe Puppet::Configurer do
|
|
733
736
|
cached_catalog = Puppet::Resource::Catalog.new("tester", Puppet::Node::Environment.remote('second_env'))
|
734
737
|
expects_cached_catalog_only(cached_catalog)
|
735
738
|
|
736
|
-
|
739
|
+
Puppet.expects(:info).with("Using cached catalog from environment 'second_env'")
|
737
740
|
expect(@agent.retrieve_catalog({})).to eq(cached_catalog)
|
738
741
|
end
|
739
742
|
end
|
740
743
|
|
741
744
|
describe "and strict environment mode is set" do
|
742
745
|
before do
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
746
|
+
@catalog.stubs(:to_ral).returns(@catalog)
|
747
|
+
@catalog.stubs(:write_class_file)
|
748
|
+
@catalog.stubs(:write_resource_file)
|
749
|
+
@agent.stubs(:send_report)
|
750
|
+
@agent.stubs(:save_last_run_summary)
|
748
751
|
Puppet.settings[:strict_environment_mode] = true
|
749
752
|
end
|
750
753
|
|
751
754
|
it "should not make a node request" do
|
752
|
-
|
755
|
+
Puppet::Node.indirection.expects(:find).never
|
753
756
|
|
754
757
|
@agent.run
|
755
758
|
end
|
@@ -758,7 +761,7 @@ describe Puppet::Configurer do
|
|
758
761
|
@agent.instance_variable_set(:@environment, 'second_env')
|
759
762
|
expects_new_catalog_only(@catalog)
|
760
763
|
|
761
|
-
|
764
|
+
Puppet.expects(:err).with("Not using catalog because its environment 'production' does not match agent specified environment 'second_env' and strict_environment_mode is set")
|
762
765
|
expect(@agent.run).to be_nil
|
763
766
|
end
|
764
767
|
|
@@ -778,7 +781,7 @@ describe Puppet::Configurer do
|
|
778
781
|
@agent.instance_variable_set(:@environment, 'second_env')
|
779
782
|
expects_cached_catalog_only(@catalog)
|
780
783
|
|
781
|
-
|
784
|
+
Puppet.expects(:err).with("Not using catalog because its environment 'production' does not match agent specified environment 'second_env' and strict_environment_mode is set")
|
782
785
|
expect(@agent.run).to be_nil
|
783
786
|
end
|
784
787
|
|
@@ -793,28 +796,28 @@ describe Puppet::Configurer do
|
|
793
796
|
end
|
794
797
|
|
795
798
|
it "should use the Catalog class to get its catalog" do
|
796
|
-
|
799
|
+
Puppet::Resource::Catalog.indirection.expects(:find).returns @catalog
|
797
800
|
|
798
801
|
@agent.retrieve_catalog({})
|
799
802
|
end
|
800
803
|
|
801
804
|
it "should set its cached_catalog_status to 'not_used' when downloading a new catalog" do
|
802
|
-
|
805
|
+
Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_cache] == true }.returns @catalog
|
803
806
|
|
804
807
|
@agent.retrieve_catalog({})
|
805
808
|
expect(@agent.instance_variable_get(:@cached_catalog_status)).to eq('not_used')
|
806
809
|
end
|
807
810
|
|
808
811
|
it "should use its node_name_value to retrieve the catalog" do
|
809
|
-
|
812
|
+
Facter.stubs(:value).returns "eh"
|
810
813
|
Puppet.settings[:node_name_value] = "myhost.domain.com"
|
811
|
-
|
814
|
+
Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| name == "myhost.domain.com" }.returns @catalog
|
812
815
|
|
813
816
|
@agent.retrieve_catalog({})
|
814
817
|
end
|
815
818
|
|
816
819
|
it "should default to returning a catalog retrieved directly from the server, skipping the cache" do
|
817
|
-
|
820
|
+
Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_cache] == true }.returns @catalog
|
818
821
|
|
819
822
|
expect(@agent.retrieve_catalog({})).to eq(@catalog)
|
820
823
|
end
|
@@ -822,7 +825,7 @@ describe Puppet::Configurer do
|
|
822
825
|
it "should log and return the cached catalog when no catalog can be retrieved from the server" do
|
823
826
|
expects_fallback_to_cached_catalog(@catalog)
|
824
827
|
|
825
|
-
|
828
|
+
Puppet.expects(:info).with("Using cached catalog from environment 'production'")
|
826
829
|
expect(@agent.retrieve_catalog({})).to eq(@catalog)
|
827
830
|
end
|
828
831
|
|
@@ -840,15 +843,15 @@ describe Puppet::Configurer do
|
|
840
843
|
end
|
841
844
|
|
842
845
|
it "should return the cached catalog when retrieving the remote catalog throws an exception" do
|
843
|
-
|
844
|
-
|
846
|
+
Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_cache] == true }.raises "eh"
|
847
|
+
Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_terminus] == true }.returns @catalog
|
845
848
|
|
846
849
|
expect(@agent.retrieve_catalog({})).to eq(@catalog)
|
847
850
|
end
|
848
851
|
|
849
852
|
it "should set its cached_catalog_status to 'on_failure' when retrieving the remote catalog throws an exception" do
|
850
|
-
|
851
|
-
|
853
|
+
Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_cache] == true }.raises "eh"
|
854
|
+
Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_terminus] == true }.returns @catalog
|
852
855
|
|
853
856
|
@agent.retrieve_catalog({})
|
854
857
|
expect(@agent.instance_variable_get(:@cached_catalog_status)).to eq('on_failure')
|
@@ -856,16 +859,16 @@ describe Puppet::Configurer do
|
|
856
859
|
|
857
860
|
it "should log and return nil if no catalog can be retrieved from the server and :usecacheonfailure is disabled" do
|
858
861
|
Puppet[:usecacheonfailure] = false
|
859
|
-
|
862
|
+
Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_cache] == true }.returns nil
|
860
863
|
|
861
|
-
|
864
|
+
Puppet.expects(:warning).with('Not using cache on failed catalog')
|
862
865
|
|
863
866
|
expect(@agent.retrieve_catalog({})).to be_nil
|
864
867
|
end
|
865
868
|
|
866
869
|
it "should set its cached_catalog_status to 'not_used' if no catalog can be retrieved from the server and :usecacheonfailure is disabled or fails to retrieve a catalog" do
|
867
870
|
Puppet[:usecacheonfailure] = false
|
868
|
-
|
871
|
+
Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_cache] == true }.returns nil
|
869
872
|
|
870
873
|
@agent.retrieve_catalog({})
|
871
874
|
expect(@agent.instance_variable_get(:@cached_catalog_status)).to eq('not_used')
|
@@ -883,7 +886,7 @@ describe Puppet::Configurer do
|
|
883
886
|
|
884
887
|
expects_fallback_to_cached_catalog(cached_catalog)
|
885
888
|
|
886
|
-
|
889
|
+
Puppet.expects(:err).with("Not using cached catalog because its environment 'second_env' does not match 'production'")
|
887
890
|
expect(@agent.retrieve_catalog({})).to be_nil
|
888
891
|
end
|
889
892
|
|
@@ -918,14 +921,14 @@ describe Puppet::Configurer do
|
|
918
921
|
|
919
922
|
it "should not update the cached catalog in noop mode" do
|
920
923
|
Puppet[:noop] = true
|
921
|
-
|
924
|
+
Puppet::Resource::Catalog.indirection.expects(:find).with(anything, has_entries(:ignore_cache => true, :ignore_cache_save => true)).returns(@catalog)
|
922
925
|
|
923
926
|
@agent.retrieve_catalog({})
|
924
927
|
end
|
925
928
|
|
926
929
|
it "should update the cached catalog when not in noop mode" do
|
927
930
|
Puppet[:noop] = false
|
928
|
-
|
931
|
+
Puppet::Resource::Catalog.indirection.expects(:find).with(anything, has_entries(:ignore_cache => true, :ignore_cache_save => false)).returns(@catalog)
|
929
932
|
|
930
933
|
@agent.retrieve_catalog({})
|
931
934
|
end
|
@@ -933,9 +936,9 @@ describe Puppet::Configurer do
|
|
933
936
|
|
934
937
|
describe "when converting the catalog" do
|
935
938
|
before do
|
936
|
-
|
939
|
+
Puppet.settings.stubs(:use).returns(true)
|
937
940
|
|
938
|
-
|
941
|
+
catalog.stubs(:to_ral).returns ral_catalog
|
939
942
|
end
|
940
943
|
|
941
944
|
let (:catalog) { Puppet::Resource::Catalog.new('tester', Puppet::Node::Environment.remote(Puppet[:environment].to_sym)) }
|
@@ -946,25 +949,25 @@ describe Puppet::Configurer do
|
|
946
949
|
end
|
947
950
|
|
948
951
|
it "should finalize the catalog" do
|
949
|
-
|
952
|
+
ral_catalog.expects(:finalize)
|
950
953
|
|
951
954
|
@agent.convert_catalog(catalog, 10)
|
952
955
|
end
|
953
956
|
|
954
957
|
it "should record the passed retrieval time with the RAL catalog" do
|
955
|
-
|
958
|
+
ral_catalog.expects(:retrieval_duration=).with 10
|
956
959
|
|
957
960
|
@agent.convert_catalog(catalog, 10)
|
958
961
|
end
|
959
962
|
|
960
963
|
it "should write the RAL catalog's class file" do
|
961
|
-
|
964
|
+
ral_catalog.expects(:write_class_file)
|
962
965
|
|
963
966
|
@agent.convert_catalog(catalog, 10)
|
964
967
|
end
|
965
968
|
|
966
969
|
it "should write the RAL catalog's resource file" do
|
967
|
-
|
970
|
+
ral_catalog.expects(:write_resource_file)
|
968
971
|
|
969
972
|
@agent.convert_catalog(catalog, 10)
|
970
973
|
end
|
@@ -972,7 +975,7 @@ describe Puppet::Configurer do
|
|
972
975
|
it "should set catalog conversion time on the report" do
|
973
976
|
report = Puppet::Transaction::Report.new
|
974
977
|
|
975
|
-
|
978
|
+
report.expects(:add_times).with(:convert_catalog, kind_of(Numeric))
|
976
979
|
@agent.convert_catalog(catalog, 10, {:report => report})
|
977
980
|
end
|
978
981
|
end
|
@@ -994,22 +997,22 @@ describe Puppet::Configurer do
|
|
994
997
|
describe "when attempting failover" do
|
995
998
|
it "should not failover if server_list is not set" do
|
996
999
|
Puppet.settings[:server_list] = []
|
997
|
-
|
1000
|
+
@agent.expects(:find_functional_server).never
|
998
1001
|
@agent.run
|
999
1002
|
end
|
1000
1003
|
|
1001
1004
|
it "should not failover during an apply run" do
|
1002
1005
|
Puppet.settings[:server_list] = ["myserver:123"]
|
1003
|
-
|
1006
|
+
@agent.expects(:find_functional_server).never
|
1004
1007
|
catalog = Puppet::Resource::Catalog.new("tester", Puppet::Node::Environment.remote(Puppet[:environment].to_sym))
|
1005
1008
|
@agent.run :catalog => catalog
|
1006
1009
|
end
|
1007
1010
|
|
1008
|
-
it "should select a server when
|
1011
|
+
it "should select a server when provided" do
|
1009
1012
|
Puppet.settings[:server_list] = ["myserver:123"]
|
1010
1013
|
response = Net::HTTPOK.new(nil, 200, 'OK')
|
1011
|
-
|
1012
|
-
|
1014
|
+
Puppet::Network::HttpPool.stubs(:http_ssl_instance).with('myserver', '123').returns(mock('request', get: response))
|
1015
|
+
@agent.stubs(:run_internal)
|
1013
1016
|
|
1014
1017
|
options = {}
|
1015
1018
|
@agent.run(options)
|
@@ -1019,10 +1022,10 @@ describe Puppet::Configurer do
|
|
1019
1022
|
it "queries the simple status for the 'master' service" do
|
1020
1023
|
Puppet.settings[:server_list] = ["myserver:123"]
|
1021
1024
|
response = Net::HTTPOK.new(nil, 200, 'OK')
|
1022
|
-
http =
|
1023
|
-
|
1024
|
-
|
1025
|
-
|
1025
|
+
http = mock('request')
|
1026
|
+
http.expects(:get).with('/status/v1/simple/master').returns(response)
|
1027
|
+
Puppet::Network::HttpPool.stubs(:http_ssl_instance).with('myserver', '123').returns(http)
|
1028
|
+
@agent.stubs(:run_internal)
|
1026
1029
|
|
1027
1030
|
@agent.run
|
1028
1031
|
end
|
@@ -1030,27 +1033,28 @@ describe Puppet::Configurer do
|
|
1030
1033
|
it "should report when a server is unavailable" do
|
1031
1034
|
Puppet.settings[:server_list] = ["myserver:123"]
|
1032
1035
|
response = Net::HTTPInternalServerError.new(nil, 500, 'Internal Server Error')
|
1033
|
-
|
1036
|
+
Puppet::Network::HttpPool.stubs(:http_ssl_instance).with('myserver', '123').returns(mock('request', get: response))
|
1037
|
+
@agent.stubs(:run_internal)
|
1034
1038
|
|
1035
|
-
|
1036
|
-
|
1039
|
+
Puppet.expects(:debug).with("Puppet server myserver:123 is unavailable: 500 Internal Server Error")
|
1040
|
+
@agent.run
|
1037
1041
|
end
|
1038
1042
|
|
1039
|
-
it "should
|
1043
|
+
it "should fallback to an empty server when failover fails" do
|
1040
1044
|
Puppet.settings[:server_list] = ["myserver:123"]
|
1041
1045
|
error = Net::HTTPError.new(400, 'dummy server communication error')
|
1042
|
-
|
1046
|
+
Puppet::Network::HttpPool.stubs(:http_ssl_instance).with('myserver', '123').returns(error)
|
1047
|
+
@agent.stubs(:run_internal)
|
1043
1048
|
|
1044
1049
|
options = {}
|
1045
|
-
|
1050
|
+
@agent.run(options)
|
1046
1051
|
expect(options[:report].master_used).to be_nil
|
1047
1052
|
end
|
1048
1053
|
|
1049
1054
|
it "should not make multiple node requets when the server is found" do
|
1050
1055
|
Puppet.settings[:server_list] = ["myserver:123"]
|
1051
|
-
|
1052
|
-
|
1053
|
-
allow(@agent).to receive(:run_internal)
|
1056
|
+
Puppet::Network::HttpPool.expects(:http_ssl_instance).once
|
1057
|
+
@agent.stubs(:run_internal)
|
1054
1058
|
|
1055
1059
|
@agent.run
|
1056
1060
|
end
|