chef 12.13.37-universal-mingw32 → 12.14.60-universal-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +48 -95
- data/Gemfile +6 -1
- data/README.md +9 -11
- data/VERSION +1 -1
- data/acceptance/.shared/kitchen_acceptance/.kitchen.ec2.yml +0 -1
- data/acceptance/Gemfile +4 -7
- data/acceptance/Gemfile.lock +59 -92
- data/acceptance/basics/test/integration/helpers/serverspec/Gemfile +8 -0
- data/acceptance/data-collector/test/integration/helpers/serverspec/Gemfile +8 -0
- data/acceptance/fips/test/integration/fips-integration/serverspec/Gemfile +6 -0
- data/acceptance/fips/test/integration/fips-unit-functional/serverspec/Gemfile +4 -0
- data/chef.gemspec +3 -2
- data/lib/chef/application/client.rb +4 -4
- data/lib/chef/application/solo.rb +2 -2
- data/lib/chef/chef_fs/command_line.rb +36 -34
- data/lib/chef/chef_fs/data_handler/data_handler_base.rb +2 -2
- data/lib/chef/chef_fs/file_pattern.rb +1 -1
- data/lib/chef/chef_fs/file_system.rb +139 -137
- data/lib/chef/chef_fs/parallelizer/parallel_enumerable.rb +2 -6
- data/lib/chef/cookbook/cookbook_version_loader.rb +27 -22
- data/lib/chef/cookbook/metadata.rb +1 -1
- data/lib/chef/cookbook/synchronizer.rb +3 -3
- data/lib/chef/cookbook_site_streaming_uploader.rb +3 -3
- data/lib/chef/cookbook_uploader.rb +1 -1
- data/lib/chef/cookbook_version.rb +6 -6
- data/lib/chef/dsl/powershell.rb +1 -1
- data/lib/chef/event_dispatch/base.rb +2 -2
- data/lib/chef/exceptions.rb +1 -1
- data/lib/chef/file_cache.rb +1 -1
- data/lib/chef/formatters/base.rb +2 -2
- data/lib/chef/formatters/doc.rb +2 -2
- data/lib/chef/http.rb +48 -18
- data/lib/chef/http/auth_credentials.rb +1 -1
- data/lib/chef/http/basic_client.rb +11 -2
- data/lib/chef/http/socketless_chef_zero_client.rb +2 -2
- data/lib/chef/key.rb +55 -56
- data/lib/chef/knife.rb +70 -61
- data/lib/chef/knife/client_delete.rb +2 -2
- data/lib/chef/knife/cookbook_bulk_delete.rb +1 -1
- data/lib/chef/knife/cookbook_show.rb +1 -1
- data/lib/chef/knife/core/gem_glob_loader.rb +3 -3
- data/lib/chef/knife/search.rb +2 -2
- data/lib/chef/knife/ssh.rb +19 -21
- data/lib/chef/knife/status.rb +2 -2
- data/lib/chef/mixin/command/unix.rb +2 -2
- data/lib/chef/mixin/powershell_type_coercions.rb +1 -1
- data/lib/chef/mixin/properties.rb +3 -0
- data/lib/chef/mixin/securable.rb +2 -2
- data/lib/chef/mixin/shell_out.rb +30 -0
- data/lib/chef/mixin/uris.rb +2 -1
- data/lib/chef/mixin/windows_architecture_helper.rb +3 -4
- data/lib/chef/monkey_patches/webrick-utils.rb +2 -2
- data/lib/chef/monologger.rb +1 -1
- data/lib/chef/node.rb +2 -2
- data/lib/chef/node/attribute.rb +3 -3
- data/lib/chef/platform/provider_mapping.rb +5 -2
- data/lib/chef/property.rb +14 -3
- data/lib/chef/provider/apt_repository.rb +3 -7
- data/lib/chef/provider/apt_update.rb +4 -6
- data/lib/chef/provider/cron.rb +1 -2
- data/lib/chef/provider/dsc_script.rb +4 -4
- data/lib/chef/provider/group/usermod.rb +1 -1
- data/lib/chef/provider/link.rb +10 -3
- data/lib/chef/provider/osx_profile.rb +10 -10
- data/lib/chef/provider/package.rb +2 -12
- data/lib/chef/provider/package/rubygems.rb +17 -16
- data/lib/chef/provider/package/windows.rb +2 -0
- data/lib/chef/provider/package/windows/exe.rb +1 -1
- data/lib/chef/provider/package/windows/registry_uninstall_entry.rb +0 -2
- data/lib/chef/provider/package/yum/rpm_utils.rb +8 -8
- data/lib/chef/provider/package/yum/yum_cache.rb +1 -1
- data/lib/chef/provider/remote_file/ftp.rb +2 -2
- data/lib/chef/provider/remote_file/sftp.rb +2 -2
- data/lib/chef/provider/service/debian.rb +2 -2
- data/lib/chef/provider/service/simple.rb +4 -3
- data/lib/chef/provider/service/solaris.rb +1 -1
- data/lib/chef/provider/service/systemd.rb +2 -2
- data/lib/chef/provider/service/upstart.rb +8 -5
- data/lib/chef/provider/support/yum_repo.erb +125 -0
- data/lib/chef/provider/systemd_unit.rb +11 -2
- data/lib/chef/provider/template_finder.rb +1 -1
- data/lib/chef/provider/user.rb +20 -16
- data/lib/chef/provider/user/aix.rb +5 -2
- data/lib/chef/provider/user/dscl.rb +1 -0
- data/lib/chef/provider/user/linux.rb +128 -0
- data/lib/chef/provider/user/pw.rb +2 -1
- data/lib/chef/provider/user/solaris.rb +3 -2
- data/lib/chef/provider/user/useradd.rb +5 -4
- data/lib/chef/provider/user/windows.rb +1 -1
- data/lib/chef/provider/windows_script.rb +5 -2
- data/lib/chef/provider/yum_repository.rb +121 -0
- data/lib/chef/providers.rb +4 -2
- data/lib/chef/resource.rb +7 -9
- data/lib/chef/resource/conditional.rb +9 -1
- data/lib/chef/resource/launchd.rb +1 -1
- data/lib/chef/resource/user.rb +3 -3
- data/lib/chef/resource/user/aix_user.rb +31 -0
- data/lib/chef/resource/user/dscl_user.rb +31 -0
- data/lib/chef/resource/user/linux_user.rb +51 -0
- data/lib/chef/resource/user/pw_user.rb +31 -0
- data/lib/chef/resource/user/solaris_user.rb +31 -0
- data/lib/chef/resource/user/windows_user.rb +31 -0
- data/lib/chef/resource/yum_package.rb +13 -12
- data/lib/chef/resource/yum_repository.rb +76 -0
- data/lib/chef/resource_builder.rb +1 -1
- data/lib/chef/resource_collection/stepable_iterator.rb +1 -3
- data/lib/chef/resource_reporter.rb +5 -5
- data/lib/chef/resources.rb +7 -0
- data/lib/chef/run_context.rb +5 -3
- data/lib/chef/run_context/cookbook_compiler.rb +3 -2
- data/lib/chef/run_list.rb +2 -2
- data/lib/chef/search/query.rb +11 -8
- data/lib/chef/shell/ext.rb +2 -2
- data/lib/chef/shell/shell_session.rb +1 -1
- data/lib/chef/util/dsc/configuration_generator.rb +1 -1
- data/lib/chef/util/powershell/cmdlet.rb +5 -2
- data/lib/chef/util/selinux.rb +1 -1
- data/lib/chef/version.rb +1 -1
- data/lib/chef/version_class.rb +2 -2
- data/lib/chef/version_constraint.rb +2 -2
- data/lib/chef/win32/api/error.rb +2 -2
- data/lib/chef/win32/api/net.rb +1 -1
- data/lib/chef/win32/eventlog.rb +1 -1
- data/lib/chef/win32/net.rb +1 -1
- data/lib/chef/win32/security/sid.rb +1 -1
- data/spec/functional/assets/testchefsubsys +2 -3
- data/spec/functional/event_loggers/windows_eventlog_spec.rb +11 -8
- data/spec/functional/file_content_management/deploy_strategies_spec.rb +1 -1
- data/spec/functional/http/simple_spec.rb +2 -2
- data/spec/functional/knife/cookbook_delete_spec.rb +5 -5
- data/spec/functional/knife/exec_spec.rb +6 -6
- data/spec/functional/knife/ssh_spec.rb +4 -4
- data/spec/functional/notifications_spec.rb +2 -2
- data/spec/functional/provider/whyrun_safe_ruby_block_spec.rb +2 -2
- data/spec/functional/rebooter_spec.rb +5 -5
- data/spec/functional/resource/bash_spec.rb +2 -2
- data/spec/functional/resource/deploy_revision_spec.rb +1 -1
- data/spec/functional/resource/dpkg_package_spec.rb +2 -2
- data/spec/functional/resource/dsc_resource_spec.rb +5 -5
- data/spec/functional/resource/dsc_script_spec.rb +27 -22
- data/spec/functional/resource/env_spec.rb +4 -4
- data/spec/functional/resource/execute_spec.rb +4 -4
- data/spec/functional/resource/group_spec.rb +20 -8
- data/spec/functional/resource/link_spec.rb +34 -0
- data/spec/functional/resource/ohai_spec.rb +6 -6
- data/spec/functional/resource/reboot_spec.rb +2 -2
- data/spec/functional/resource/remote_file_spec.rb +16 -7
- data/spec/functional/resource/user/dscl_spec.rb +3 -3
- data/spec/functional/resource/user/useradd_spec.rb +32 -26
- data/spec/functional/resource/windows_service_spec.rb +15 -15
- data/spec/functional/rest_spec.rb +2 -2
- data/spec/functional/run_lock_spec.rb +9 -9
- data/spec/functional/tiny_server_spec.rb +9 -8
- data/spec/functional/win32/crypto_spec.rb +1 -1
- data/spec/functional/win32/security_spec.rb +8 -8
- data/spec/integration/client/client_spec.rb +6 -4
- data/spec/integration/knife/chef_repo_path_spec.rb +70 -1
- data/spec/integration/knife/upload_spec.rb +1 -1
- data/spec/integration/recipes/lwrp_inline_resources_spec.rb +6 -6
- data/spec/integration/recipes/noop_resource_spec.rb +4 -4
- data/spec/integration/recipes/provider_choice.rb +3 -3
- data/spec/integration/recipes/recipe_dsl_spec.rb +318 -317
- data/spec/integration/recipes/resource_action_spec.rb +50 -54
- data/spec/integration/recipes/resource_converge_if_changed_spec.rb +34 -34
- data/spec/integration/recipes/resource_load_spec.rb +24 -24
- data/spec/integration/solo/solo_spec.rb +21 -30
- data/spec/scripts/ssl-serve.rb +1 -1
- data/spec/spec_helper.rb +1 -0
- data/spec/stress/win32/security_spec.rb +4 -4
- data/spec/support/chef_helpers.rb +22 -0
- data/spec/support/platform_helpers.rb +5 -1
- data/spec/support/shared/context/client.rb +3 -2
- data/spec/support/shared/functional/file_resource.rb +5 -4
- data/spec/support/shared/functional/http.rb +16 -16
- data/spec/support/shared/functional/securable_resource.rb +5 -5
- data/spec/support/shared/functional/win32_service.rb +5 -7
- data/spec/support/shared/integration/app_server_support.rb +1 -3
- data/spec/support/shared/integration/knife_support.rb +0 -2
- data/spec/support/shared/shared_examples.rb +2 -2
- data/spec/support/shared/unit/api_versioning.rb +2 -2
- data/spec/support/shared/unit/application_dot_d.rb +9 -6
- data/spec/support/shared/unit/provider/file.rb +2 -2
- data/spec/support/shared/unit/provider/useradd_based_user_provider.rb +49 -80
- data/spec/support/shared/unit/resource/static_provider_resolution.rb +2 -2
- data/spec/support/shared/unit/script_resource.rb +4 -4
- data/spec/support/shared/unit/user_and_client_shared.rb +4 -4
- data/spec/tiny_server.rb +51 -66
- data/spec/unit/api_client_v1_spec.rb +2 -2
- data/spec/unit/application_spec.rb +1 -1
- data/spec/unit/audit/audit_event_proxy_spec.rb +34 -27
- data/spec/unit/audit/audit_reporter_spec.rb +32 -23
- data/spec/unit/audit/control_group_data_spec.rb +19 -14
- data/spec/unit/chef_class_spec.rb +1 -1
- data/spec/unit/chef_fs/data_handler/group_handler_spec.rb +1 -1
- data/spec/unit/chef_fs/diff_spec.rb +4 -4
- data/spec/unit/chef_fs/file_system/operation_failed_error_spec.rb +4 -4
- data/spec/unit/chef_fs/file_system_spec.rb +2 -2
- data/spec/unit/chef_fs/parallelizer.rb +5 -7
- data/spec/unit/cookbook/metadata_spec.rb +98 -98
- data/spec/unit/cookbook/synchronizer_spec.rb +7 -0
- data/spec/unit/cookbook_loader_spec.rb +24 -24
- data/spec/unit/cookbook_version_file_specificity_spec.rb +8 -8
- data/spec/unit/daemon_spec.rb +1 -1
- data/spec/unit/data_bag_item_spec.rb +18 -18
- data/spec/unit/data_bag_spec.rb +2 -2
- data/spec/unit/data_collector/messages/helpers_spec.rb +9 -9
- data/spec/unit/data_collector/messages_spec.rb +2 -2
- data/spec/unit/data_collector_spec.rb +19 -19
- data/spec/unit/dsl/audit_spec.rb +3 -3
- data/spec/unit/dsl/data_query_spec.rb +3 -2
- data/spec/unit/dsl/declare_resource_spec.rb +10 -10
- data/spec/unit/encrypted_data_bag_item/check_encrypted_spec.rb +3 -2
- data/spec/unit/encrypted_data_bag_item_spec.rb +3 -2
- data/spec/unit/environment_spec.rb +6 -6
- data/spec/unit/event_dispatch/dispatcher_spec.rb +2 -2
- data/spec/unit/file_access_control_spec.rb +3 -3
- data/spec/unit/file_content_management/tempfile_spec.rb +2 -2
- data/spec/unit/formatters/error_inspectors/api_error_formatting_spec.rb +2 -2
- data/spec/unit/guard_interpreter/resource_guard_interpreter_spec.rb +2 -2
- data/spec/unit/http/basic_client_spec.rb +20 -0
- data/spec/unit/http/validate_content_length_spec.rb +8 -8
- data/spec/unit/http_spec.rb +14 -0
- data/spec/unit/knife/bootstrap/chef_vault_handler_spec.rb +2 -2
- data/spec/unit/knife/bootstrap/client_builder_spec.rb +2 -2
- data/spec/unit/knife/bootstrap_spec.rb +8 -6
- data/spec/unit/knife/client_bulk_delete_spec.rb +8 -8
- data/spec/unit/knife/client_edit_spec.rb +2 -2
- data/spec/unit/knife/configure_client_spec.rb +2 -2
- data/spec/unit/knife/cookbook_metadata_spec.rb +4 -4
- data/spec/unit/knife/cookbook_site_install_spec.rb +6 -5
- data/spec/unit/knife/cookbook_site_share_spec.rb +2 -2
- data/spec/unit/knife/core/hashed_command_loader_spec.rb +5 -4
- data/spec/unit/knife/core/node_editor_spec.rb +3 -3
- data/spec/unit/knife/core/ui_spec.rb +2 -2
- data/spec/unit/knife/data_bag_from_file_spec.rb +4 -3
- data/spec/unit/knife/data_bag_show_spec.rb +3 -2
- data/spec/unit/knife/key_create_spec.rb +14 -14
- data/spec/unit/knife/key_delete_spec.rb +2 -2
- data/spec/unit/knife/key_edit_spec.rb +16 -16
- data/spec/unit/knife/key_list_spec.rb +6 -6
- data/spec/unit/knife/key_show_spec.rb +4 -4
- data/spec/unit/knife/status_spec.rb +3 -2
- data/spec/unit/knife/user_create_spec.rb +4 -4
- data/spec/unit/knife_spec.rb +7 -6
- data/spec/unit/lwrp_spec.rb +6 -6
- data/spec/unit/mixin/api_version_request_handling_spec.rb +2 -2
- data/spec/unit/mixin/command_spec.rb +17 -14
- data/spec/unit/mixin/deprecation_spec.rb +1 -1
- data/spec/unit/mixin/homebrew_user_spec.rb +2 -2
- data/spec/unit/mixin/params_validate_spec.rb +53 -52
- data/spec/unit/mixin/powershell_out_spec.rb +2 -2
- data/spec/unit/mixin/powershell_type_coercions_spec.rb +2 -2
- data/spec/unit/mixin/shell_out_spec.rb +1 -1
- data/spec/unit/mixin/xml_escape_spec.rb +3 -3
- data/spec/unit/node_spec.rb +2 -2
- data/spec/unit/platform/query_helpers_spec.rb +3 -3
- data/spec/unit/property_spec.rb +4 -4
- data/spec/unit/provider/cookbook_file_spec.rb +4 -4
- data/spec/unit/provider/cron/unix_spec.rb +4 -4
- data/spec/unit/provider/cron_spec.rb +2 -2
- data/spec/unit/provider/deploy_spec.rb +8 -8
- data/spec/unit/provider/dsc_resource_spec.rb +11 -10
- data/spec/unit/provider/dsc_script_spec.rb +9 -9
- data/spec/unit/provider/env/windows_spec.rb +8 -8
- data/spec/unit/provider/file/content_spec.rb +6 -6
- data/spec/unit/provider/file_spec.rb +4 -4
- data/spec/unit/provider/launchd_spec.rb +2 -1
- data/spec/unit/provider/link_spec.rb +155 -0
- data/spec/unit/provider/mount/mount_spec.rb +5 -5
- data/spec/unit/provider/mount/solaris_spec.rb +48 -48
- data/spec/unit/provider/osx_profile_spec.rb +6 -0
- data/spec/unit/provider/package/chocolatey_spec.rb +4 -4
- data/spec/unit/provider/package/freebsd/port_spec.rb +4 -4
- data/spec/unit/provider/package/rubygems_spec.rb +50 -44
- data/spec/unit/provider/package/windows/exe_spec.rb +9 -0
- data/spec/unit/provider/package/yum_spec.rb +61 -60
- data/spec/unit/provider/package_spec.rb +2 -2
- data/spec/unit/provider/powershell_script_spec.rb +4 -4
- data/spec/unit/provider/remote_directory_spec.rb +1 -1
- data/spec/unit/provider/remote_file/ftp_spec.rb +4 -4
- data/spec/unit/provider/remote_file/local_file_spec.rb +4 -2
- data/spec/unit/provider/remote_file/sftp_spec.rb +4 -4
- data/spec/unit/provider/remote_file_spec.rb +4 -4
- data/spec/unit/provider/script_spec.rb +4 -4
- data/spec/unit/provider/service/debian_service_spec.rb +4 -4
- data/spec/unit/provider/service/freebsd_service_spec.rb +12 -8
- data/spec/unit/provider/service/openbsd_service_spec.rb +12 -8
- data/spec/unit/provider/service/systemd_service_spec.rb +4 -4
- data/spec/unit/provider/service/upstart_service_spec.rb +27 -12
- data/spec/unit/provider/service/windows_spec.rb +10 -10
- data/spec/unit/provider/systemd_unit_spec.rb +2 -2
- data/spec/unit/provider/template/content_spec.rb +8 -8
- data/spec/unit/provider/template_spec.rb +8 -8
- data/spec/unit/provider/user/dscl_spec.rb +51 -51
- data/spec/unit/provider/user/linux_spec.rb +76 -0
- data/spec/unit/provider/user/pw_spec.rb +3 -6
- data/spec/unit/provider/user/solaris_spec.rb +5 -5
- data/spec/unit/provider/user/windows_spec.rb +3 -3
- data/spec/unit/provider/user_spec.rb +2 -2
- data/spec/unit/provider/yum_repository_spec.rb +35 -0
- data/spec/unit/provider_resolver_spec.rb +306 -264
- data/spec/unit/recipe_spec.rb +8 -7
- data/spec/unit/resource/apt_repository_spec.rb +4 -4
- data/spec/unit/resource/apt_update_spec.rb +4 -4
- data/spec/unit/resource/conditional_spec.rb +46 -0
- data/spec/unit/resource/dsc_resource_spec.rb +8 -8
- data/spec/unit/resource/dsc_script_spec.rb +4 -4
- data/spec/unit/resource/freebsd_package_spec.rb +6 -6
- data/spec/unit/resource/launchd_spec.rb +3 -2
- data/spec/unit/resource/osx_profile_spec.rb +3 -2
- data/spec/unit/resource/remote_file_spec.rb +6 -6
- data/spec/unit/resource/service_spec.rb +14 -14
- data/spec/unit/resource/user_spec.rb +1 -1
- data/spec/unit/resource/yum_repository_spec.rb +49 -0
- data/spec/unit/resource_collection_spec.rb +4 -4
- data/spec/unit/resource_definition_spec.rb +11 -11
- data/spec/unit/resource_reporter_spec.rb +4 -4
- data/spec/unit/resource_resolver_spec.rb +6 -6
- data/spec/unit/resource_spec.rb +36 -16
- data/spec/unit/run_context/child_run_context_spec.rb +4 -4
- data/spec/unit/run_context/cookbook_compiler_spec.rb +43 -1
- data/spec/unit/run_context_spec.rb +8 -8
- data/spec/unit/run_list/run_list_expansion_spec.rb +2 -2
- data/spec/unit/runner_spec.rb +2 -2
- data/spec/unit/search/query_spec.rb +15 -14
- data/spec/unit/user_v1_spec.rb +8 -8
- data/spec/unit/util/dsc/configuration_generator_spec.rb +12 -12
- data/spec/unit/util/dsc/local_configuration_manager_spec.rb +12 -9
- data/spec/unit/util/dsc/resource_store.rb +8 -6
- data/spec/unit/util/editor_spec.rb +6 -6
- data/spec/unit/util/powershell/cmdlet_spec.rb +10 -10
- data/tasks/bin/bundle-platform +1 -0
- data/tasks/bin/bundler_patch.rb +27 -0
- data/tasks/cbgb.rb +2 -2
- data/tasks/maintainers.rb +2 -2
- metadata +37 -8
- data/spec/unit/provider/user/useradd_spec.rb +0 -51
data/spec/unit/recipe_spec.rb
CHANGED
@@ -75,15 +75,15 @@ describe Chef::Recipe do
|
|
75
75
|
end
|
76
76
|
|
77
77
|
it "should require a name argument" do
|
78
|
-
expect
|
78
|
+
expect do
|
79
79
|
recipe.cat
|
80
|
-
|
80
|
+
end.to raise_error(ArgumentError)
|
81
81
|
end
|
82
82
|
|
83
83
|
it "should allow regular errors (not NameErrors) to pass unchanged" do
|
84
|
-
expect
|
84
|
+
expect do
|
85
85
|
recipe.cat("felix") { raise ArgumentError, "You Suck" }
|
86
|
-
|
86
|
+
end.to raise_error(ArgumentError)
|
87
87
|
end
|
88
88
|
|
89
89
|
it "should add our zen_master to the collection" do
|
@@ -288,9 +288,10 @@ describe Chef::Recipe do
|
|
288
288
|
end
|
289
289
|
|
290
290
|
it "validating resources via build_resource" do
|
291
|
-
expect
|
292
|
-
|
293
|
-
|
291
|
+
expect do
|
292
|
+
recipe.build_resource(:remote_file, "klopp") do
|
293
|
+
source Chef::DelayedEvaluator.new { "http://chef.io" }
|
294
|
+
end end.to_not raise_error
|
294
295
|
end
|
295
296
|
|
296
297
|
end
|
@@ -38,13 +38,13 @@ describe Chef::Resource::AptRepository do
|
|
38
38
|
expect(resource.distribution).to eql(nil)
|
39
39
|
end
|
40
40
|
|
41
|
-
it "should resolve to a Noop class when
|
42
|
-
expect(Chef::Provider::AptRepository).to receive(:
|
41
|
+
it "should resolve to a Noop class when apt-get is not found" do
|
42
|
+
expect(Chef::Provider::AptRepository).to receive(:which).with("apt-get").and_return(false)
|
43
43
|
expect(resource.provider_for_action(:add)).to be_a(Chef::Provider::Noop)
|
44
44
|
end
|
45
45
|
|
46
|
-
it "should resolve to a AptRepository class when
|
47
|
-
expect(Chef::Provider::AptRepository).to receive(:
|
46
|
+
it "should resolve to a AptRepository class when apt-get is found" do
|
47
|
+
expect(Chef::Provider::AptRepository).to receive(:which).with("apt-get").and_return(true)
|
48
48
|
expect(resource.provider_for_action(:add)).to be_a(Chef::Provider::AptRepository)
|
49
49
|
end
|
50
50
|
end
|
@@ -38,13 +38,13 @@ describe Chef::Resource::AptUpdate do
|
|
38
38
|
expect(resource.frequency).to eql(400)
|
39
39
|
end
|
40
40
|
|
41
|
-
it "should resolve to a Noop class when
|
42
|
-
expect(Chef::Provider::AptUpdate).to receive(:
|
41
|
+
it "should resolve to a Noop class when apt-get is not found" do
|
42
|
+
expect(Chef::Provider::AptUpdate).to receive(:which).with("apt-get").and_return(false)
|
43
43
|
expect(resource.provider_for_action(:add)).to be_a(Chef::Provider::Noop)
|
44
44
|
end
|
45
45
|
|
46
|
-
it "should resolve to a AptUpdate class when
|
47
|
-
expect(Chef::Provider::AptUpdate).to receive(:
|
46
|
+
it "should resolve to a AptUpdate class when apt-get is found" do
|
47
|
+
expect(Chef::Provider::AptUpdate).to receive(:which).with("apt-get").and_return(true)
|
48
48
|
expect(resource.provider_for_action(:add)).to be_a(Chef::Provider::AptUpdate)
|
49
49
|
end
|
50
50
|
end
|
@@ -124,6 +124,29 @@ describe Chef::Resource::Conditional do
|
|
124
124
|
expect(@conditional.continue?).to be_falsey
|
125
125
|
end
|
126
126
|
end
|
127
|
+
|
128
|
+
describe "after running a block that returns a string value" do
|
129
|
+
before do
|
130
|
+
@conditional = Chef::Resource::Conditional.only_if(@parent_resource) { "some command" }
|
131
|
+
end
|
132
|
+
|
133
|
+
it "logs a warning" do
|
134
|
+
expect(Chef::Log).to receive(:warn).with("only_if block for [] returned \"some command\", did you mean to run a command? If so use 'only_if \"some command\"' in your code.")
|
135
|
+
@conditional.evaluate
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
describe "after running a block that returns a string value on a sensitive resource" do
|
140
|
+
before do
|
141
|
+
@parent_resource.sensitive(true)
|
142
|
+
@conditional = Chef::Resource::Conditional.only_if(@parent_resource) { "some command" }
|
143
|
+
end
|
144
|
+
|
145
|
+
it "logs a warning" do
|
146
|
+
expect(Chef::Log).to receive(:warn).with("only_if block for [] returned a string, did you mean to run a command?")
|
147
|
+
@conditional.evaluate
|
148
|
+
end
|
149
|
+
end
|
127
150
|
end
|
128
151
|
|
129
152
|
describe "when created as a `not_if`" do
|
@@ -204,5 +227,28 @@ describe Chef::Resource::Conditional do
|
|
204
227
|
expect(@conditional.continue?).to be_truthy
|
205
228
|
end
|
206
229
|
end
|
230
|
+
|
231
|
+
describe "after running a block that returns a string value" do
|
232
|
+
before do
|
233
|
+
@conditional = Chef::Resource::Conditional.not_if(@parent_resource) { "some command" }
|
234
|
+
end
|
235
|
+
|
236
|
+
it "logs a warning" do
|
237
|
+
expect(Chef::Log).to receive(:warn).with("not_if block for [] returned \"some command\", did you mean to run a command? If so use 'not_if \"some command\"' in your code.")
|
238
|
+
@conditional.evaluate
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
242
|
+
describe "after running a block that returns a string value on a sensitive resource" do
|
243
|
+
before do
|
244
|
+
@parent_resource.sensitive(true)
|
245
|
+
@conditional = Chef::Resource::Conditional.not_if(@parent_resource) { "some command" }
|
246
|
+
end
|
247
|
+
|
248
|
+
it "logs a warning" do
|
249
|
+
expect(Chef::Log).to receive(:warn).with("not_if block for [] returned a string, did you mean to run a command?")
|
250
|
+
@conditional.evaluate
|
251
|
+
end
|
252
|
+
end
|
207
253
|
end
|
208
254
|
end
|
@@ -24,16 +24,16 @@ describe Chef::Resource::DscResource do
|
|
24
24
|
let(:dsc_test_timeout) { 101 }
|
25
25
|
|
26
26
|
context "when Powershell supports Dsc" do
|
27
|
-
let(:dsc_test_run_context)
|
27
|
+
let(:dsc_test_run_context) do
|
28
28
|
node = Chef::Node.new
|
29
29
|
node.automatic[:languages][:powershell][:version] = "5.0.10018.0"
|
30
30
|
empty_events = Chef::EventDispatch::Dispatcher.new
|
31
31
|
Chef::RunContext.new(node, {}, empty_events)
|
32
|
-
|
32
|
+
end
|
33
33
|
|
34
|
-
let(:dsc_test_resource)
|
34
|
+
let(:dsc_test_resource) do
|
35
35
|
Chef::Resource::DscResource.new(dsc_test_resource_name, dsc_test_run_context)
|
36
|
-
|
36
|
+
end
|
37
37
|
|
38
38
|
it "has a default action of `:run`" do
|
39
39
|
expect(dsc_test_resource.action).to eq([:run])
|
@@ -71,16 +71,16 @@ describe Chef::Resource::DscResource do
|
|
71
71
|
end
|
72
72
|
|
73
73
|
it "raises a TypeError if property_name is not a symbol" do
|
74
|
-
expect
|
74
|
+
expect do
|
75
75
|
dsc_test_resource.property("Foo", dsc_test_property_value)
|
76
|
-
|
76
|
+
end.to raise_error(TypeError)
|
77
77
|
end
|
78
78
|
|
79
79
|
context "when using DelayedEvaluators" do
|
80
80
|
it "allows setting a dsc property with a property name of type Symbol" do
|
81
|
-
dsc_test_resource.property(dsc_test_property_name, Chef::DelayedEvaluator.new
|
81
|
+
dsc_test_resource.property(dsc_test_property_name, Chef::DelayedEvaluator.new do
|
82
82
|
dsc_test_property_value
|
83
|
-
|
83
|
+
end)
|
84
84
|
expect(dsc_test_resource.property(dsc_test_property_name)).to eq(dsc_test_property_value)
|
85
85
|
expect(dsc_test_resource.properties[dsc_test_property_name]).to eq(dsc_test_property_value)
|
86
86
|
end
|
@@ -22,15 +22,15 @@ describe Chef::Resource::DscScript do
|
|
22
22
|
let(:dsc_test_resource_name) { "DSCTest" }
|
23
23
|
|
24
24
|
context "when Powershell supports Dsc" do
|
25
|
-
let(:dsc_test_run_context)
|
25
|
+
let(:dsc_test_run_context) do
|
26
26
|
node = Chef::Node.new
|
27
27
|
node.automatic[:languages][:powershell][:version] = "4.0"
|
28
28
|
empty_events = Chef::EventDispatch::Dispatcher.new
|
29
29
|
Chef::RunContext.new(node, {}, empty_events)
|
30
|
-
|
31
|
-
let(:dsc_test_resource)
|
30
|
+
end
|
31
|
+
let(:dsc_test_resource) do
|
32
32
|
Chef::Resource::DscScript.new(dsc_test_resource_name, dsc_test_run_context)
|
33
|
-
|
33
|
+
end
|
34
34
|
let(:configuration_code) { 'echo "This is supposed to create a configuration document."' }
|
35
35
|
let(:configuration_path) { "c:/myconfigs/formatc.ps1" }
|
36
36
|
let(:configuration_name) { "formatme" }
|
@@ -52,10 +52,10 @@ describe Chef::Resource::FreebsdPackage do
|
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
|
-
describe "if
|
55
|
+
describe "if freebsd_version is greater than or equal to 1000017" do
|
56
56
|
it "should be Freebsd::Pkgng" do
|
57
|
-
[1000017, 1000018, 1000500, 1001001, 1100000].each do |
|
58
|
-
@node.automatic_attrs[:os_version] =
|
57
|
+
[1000017, 1000018, 1000500, 1001001, 1100000].each do |freebsd_version|
|
58
|
+
@node.automatic_attrs[:os_version] = freebsd_version
|
59
59
|
@resource.after_created
|
60
60
|
expect(@resource.provider).to eq(Chef::Provider::Package::Freebsd::Pkgng)
|
61
61
|
end
|
@@ -71,13 +71,13 @@ describe Chef::Resource::FreebsdPackage do
|
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
74
|
-
describe "if
|
74
|
+
describe "if freebsd_version is less than 1000017 and pkgng not enabled" do
|
75
75
|
it "should be Freebsd::Pkg" do
|
76
76
|
pkg_enabled = OpenStruct.new(:stdout => "\n")
|
77
77
|
allow(@resource).to receive(:shell_out!).with("make -V WITH_PKGNG", :env => nil).and_return(pkg_enabled)
|
78
78
|
|
79
|
-
[1000016, 1000000, 901503, 902506, 802511].each do |
|
80
|
-
@node.automatic_attrs[:os_version] =
|
79
|
+
[1000016, 1000000, 901503, 902506, 802511].each do |freebsd_version|
|
80
|
+
@node.automatic_attrs[:os_version] = freebsd_version
|
81
81
|
@resource.after_created
|
82
82
|
expect(@resource.provider).to eq(Chef::Provider::Package::Freebsd::Pkg)
|
83
83
|
end
|
@@ -4,10 +4,11 @@ require "spec_helper"
|
|
4
4
|
|
5
5
|
describe Chef::Resource::Launchd do
|
6
6
|
@launchd = Chef::Resource::Launchd.new("io.chef.chef-client")
|
7
|
-
let(:resource)
|
7
|
+
let(:resource) do
|
8
|
+
Chef::Resource::Launchd.new(
|
8
9
|
"io.chef.chef-client",
|
9
10
|
run_context
|
10
|
-
)
|
11
|
+
) end
|
11
12
|
|
12
13
|
it "should create a new Chef::Resource::Launchd" do
|
13
14
|
expect(resource).to be_a_kind_of(Chef::Resource)
|
@@ -19,10 +19,11 @@
|
|
19
19
|
require "spec_helper"
|
20
20
|
|
21
21
|
describe Chef::Resource::OsxProfile do
|
22
|
-
let(:resource)
|
22
|
+
let(:resource) do
|
23
|
+
Chef::Resource::OsxProfile.new(
|
23
24
|
"Test Profile Resource",
|
24
25
|
run_context)
|
25
|
-
|
26
|
+
end
|
26
27
|
|
27
28
|
it "should create a new Chef::Resource::OsxProfile" do
|
28
29
|
expect(resource).to be_a_kind_of(Chef::Resource)
|
@@ -86,15 +86,15 @@ describe Chef::Resource::RemoteFile do
|
|
86
86
|
end
|
87
87
|
|
88
88
|
it "should only accept a single argument if a delayed evalutor is used" do
|
89
|
-
expect
|
89
|
+
expect do
|
90
90
|
@resource.source("http://opscode.com/", Chef::DelayedEvaluator.new { "http://opscode.com/" })
|
91
|
-
|
91
|
+
end.to raise_error(Chef::Exceptions::InvalidRemoteFileURI)
|
92
92
|
end
|
93
93
|
|
94
94
|
it "should only accept a single array item if a delayed evalutor is used" do
|
95
|
-
expect
|
95
|
+
expect do
|
96
96
|
@resource.source(["http://opscode.com/", Chef::DelayedEvaluator.new { "http://opscode.com/" }])
|
97
|
-
|
97
|
+
end.to raise_error(Chef::Exceptions::InvalidRemoteFileURI)
|
98
98
|
end
|
99
99
|
|
100
100
|
it "does not accept a non-URI as the source" do
|
@@ -102,10 +102,10 @@ describe Chef::Resource::RemoteFile do
|
|
102
102
|
end
|
103
103
|
|
104
104
|
it "does not accept a non-URI as the source when read from a delayed evaluator" do
|
105
|
-
expect
|
105
|
+
expect do
|
106
106
|
@resource.source(Chef::DelayedEvaluator.new { "not-a-uri" })
|
107
107
|
@resource.source
|
108
|
-
|
108
|
+
end.to raise_error(Chef::Exceptions::InvalidRemoteFileURI)
|
109
109
|
end
|
110
110
|
|
111
111
|
it "should raise an exception when source is an empty array" do
|
@@ -53,9 +53,9 @@ describe Chef::Resource::Service do
|
|
53
53
|
end
|
54
54
|
|
55
55
|
it "should not accept a regexp for the service pattern" do
|
56
|
-
expect
|
56
|
+
expect do
|
57
57
|
@resource.pattern /.*/
|
58
|
-
|
58
|
+
end.to raise_error(ArgumentError)
|
59
59
|
end
|
60
60
|
|
61
61
|
it "should accept a string for the service start command" do
|
@@ -64,9 +64,9 @@ describe Chef::Resource::Service do
|
|
64
64
|
end
|
65
65
|
|
66
66
|
it "should not accept a regexp for the service start command" do
|
67
|
-
expect
|
67
|
+
expect do
|
68
68
|
@resource.start_command /.*/
|
69
|
-
|
69
|
+
end.to raise_error(ArgumentError)
|
70
70
|
end
|
71
71
|
|
72
72
|
it "should accept a string for the service stop command" do
|
@@ -75,9 +75,9 @@ describe Chef::Resource::Service do
|
|
75
75
|
end
|
76
76
|
|
77
77
|
it "should not accept a regexp for the service stop command" do
|
78
|
-
expect
|
78
|
+
expect do
|
79
79
|
@resource.stop_command /.*/
|
80
|
-
|
80
|
+
end.to raise_error(ArgumentError)
|
81
81
|
end
|
82
82
|
|
83
83
|
it "should accept a string for the service status command" do
|
@@ -86,9 +86,9 @@ describe Chef::Resource::Service do
|
|
86
86
|
end
|
87
87
|
|
88
88
|
it "should not accept a regexp for the service status command" do
|
89
|
-
expect
|
89
|
+
expect do
|
90
90
|
@resource.status_command /.*/
|
91
|
-
|
91
|
+
end.to raise_error(ArgumentError)
|
92
92
|
end
|
93
93
|
|
94
94
|
it "should accept a string for the service restart command" do
|
@@ -97,9 +97,9 @@ describe Chef::Resource::Service do
|
|
97
97
|
end
|
98
98
|
|
99
99
|
it "should not accept a regexp for the service restart command" do
|
100
|
-
expect
|
100
|
+
expect do
|
101
101
|
@resource.restart_command /.*/
|
102
|
-
|
102
|
+
end.to raise_error(ArgumentError)
|
103
103
|
end
|
104
104
|
|
105
105
|
it "should accept a string for the service reload command" do
|
@@ -108,9 +108,9 @@ describe Chef::Resource::Service do
|
|
108
108
|
end
|
109
109
|
|
110
110
|
it "should not accept a regexp for the service reload command" do
|
111
|
-
expect
|
111
|
+
expect do
|
112
112
|
@resource.reload_command /.*/
|
113
|
-
|
113
|
+
end.to raise_error(ArgumentError)
|
114
114
|
end
|
115
115
|
|
116
116
|
it "should accept a string for the service init command" do
|
@@ -119,9 +119,9 @@ describe Chef::Resource::Service do
|
|
119
119
|
end
|
120
120
|
|
121
121
|
it "should not accept a regexp for the service init command" do
|
122
|
-
expect
|
122
|
+
expect do
|
123
123
|
@resource.init_command /.*/
|
124
|
-
|
124
|
+
end.to raise_error(ArgumentError)
|
125
125
|
end
|
126
126
|
|
127
127
|
%w{enabled running}.each do |attrib|
|
@@ -29,7 +29,7 @@ describe Chef::Resource::User, "initialize" do
|
|
29
29
|
end
|
30
30
|
|
31
31
|
it "should set the resource_name to :user" do
|
32
|
-
expect(@resource.resource_name).to eql(:
|
32
|
+
expect(@resource.resource_name).to eql(:user_resource_abstract_base_class)
|
33
33
|
end
|
34
34
|
|
35
35
|
it "should set the username equal to the argument to initialize" do
|
@@ -0,0 +1,49 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Thom May (<thom@chef.io>)
|
3
|
+
# Copyright:: Copyright (c) 2016 Chef Software, Inc.
|
4
|
+
# License:: Apache License, Version 2.0
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
19
|
+
require "spec_helper"
|
20
|
+
|
21
|
+
describe Chef::Resource::YumRepository do
|
22
|
+
let(:node) { Chef::Node.new }
|
23
|
+
let(:events) { Chef::EventDispatch::Dispatcher.new }
|
24
|
+
let(:run_context) { Chef::RunContext.new(node, {}, events) }
|
25
|
+
let(:resource) { Chef::Resource::YumRepository.new("multiverse", run_context) }
|
26
|
+
|
27
|
+
context "on linux", :linux_only do
|
28
|
+
it "should create a new Chef::Resource::YumRepository" do
|
29
|
+
expect(resource).to be_a_kind_of(Chef::Resource)
|
30
|
+
expect(resource).to be_a_kind_of(Chef::Resource::YumRepository)
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should resolve to a Noop class when yum is not found" do
|
34
|
+
expect(Chef::Provider::YumRepository).to receive(:which).with("yum").and_return(false)
|
35
|
+
expect(resource.provider_for_action(:add)).to be_a(Chef::Provider::Noop)
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should resolve to a YumRepository class when yum is found" do
|
39
|
+
expect(Chef::Provider::YumRepository).to receive(:which).with("yum").and_return(true)
|
40
|
+
expect(resource.provider_for_action(:add)).to be_a(Chef::Provider::YumRepository)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
context "on windows", :windows_only do
|
45
|
+
it "should resolve to a NoOp provider" do
|
46
|
+
expect(resource.provider_for_action(:add)).to be_a(Chef::Provider::Noop)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -98,11 +98,11 @@ describe Chef::ResourceCollection do
|
|
98
98
|
it "should allow you to iterate over every resource in the collection" do
|
99
99
|
load_up_resources
|
100
100
|
results = Array.new
|
101
|
-
expect
|
101
|
+
expect do
|
102
102
|
rc.each do |r|
|
103
103
|
results << r.name
|
104
104
|
end
|
105
|
-
|
105
|
+
end.not_to raise_error
|
106
106
|
results.each_index do |i|
|
107
107
|
case i
|
108
108
|
when 0
|
@@ -120,11 +120,11 @@ describe Chef::ResourceCollection do
|
|
120
120
|
it "should allow you to iterate over every resource by index" do
|
121
121
|
load_up_resources
|
122
122
|
results = Array.new
|
123
|
-
expect
|
123
|
+
expect do
|
124
124
|
rc.each_index do |i|
|
125
125
|
results << rc[i].name
|
126
126
|
end
|
127
|
-
|
127
|
+
end.not_to raise_error
|
128
128
|
results.each_index do |i|
|
129
129
|
case i
|
130
130
|
when 0
|