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
@@ -78,19 +78,19 @@ describe Chef::Knife::KeyShow do
|
|
78
78
|
let(:actor) { "charmander" }
|
79
79
|
let(:keyname) { "charmander" }
|
80
80
|
let(:ui) { instance_double("Chef::Knife::UI") }
|
81
|
-
let(:expected_hash)
|
81
|
+
let(:expected_hash) do
|
82
82
|
{
|
83
83
|
actor_field_name => "charmander",
|
84
84
|
"name" => "charmander-key",
|
85
85
|
"public_key" => "some-public-key",
|
86
86
|
"expiration_date" => "infinity",
|
87
87
|
}
|
88
|
-
|
88
|
+
end
|
89
89
|
|
90
90
|
shared_examples_for "key show run command" do
|
91
|
-
let(:key_show_object)
|
91
|
+
let(:key_show_object) do
|
92
92
|
described_class.new(keyname, actor, load_method, ui)
|
93
|
-
|
93
|
+
end
|
94
94
|
|
95
95
|
before do
|
96
96
|
allow(key_show_object).to receive(:display_output)
|
@@ -34,10 +34,11 @@ describe Chef::Knife::Status do
|
|
34
34
|
end
|
35
35
|
|
36
36
|
describe "run" do
|
37
|
-
let(:opts)
|
37
|
+
let(:opts) do
|
38
|
+
{ filter_result:
|
38
39
|
{ name: ["name"], ipaddress: ["ipaddress"], ohai_time: ["ohai_time"],
|
39
40
|
ec2: ["ec2"], run_list: ["run_list"], platform: ["platform"],
|
40
|
-
platform_version: ["platform_version"], chef_environment: ["chef_environment"] } }
|
41
|
+
platform_version: ["platform_version"], chef_environment: ["chef_environment"] } } end
|
41
42
|
|
42
43
|
it "should default to searching for everything" do
|
43
44
|
expect(@query).to receive(:search).with(:node, "*:*", opts)
|
@@ -24,13 +24,13 @@ Chef::Knife::UserCreate.load_deps
|
|
24
24
|
describe Chef::Knife::UserCreate do
|
25
25
|
let(:knife) { Chef::Knife::UserCreate.new }
|
26
26
|
|
27
|
-
let(:stderr)
|
27
|
+
let(:stderr) do
|
28
28
|
StringIO.new
|
29
|
-
|
29
|
+
end
|
30
30
|
|
31
|
-
let(:stdout)
|
31
|
+
let(:stdout) do
|
32
32
|
StringIO.new
|
33
|
-
|
33
|
+
end
|
34
34
|
|
35
35
|
before(:each) do
|
36
36
|
allow(knife.ui).to receive(:stdout).and_return(stdout)
|
data/spec/unit/knife_spec.rb
CHANGED
@@ -159,12 +159,13 @@ describe Chef::Knife do
|
|
159
159
|
|
160
160
|
describe "the headers include X-Remote-Request-Id" do
|
161
161
|
|
162
|
-
let(:headers)
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
162
|
+
let(:headers) do
|
163
|
+
{ "Accept" => "application/json",
|
164
|
+
"Accept-Encoding" => "gzip;q=1.0,deflate;q=0.6,identity;q=0.3",
|
165
|
+
"X-Chef-Version" => Chef::VERSION,
|
166
|
+
"Host" => "api.opscode.piab",
|
167
|
+
"X-REMOTE-REQUEST-ID" => request_id,
|
168
|
+
} end
|
168
169
|
|
169
170
|
let(:request_id) { "1234" }
|
170
171
|
|
data/spec/unit/lwrp_spec.rb
CHANGED
@@ -28,13 +28,13 @@ describe "LWRP" do
|
|
28
28
|
include Chef::Mixin::ConvertToClassName
|
29
29
|
|
30
30
|
before do
|
31
|
-
@
|
31
|
+
@original_verbose = $VERBOSE
|
32
32
|
$VERBOSE = nil
|
33
33
|
Chef::Resource::LWRPBase.class_eval { @loaded_lwrps = {} }
|
34
34
|
end
|
35
35
|
|
36
36
|
after do
|
37
|
-
$VERBOSE = @
|
37
|
+
$VERBOSE = @original_verbose
|
38
38
|
end
|
39
39
|
|
40
40
|
def get_lwrp(name)
|
@@ -232,9 +232,9 @@ describe "LWRP" do
|
|
232
232
|
end
|
233
233
|
|
234
234
|
it "allows to user to user the resource_name" do
|
235
|
-
expect
|
235
|
+
expect do
|
236
236
|
klass.resource_name(:foo)
|
237
|
-
|
237
|
+
end.to_not raise_error
|
238
238
|
end
|
239
239
|
|
240
240
|
it "returns the set value for the resource" do
|
@@ -741,7 +741,7 @@ describe "LWRP" do
|
|
741
741
|
end
|
742
742
|
end
|
743
743
|
|
744
|
-
let(:recipe)
|
744
|
+
let(:recipe) do
|
745
745
|
cookbook_repo = File.expand_path(File.join(File.dirname(__FILE__), "..", "data", "cookbooks"))
|
746
746
|
cookbook_loader = Chef::CookbookLoader.new(cookbook_repo)
|
747
747
|
cookbook_loader.load_cookbooks
|
@@ -750,7 +750,7 @@ describe "LWRP" do
|
|
750
750
|
events = Chef::EventDispatch::Dispatcher.new
|
751
751
|
run_context = Chef::RunContext.new(node, cookbook_collection, events)
|
752
752
|
Chef::Recipe.new("hjk", "test", run_context)
|
753
|
-
|
753
|
+
end
|
754
754
|
|
755
755
|
it "lets you extend the recipe DSL" do
|
756
756
|
expect(Chef::Recipe).to receive(:include).with(MyAwesomeDSLExensionClass)
|
@@ -50,12 +50,12 @@ describe Chef::Mixin::ApiVersionRequestHandling do
|
|
50
50
|
context "when x-ops-server-api-version header exists" do
|
51
51
|
let(:min_server_version) { 2 }
|
52
52
|
let(:max_server_version) { 4 }
|
53
|
-
let(:return_hash)
|
53
|
+
let(:return_hash) do
|
54
54
|
{
|
55
55
|
"min_version" => min_server_version,
|
56
56
|
"max_version" => max_server_version,
|
57
57
|
}
|
58
|
-
|
58
|
+
end
|
59
59
|
|
60
60
|
before(:each) do
|
61
61
|
allow(response).to receive(:[]).with("x-ops-server-api-version").and_return(Chef::JSONCompat.to_json(return_hash))
|
@@ -49,22 +49,24 @@ describe Chef::Mixin::Command, :volatile do
|
|
49
49
|
end
|
50
50
|
|
51
51
|
it "should end when the child process reads from STDIN and a block is given" do
|
52
|
-
expect
|
53
|
-
|
54
|
-
(
|
52
|
+
expect do
|
53
|
+
Timeout.timeout(10) do
|
54
|
+
popen4("ruby -e 'while gets; end'", :waitlast => true) do |pid, stdin, stdout, stderr|
|
55
|
+
(1..5).each { |i| stdin.puts "#{i}" }
|
56
|
+
end
|
55
57
|
end
|
56
|
-
end
|
57
|
-
}.not_to raise_error
|
58
|
+
end.not_to raise_error
|
58
59
|
end
|
59
60
|
|
60
61
|
describe "when a process detaches but doesn't close STDOUT and STDERR [CHEF-584]" do
|
61
62
|
|
62
63
|
it "returns immediately after the first child process exits" do
|
63
|
-
expect
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
64
|
+
expect do
|
65
|
+
Timeout.timeout(10) do
|
66
|
+
evil_forker = "exit if fork; 10.times { sleep 1}"
|
67
|
+
popen4("ruby -e '#{evil_forker}'") do |pid, stdin, stdout, stderr|
|
68
|
+
end
|
69
|
+
end end.not_to raise_error
|
68
70
|
end
|
69
71
|
|
70
72
|
end
|
@@ -92,10 +94,11 @@ describe Chef::Mixin::Command, :volatile do
|
|
92
94
|
# btm
|
93
95
|
# Serdar - During Solaris tests, we've seen that processes
|
94
96
|
# are taking a long time to exit. Bumping timeout now to 10.
|
95
|
-
expect
|
96
|
-
|
97
|
-
|
98
|
-
|
97
|
+
expect do
|
98
|
+
Timeout.timeout(10) do
|
99
|
+
evil_forker = "exit if fork; 10.times { sleep 1}"
|
100
|
+
run_command(:command => "ruby -e '#{evil_forker}'")
|
101
|
+
end end.not_to raise_error
|
99
102
|
end
|
100
103
|
|
101
104
|
end
|
@@ -36,7 +36,7 @@ describe Chef::Mixin do
|
|
36
36
|
end
|
37
37
|
|
38
38
|
it "warns when accessing the deprecated constant" do
|
39
|
-
Chef::Mixin::DeprecatedClass
|
39
|
+
Chef::Mixin::DeprecatedClass # rubocop:disable Lint/Void
|
40
40
|
expect(@log_io.string).to include("This is a test deprecation")
|
41
41
|
end
|
42
42
|
end
|
@@ -51,11 +51,11 @@ describe Chef::Mixin::HomebrewUser do
|
|
51
51
|
let(:user) { nil }
|
52
52
|
let(:brew_owner) { 2001 }
|
53
53
|
let(:default_brew_path) { "/usr/local/bin/brew" }
|
54
|
-
let(:stat_double)
|
54
|
+
let(:stat_double) do
|
55
55
|
d = double()
|
56
56
|
expect(d).to receive(:uid).and_return(brew_owner)
|
57
57
|
d
|
58
|
-
|
58
|
+
end
|
59
59
|
|
60
60
|
context "debug statement prints owner name" do
|
61
61
|
|
@@ -56,7 +56,7 @@ describe Chef::Mixin::ParamsValidate do
|
|
56
56
|
end
|
57
57
|
|
58
58
|
it "should allow you to check what kind_of? thing an argument is with kind_of" do
|
59
|
-
expect
|
59
|
+
expect do
|
60
60
|
@vo.validate(
|
61
61
|
{ :one => "string" },
|
62
62
|
{
|
@@ -65,9 +65,9 @@ describe Chef::Mixin::ParamsValidate do
|
|
65
65
|
},
|
66
66
|
}
|
67
67
|
)
|
68
|
-
|
68
|
+
end.not_to raise_error
|
69
69
|
|
70
|
-
expect
|
70
|
+
expect do
|
71
71
|
@vo.validate(
|
72
72
|
{ :one => "string" },
|
73
73
|
{
|
@@ -76,11 +76,11 @@ describe Chef::Mixin::ParamsValidate do
|
|
76
76
|
},
|
77
77
|
}
|
78
78
|
)
|
79
|
-
|
79
|
+
end.to raise_error(ArgumentError)
|
80
80
|
end
|
81
81
|
|
82
82
|
it "should allow you to specify an argument is required with required" do
|
83
|
-
expect
|
83
|
+
expect do
|
84
84
|
@vo.validate(
|
85
85
|
{ :one => "string" },
|
86
86
|
{
|
@@ -89,9 +89,9 @@ describe Chef::Mixin::ParamsValidate do
|
|
89
89
|
},
|
90
90
|
}
|
91
91
|
)
|
92
|
-
|
92
|
+
end.not_to raise_error
|
93
93
|
|
94
|
-
expect
|
94
|
+
expect do
|
95
95
|
@vo.validate(
|
96
96
|
{ :two => "string" },
|
97
97
|
{
|
@@ -100,9 +100,9 @@ describe Chef::Mixin::ParamsValidate do
|
|
100
100
|
},
|
101
101
|
}
|
102
102
|
)
|
103
|
-
|
103
|
+
end.to raise_error(ArgumentError)
|
104
104
|
|
105
|
-
expect
|
105
|
+
expect do
|
106
106
|
@vo.validate(
|
107
107
|
{ :two => "string" },
|
108
108
|
{
|
@@ -111,11 +111,11 @@ describe Chef::Mixin::ParamsValidate do
|
|
111
111
|
},
|
112
112
|
}
|
113
113
|
)
|
114
|
-
|
114
|
+
end.not_to raise_error
|
115
115
|
end
|
116
116
|
|
117
117
|
it "should allow you to specify whether an object has a method with respond_to" do
|
118
|
-
expect
|
118
|
+
expect do
|
119
119
|
@vo.validate(
|
120
120
|
{ :one => @vo },
|
121
121
|
{
|
@@ -124,9 +124,9 @@ describe Chef::Mixin::ParamsValidate do
|
|
124
124
|
},
|
125
125
|
}
|
126
126
|
)
|
127
|
-
|
127
|
+
end.not_to raise_error
|
128
128
|
|
129
|
-
expect
|
129
|
+
expect do
|
130
130
|
@vo.validate(
|
131
131
|
{ :one => @vo },
|
132
132
|
{
|
@@ -135,11 +135,11 @@ describe Chef::Mixin::ParamsValidate do
|
|
135
135
|
},
|
136
136
|
}
|
137
137
|
)
|
138
|
-
|
138
|
+
end.to raise_error(ArgumentError)
|
139
139
|
end
|
140
140
|
|
141
141
|
it "should allow you to specify whether an object has all the given methods with respond_to and an array" do
|
142
|
-
expect
|
142
|
+
expect do
|
143
143
|
@vo.validate(
|
144
144
|
{ :one => @vo },
|
145
145
|
{
|
@@ -148,9 +148,9 @@ describe Chef::Mixin::ParamsValidate do
|
|
148
148
|
},
|
149
149
|
}
|
150
150
|
)
|
151
|
-
|
151
|
+
end.not_to raise_error
|
152
152
|
|
153
|
-
expect
|
153
|
+
expect do
|
154
154
|
@vo.validate(
|
155
155
|
{ :one => @vo },
|
156
156
|
{
|
@@ -159,7 +159,7 @@ describe Chef::Mixin::ParamsValidate do
|
|
159
159
|
},
|
160
160
|
}
|
161
161
|
)
|
162
|
-
|
162
|
+
end.to raise_error(ArgumentError)
|
163
163
|
end
|
164
164
|
|
165
165
|
it "should let you set a default value with default => value" do
|
@@ -173,7 +173,7 @@ describe Chef::Mixin::ParamsValidate do
|
|
173
173
|
end
|
174
174
|
|
175
175
|
it "should let you check regular expressions" do
|
176
|
-
expect
|
176
|
+
expect do
|
177
177
|
@vo.validate(
|
178
178
|
{ :one => "is good" },
|
179
179
|
{
|
@@ -182,9 +182,9 @@ describe Chef::Mixin::ParamsValidate do
|
|
182
182
|
},
|
183
183
|
}
|
184
184
|
)
|
185
|
-
|
185
|
+
end.not_to raise_error
|
186
186
|
|
187
|
-
expect
|
187
|
+
expect do
|
188
188
|
@vo.validate(
|
189
189
|
{ :one => "is good" },
|
190
190
|
{
|
@@ -193,44 +193,44 @@ describe Chef::Mixin::ParamsValidate do
|
|
193
193
|
},
|
194
194
|
}
|
195
195
|
)
|
196
|
-
|
196
|
+
end.to raise_error(ArgumentError)
|
197
197
|
end
|
198
198
|
|
199
199
|
it "should let you specify your own callbacks" do
|
200
|
-
expect
|
200
|
+
expect do
|
201
201
|
@vo.validate(
|
202
202
|
{ :one => "is good" },
|
203
203
|
{
|
204
204
|
:one => {
|
205
205
|
:callbacks => {
|
206
|
-
"should be equal to is good" => lambda
|
206
|
+
"should be equal to is good" => lambda do |a|
|
207
207
|
a == "is good"
|
208
|
-
|
208
|
+
end,
|
209
209
|
},
|
210
210
|
},
|
211
211
|
}
|
212
212
|
)
|
213
|
-
|
213
|
+
end.not_to raise_error
|
214
214
|
|
215
|
-
expect
|
215
|
+
expect do
|
216
216
|
@vo.validate(
|
217
217
|
{ :one => "is bad" },
|
218
218
|
{
|
219
219
|
:one => {
|
220
220
|
:callbacks => {
|
221
|
-
"should be equal to 'is good'" => lambda
|
221
|
+
"should be equal to 'is good'" => lambda do |a|
|
222
222
|
a == "is good"
|
223
|
-
|
223
|
+
end,
|
224
224
|
},
|
225
225
|
},
|
226
226
|
}
|
227
227
|
)
|
228
|
-
|
228
|
+
end.to raise_error(ArgumentError)
|
229
229
|
end
|
230
230
|
|
231
231
|
it "should let you combine checks" do
|
232
232
|
args = { :one => "is good", :two => "is bad" }
|
233
|
-
expect
|
233
|
+
expect do
|
234
234
|
@vo.validate(
|
235
235
|
args,
|
236
236
|
{
|
@@ -239,9 +239,9 @@ describe Chef::Mixin::ParamsValidate do
|
|
239
239
|
:respond_to => [ :to_s, :upcase ],
|
240
240
|
:regex => /^is good/,
|
241
241
|
:callbacks => {
|
242
|
-
"should be your friend" => lambda
|
242
|
+
"should be your friend" => lambda do |a|
|
243
243
|
a == "is good"
|
244
|
-
|
244
|
+
end,
|
245
245
|
},
|
246
246
|
:required => true,
|
247
247
|
},
|
@@ -252,9 +252,9 @@ describe Chef::Mixin::ParamsValidate do
|
|
252
252
|
:three => { :default => "neato mosquito" },
|
253
253
|
}
|
254
254
|
)
|
255
|
-
|
255
|
+
end.not_to raise_error
|
256
256
|
expect(args[:three]).to eq("neato mosquito")
|
257
|
-
expect
|
257
|
+
expect do
|
258
258
|
@vo.validate(
|
259
259
|
args,
|
260
260
|
{
|
@@ -263,9 +263,9 @@ describe Chef::Mixin::ParamsValidate do
|
|
263
263
|
:respond_to => [ :to_s, :upcase ],
|
264
264
|
:regex => /^is good/,
|
265
265
|
:callbacks => {
|
266
|
-
"should be your friend" => lambda
|
266
|
+
"should be your friend" => lambda do |a|
|
267
267
|
a == "is good"
|
268
|
-
|
268
|
+
end,
|
269
269
|
},
|
270
270
|
:required => true,
|
271
271
|
},
|
@@ -276,11 +276,12 @@ describe Chef::Mixin::ParamsValidate do
|
|
276
276
|
:three => { :default => "neato mosquito" },
|
277
277
|
}
|
278
278
|
)
|
279
|
-
|
279
|
+
end.to raise_error(ArgumentError)
|
280
280
|
end
|
281
281
|
|
282
282
|
it "should raise an ArgumentError if the validation map has an unknown check" do
|
283
|
-
expect
|
283
|
+
expect do
|
284
|
+
@vo.validate(
|
284
285
|
{ :one => "two" },
|
285
286
|
{
|
286
287
|
:one => {
|
@@ -288,17 +289,17 @@ describe Chef::Mixin::ParamsValidate do
|
|
288
289
|
},
|
289
290
|
}
|
290
291
|
)
|
291
|
-
|
292
|
+
end.to raise_error(ArgumentError)
|
292
293
|
end
|
293
294
|
|
294
295
|
it "should accept keys that are strings in the options" do
|
295
|
-
expect
|
296
|
+
expect do
|
296
297
|
@vo.validate({ "one" => "two" }, { :one => { :regex => /^two$/ } })
|
297
|
-
|
298
|
+
end.not_to raise_error
|
298
299
|
end
|
299
300
|
|
300
301
|
it "should allow an array to kind_of" do
|
301
|
-
expect
|
302
|
+
expect do
|
302
303
|
@vo.validate(
|
303
304
|
{ :one => "string" },
|
304
305
|
{
|
@@ -307,8 +308,8 @@ describe Chef::Mixin::ParamsValidate do
|
|
307
308
|
},
|
308
309
|
}
|
309
310
|
)
|
310
|
-
|
311
|
-
expect
|
311
|
+
end.not_to raise_error
|
312
|
+
expect do
|
312
313
|
@vo.validate(
|
313
314
|
{ :one => ["string"] },
|
314
315
|
{
|
@@ -317,8 +318,8 @@ describe Chef::Mixin::ParamsValidate do
|
|
317
318
|
},
|
318
319
|
}
|
319
320
|
)
|
320
|
-
|
321
|
-
expect
|
321
|
+
end.not_to raise_error
|
322
|
+
expect do
|
322
323
|
@vo.validate(
|
323
324
|
{ :one => Hash.new },
|
324
325
|
{
|
@@ -327,7 +328,7 @@ describe Chef::Mixin::ParamsValidate do
|
|
327
328
|
},
|
328
329
|
}
|
329
330
|
)
|
330
|
-
|
331
|
+
end.to raise_error(ArgumentError)
|
331
332
|
end
|
332
333
|
|
333
334
|
it "asserts that a value returns false from a predicate method" do
|
@@ -354,15 +355,15 @@ describe Chef::Mixin::ParamsValidate do
|
|
354
355
|
end
|
355
356
|
|
356
357
|
it "should raise an ArgumentError when argument is nil and required is true" do
|
357
|
-
expect
|
358
|
+
expect do
|
358
359
|
@vo.set_or_return(:test, nil, { :required => true })
|
359
|
-
|
360
|
+
end.to raise_error(ArgumentError)
|
360
361
|
end
|
361
362
|
|
362
363
|
it "should not raise an error when argument is nil and required is false" do
|
363
|
-
expect
|
364
|
+
expect do
|
364
365
|
@vo.set_or_return(:test, nil, { :required => false })
|
365
|
-
|
366
|
+
end.not_to raise_error
|
366
367
|
end
|
367
368
|
|
368
369
|
it "should set and return @name, then return @name for foo when argument is nil" do
|