chef 12.18.31 → 12.19.33
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +5 -4
- data/README.md +12 -13
- data/VERSION +1 -1
- data/acceptance/Gemfile +4 -4
- data/acceptance/Gemfile.lock +70 -69
- data/chef-universal-mingw32.gemspec +2 -3
- data/chef.gemspec +6 -6
- data/lib/chef/api_client.rb +8 -10
- data/lib/chef/api_client_v1.rb +9 -11
- data/lib/chef/application/apply.rb +8 -10
- data/lib/chef/application/client.rb +1 -1
- data/lib/chef/application/exit_code.rb +3 -5
- data/lib/chef/application/knife.rb +2 -2
- data/lib/chef/application/windows_service.rb +29 -30
- data/lib/chef/application/windows_service_manager.rb +1 -1
- data/lib/chef/audit/audit_event_proxy.rb +2 -2
- data/lib/chef/audit/control_group_data.rb +1 -1
- data/lib/chef/chef_class.rb +1 -0
- data/lib/chef/chef_fs/chef_fs_data_store.rb +5 -7
- data/lib/chef/chef_fs/command_line.rb +15 -16
- data/lib/chef/chef_fs/data_handler/client_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/container_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/cookbook_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/data_bag_item_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/environment_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/group_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/node_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/organization_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/role_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/user_data_handler.rb +1 -1
- data/lib/chef/chef_fs/file_pattern.rb +2 -2
- data/lib/chef/chef_fs/file_system.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/cookbook_dir.rb +5 -6
- data/lib/chef/chef_fs/file_system/chef_server/cookbook_file.rb +8 -10
- data/lib/chef/chef_fs/file_system/chef_server/data_bags_dir.rb +8 -10
- data/lib/chef/chef_fs/file_system/chef_server/nodes_dir.rb +10 -12
- data/lib/chef/chef_fs/file_system/chef_server/policies_dir.rb +28 -30
- data/lib/chef/chef_fs/file_system/chef_server/policy_group_entry.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/rest_list_dir.rb +27 -29
- data/lib/chef/chef_fs/file_system/chef_server/rest_list_entry.rb +18 -24
- data/lib/chef/chef_fs/file_system/memory/memory_file.rb +1 -1
- data/lib/chef/chef_fs/file_system/multiplexed_dir.rb +10 -12
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir.rb +10 -12
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb +9 -13
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb +2 -0
- data/lib/chef/chef_fs/file_system/repository/cookbooks_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/nodes_dir.rb +3 -0
- data/lib/chef/chef_fs/parallelizer.rb +9 -11
- data/lib/chef/cookbook/cookbook_version_loader.rb +25 -31
- data/lib/chef/cookbook/metadata.rb +26 -26
- data/lib/chef/cookbook/syntax_check.rb +1 -1
- data/lib/chef/cookbook_version.rb +3 -3
- data/lib/chef/data_bag.rb +1 -1
- data/lib/chef/data_bag_item.rb +3 -3
- data/lib/chef/data_collector.rb +3 -4
- data/lib/chef/decorator.rb +1 -1
- data/lib/chef/deprecated.rb +30 -0
- data/lib/chef/dsl/audit.rb +2 -2
- data/lib/chef/dsl/declare_resource.rb +1 -1
- data/lib/chef/dsl/platform_introspection.rb +29 -31
- data/lib/chef/dsl/reboot_pending.rb +1 -1
- data/lib/chef/dsl/resources.rb +6 -8
- data/lib/chef/encrypted_data_bag_item.rb +2 -2
- data/lib/chef/environment.rb +9 -11
- data/lib/chef/event_loggers/windows_eventlog.rb +1 -1
- data/lib/chef/exceptions.rb +4 -1
- data/lib/chef/file_access_control/unix.rb +14 -14
- data/lib/chef/file_access_control/windows.rb +1 -1
- data/lib/chef/formatters/error_inspectors/api_error_formatting.rb +4 -5
- data/lib/chef/formatters/error_mapper.rb +6 -6
- data/lib/chef/http/api_versions.rb +50 -0
- data/lib/chef/http/validate_content_length.rb +2 -2
- data/lib/chef/json_compat.rb +6 -10
- data/lib/chef/key.rb +5 -5
- data/lib/chef/knife.rb +4 -4
- data/lib/chef/knife/cookbook_site_install.rb +2 -2
- data/lib/chef/knife/core/cookbook_scm_repo.rb +2 -2
- data/lib/chef/knife/core/gem_glob_loader.rb +1 -1
- data/lib/chef/knife/core/status_presenter.rb +1 -1
- data/lib/chef/knife/core/ui.rb +19 -25
- data/lib/chef/knife/data_bag_secret_options.rb +1 -1
- data/lib/chef/knife/deps.rb +32 -34
- data/lib/chef/knife/help.rb +1 -1
- data/lib/chef/knife/list.rb +1 -1
- data/lib/chef/knife/search.rb +2 -2
- data/lib/chef/knife/ssh.rb +37 -27
- data/lib/chef/knife/ssl_check.rb +1 -1
- data/lib/chef/knife/user_delete.rb +1 -1
- data/lib/chef/mash.rb +1 -1
- data/lib/chef/mixin/command.rb +2 -2
- data/lib/chef/mixin/create_path.rb +3 -5
- data/lib/chef/mixin/from_file.rb +2 -2
- data/lib/chef/mixin/get_source_from_package.rb +2 -2
- data/lib/chef/mixin/notifying_block.rb +7 -9
- data/lib/chef/mixin/params_validate.rb +3 -3
- data/lib/chef/mixin/securable.rb +1 -1
- data/lib/chef/mixin/shell_out.rb +23 -3
- data/lib/chef/mixin/unformatter.rb +2 -2
- data/lib/chef/mixin/uris.rb +4 -6
- data/lib/chef/mixin/versioned_api.rb +69 -0
- data/lib/chef/mixin/which.rb +25 -8
- data/lib/chef/mixin/windows_architecture_helper.rb +2 -2
- data/lib/chef/mixin/xml_escape.rb +3 -5
- data/lib/chef/monkey_patches/webrick-utils.rb +1 -1
- data/lib/chef/node.rb +8 -8
- data/lib/chef/node/attribute.rb +4 -4
- data/lib/chef/node/common_api.rb +5 -7
- data/lib/chef/org.rb +10 -12
- data/lib/chef/platform/provider_mapping.rb +7 -7
- data/lib/chef/platform/query_helpers.rb +1 -1
- data/lib/chef/policy_builder/policyfile.rb +1 -0
- data/lib/chef/property.rb +31 -0
- data/lib/chef/provider/batch.rb +1 -1
- data/lib/chef/provider/breakpoint.rb +1 -1
- data/lib/chef/provider/cookbook_file.rb +3 -3
- data/lib/chef/provider/cron.rb +38 -38
- data/lib/chef/provider/deploy.rb +81 -81
- data/lib/chef/provider/deploy/revision.rb +3 -5
- data/lib/chef/provider/directory.rb +32 -32
- data/lib/chef/provider/dsc_resource.rb +22 -6
- data/lib/chef/provider/env.rb +28 -28
- data/lib/chef/provider/env/windows.rb +1 -1
- data/lib/chef/provider/erl_call.rb +13 -13
- data/lib/chef/provider/execute.rb +5 -2
- data/lib/chef/provider/file.rb +49 -51
- data/lib/chef/provider/git.rb +55 -55
- data/lib/chef/provider/http_request.rb +36 -36
- data/lib/chef/provider/launchd.rb +2 -2
- data/lib/chef/provider/link.rb +50 -50
- data/lib/chef/provider/log.rb +2 -2
- data/lib/chef/provider/mdadm.rb +25 -25
- data/lib/chef/provider/mount/aix.rb +2 -2
- data/lib/chef/provider/mount/mount.rb +2 -2
- data/lib/chef/provider/ohai.rb +1 -1
- data/lib/chef/provider/osx_profile.rb +23 -23
- data/lib/chef/provider/package.rb +74 -56
- data/lib/chef/provider/package/aix.rb +55 -52
- data/lib/chef/provider/package/apt.rb +15 -13
- data/lib/chef/provider/package/cab.rb +49 -20
- data/lib/chef/provider/package/chocolatey.rb +9 -10
- data/lib/chef/provider/package/dnf.rb +20 -18
- data/lib/chef/provider/package/dnf/dnf_helper.py +1 -1
- data/lib/chef/provider/package/dnf/python_helper.rb +63 -26
- data/lib/chef/provider/package/dnf/version.rb +1 -1
- data/lib/chef/provider/package/dpkg.rb +8 -9
- data/lib/chef/provider/package/easy_install.rb +22 -22
- data/lib/chef/provider/package/freebsd/base.rb +10 -10
- data/lib/chef/provider/package/freebsd/pkg.rb +15 -15
- data/lib/chef/provider/package/freebsd/pkgng.rb +13 -15
- data/lib/chef/provider/package/freebsd/port.rb +7 -7
- data/lib/chef/provider/package/homebrew.rb +11 -10
- data/lib/chef/provider/package/ips.rb +18 -23
- data/lib/chef/provider/package/macports.rb +23 -23
- data/lib/chef/provider/package/msu.rb +11 -11
- data/lib/chef/provider/package/openbsd.rb +25 -22
- data/lib/chef/provider/package/pacman.rb +16 -16
- data/lib/chef/provider/package/paludis.rb +26 -27
- data/lib/chef/provider/package/portage.rb +22 -22
- data/lib/chef/provider/package/powershell.rb +17 -17
- data/lib/chef/provider/package/rpm.rb +25 -25
- data/lib/chef/provider/package/rubygems.rb +60 -60
- data/lib/chef/provider/package/smartos.rb +16 -16
- data/lib/chef/provider/package/solaris.rb +44 -44
- data/lib/chef/provider/package/windows.rb +3 -3
- data/lib/chef/provider/package/windows/exe.rb +6 -6
- data/lib/chef/provider/package/windows/msi.rb +6 -6
- data/lib/chef/provider/package/yum.rb +318 -268
- data/lib/chef/provider/package/yum/rpm_utils.rb +34 -34
- data/lib/chef/provider/package/yum/yum_cache.rb +12 -12
- data/lib/chef/provider/package/zypper.rb +11 -11
- data/lib/chef/provider/powershell_script.rb +15 -7
- data/lib/chef/provider/reboot.rb +10 -10
- data/lib/chef/provider/registry_key.rb +39 -39
- data/lib/chef/provider/remote_directory.rb +3 -3
- data/lib/chef/provider/remote_file.rb +3 -3
- data/lib/chef/provider/route.rb +1 -1
- data/lib/chef/provider/ruby_block.rb +3 -3
- data/lib/chef/provider/script.rb +42 -6
- data/lib/chef/provider/service.rb +49 -49
- data/lib/chef/provider/service/solaris.rb +1 -1
- data/lib/chef/provider/service/systemd.rb +1 -1
- data/lib/chef/provider/subversion.rb +39 -39
- data/lib/chef/provider/systemd_unit.rb +2 -0
- data/lib/chef/provider/template.rb +3 -3
- data/lib/chef/provider/user.rb +42 -42
- data/lib/chef/provider/whyrun_safe_ruby_block.rb +4 -4
- data/lib/chef/resource.rb +27 -16
- data/lib/chef/resource/apt_repository.rb +0 -1
- data/lib/chef/resource/chef_gem.rb +1 -1
- data/lib/chef/resource/dnf_package.rb +6 -3
- data/lib/chef/resource/dsc_resource.rb +9 -1
- data/lib/chef/resource/execute.rb +70 -6
- data/lib/chef/resource/file/verification/systemd_unit.rb +67 -0
- data/lib/chef/resource/freebsd_package.rb +1 -1
- data/lib/chef/resource/gem_package.rb +1 -1
- data/lib/chef/resource/launchd.rb +13 -1
- data/lib/chef/resource/package.rb +2 -2
- data/lib/chef/resource/registry_key.rb +1 -1
- data/lib/chef/resource/yum_package.rb +12 -3
- data/lib/chef/resource/yum_repository.rb +0 -1
- data/lib/chef/resource_collection/resource_collection_serialization.rb +3 -3
- data/lib/chef/resource_collection/resource_set.rb +2 -2
- data/lib/chef/resource_reporter.rb +1 -1
- data/lib/chef/run_context.rb +3 -3
- data/lib/chef/run_list/run_list_item.rb +1 -1
- data/lib/chef/run_list/versioned_recipe_list.rb +6 -6
- data/lib/chef/server_api.rb +2 -0
- data/lib/chef/server_api_versions.rb +40 -0
- data/lib/chef/shell.rb +1 -1
- data/lib/chef/shell/ext.rb +3 -3
- data/lib/chef/shell/shell_session.rb +1 -1
- data/lib/chef/user.rb +9 -11
- data/lib/chef/user_v1.rb +9 -11
- data/lib/chef/util/diff.rb +1 -1
- data/lib/chef/util/dsc/lcm_output_parser.rb +1 -1
- data/lib/chef/util/selinux.rb +1 -1
- data/lib/chef/util/windows/net_group.rb +18 -30
- data/lib/chef/util/windows/net_use.rb +7 -11
- data/lib/chef/util/windows/net_user.rb +11 -17
- data/lib/chef/util/windows/volume.rb +9 -15
- data/lib/chef/version.rb +1 -1
- data/lib/chef/version_class.rb +1 -1
- data/lib/chef/win32/api.rb +4 -6
- data/lib/chef/win32/api/file.rb +25 -31
- data/lib/chef/win32/api/installer.rb +2 -2
- data/lib/chef/win32/file.rb +4 -6
- data/lib/chef/win32/registry.rb +9 -9
- data/lib/chef/win32/security.rb +2 -2
- data/lib/chef/win32/security/acl.rb +2 -2
- data/lib/chef/win32/unicode.rb +2 -2
- data/lib/chef/win32/version.rb +1 -1
- data/spec/data/prefer_metadata_json/metadata.json +51 -0
- data/spec/data/prefer_metadata_json/metadata.rb +6 -0
- data/spec/data/prefer_metadata_json/recipes/default.rb +0 -0
- data/spec/functional/knife/ssh_spec.rb +5 -5
- data/spec/functional/resource/batch_spec.rb +5 -1
- data/spec/functional/resource/dsc_script_spec.rb +2 -4
- data/spec/functional/resource/execute_spec.rb +17 -0
- data/spec/functional/resource/user/dscl_spec.rb +2 -4
- data/spec/integration/client/client_spec.rb +33 -0
- data/spec/integration/recipes/recipe_dsl_spec.rb +58 -58
- data/spec/spec_helper.rb +4 -0
- data/spec/support/chef_helpers.rb +5 -7
- data/spec/support/platform_helpers.rb +6 -0
- data/spec/support/platforms/prof/gc.rb +4 -6
- data/spec/support/shared/context/client.rb +1 -1
- data/spec/support/shared/functional/execute_resource.rb +150 -0
- data/spec/support/shared/functional/windows_script.rb +74 -4
- data/spec/support/shared/unit/execute_resource.rb +37 -0
- data/spec/support/shared/unit/provider/file.rb +10 -0
- data/spec/unit/cookbook/cookbook_version_loader_spec.rb +9 -0
- data/spec/unit/cookbook/syntax_check_spec.rb +8 -2
- data/spec/unit/http/api_versions_spec.rb +69 -0
- data/spec/unit/knife/ssh_spec.rb +34 -36
- data/spec/unit/mixin/versioned_api_spec.rb +107 -0
- data/spec/unit/mixin/which.rb +160 -0
- data/spec/unit/platform_spec.rb +28 -1
- data/spec/unit/provider/deploy_spec.rb +1 -1
- data/spec/unit/provider/directory_spec.rb +10 -0
- data/spec/unit/provider/dsc_resource_spec.rb +175 -0
- data/spec/unit/provider/execute_spec.rb +0 -1
- data/spec/unit/provider/launchd_spec.rb +2 -2
- data/spec/unit/provider/package/aix_spec.rb +22 -22
- data/spec/unit/provider/package/apt_spec.rb +27 -27
- data/spec/unit/provider/package/cab_spec.rb +59 -5
- data/spec/unit/provider/package/dnf/python_helper_spec.rb +29 -0
- data/spec/unit/provider/package/dpkg_spec.rb +16 -16
- data/spec/unit/provider/package/easy_install_spec.rb +18 -18
- data/spec/unit/provider/package/freebsd/pkg_spec.rb +15 -15
- data/spec/unit/provider/package/freebsd/pkgng_spec.rb +9 -9
- data/spec/unit/provider/package/freebsd/port_spec.rb +9 -9
- data/spec/unit/provider/package/homebrew_spec.rb +9 -9
- data/spec/unit/provider/package/ips_spec.rb +37 -31
- data/spec/unit/provider/package/macports_spec.rb +10 -10
- data/spec/unit/provider/package/openbsd_spec.rb +10 -10
- data/spec/unit/provider/package/pacman_spec.rb +6 -6
- data/spec/unit/provider/package/paludis_spec.rb +7 -7
- data/spec/unit/provider/package/portage_spec.rb +6 -7
- data/spec/unit/provider/package/rpm_spec.rb +23 -23
- data/spec/unit/provider/package/rubygems_spec.rb +38 -38
- data/spec/unit/provider/package/solaris_spec.rb +15 -15
- data/spec/unit/provider/package/windows_spec.rb +2 -1
- data/spec/unit/provider/package/yum_spec.rb +51 -43
- data/spec/unit/provider/package/zypper_spec.rb +34 -34
- data/spec/unit/provider/package_spec.rb +8 -0
- data/spec/unit/provider/remote_file/sftp_spec.rb +3 -3
- data/spec/unit/provider/route_spec.rb +7 -1
- data/spec/unit/provider/script_spec.rb +49 -6
- data/spec/unit/resource/dsc_resource_spec.rb +6 -0
- data/spec/unit/resource/execute_spec.rb +214 -0
- data/spec/unit/resource/file/verification/systemd_unit_spec.rb +103 -0
- data/spec/unit/resource/freebsd_package_spec.rb +2 -2
- data/spec/unit/resource/package_spec.rb +5 -0
- data/spec/unit/resource/yum_package_spec.rb +42 -1
- data/spec/unit/resource_reporter_spec.rb +1 -1
- data/spec/unit/resource_spec.rb +18 -0
- data/spec/unit/server_api_versions_spec.rb +44 -0
- data/spec/unit/util/selinux_spec.rb +3 -14
- data/spec/unit/win32/error_spec.rb +67 -0
- data/spec/unit/win32/security_spec.rb +66 -0
- data/tasks/changelog.rb +1 -1
- data/tasks/dependencies.rb +20 -4
- metadata +39 -18
- data/lib/chef/monkey_patches/net-ssh-multi.rb +0 -141
@@ -137,6 +137,18 @@ describe Chef::Resource::Execute do
|
|
137
137
|
end
|
138
138
|
end
|
139
139
|
|
140
|
+
describe "when a guard is specified" do
|
141
|
+
describe "when using the default guard interpreter" do
|
142
|
+
let(:guard_interpreter_resource) { nil }
|
143
|
+
it_behaves_like "a resource with a guard specifying an alternate user identity"
|
144
|
+
end
|
145
|
+
|
146
|
+
describe "when using the execute resource as the guard interpreter" do
|
147
|
+
let(:guard_interpreter_resource) { :execute }
|
148
|
+
it_behaves_like "a resource with a guard specifying an alternate user identity"
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
140
152
|
# Ensure that CommandTimeout is raised, and is caused by resource.timeout really expiring.
|
141
153
|
# https://github.com/chef/chef/issues/2985
|
142
154
|
#
|
@@ -151,4 +163,9 @@ describe Chef::Resource::Execute do
|
|
151
163
|
expect { resource.run_action(:run) }.to raise_error(Mixlib::ShellOut::CommandTimeout)
|
152
164
|
end
|
153
165
|
end
|
166
|
+
|
167
|
+
describe "when running with an alternate user identity" do
|
168
|
+
let(:resource_command_property) { :command }
|
169
|
+
it_behaves_like "an execute resource that supports alternate user identity"
|
170
|
+
end
|
154
171
|
end
|
@@ -28,11 +28,9 @@ describe "Chef::Resource::User with Chef::Provider::User::Dscl provider", metada
|
|
28
28
|
include Chef::Mixin::ShellOut
|
29
29
|
|
30
30
|
def clean_user
|
31
|
-
|
32
|
-
|
33
|
-
rescue Mixlib::ShellOut::ShellCommandFailed
|
31
|
+
shell_out!("/usr/bin/dscl . -delete '/Users/#{username}'")
|
32
|
+
rescue Mixlib::ShellOut::ShellCommandFailed
|
34
33
|
# Raised when the user is already cleaned
|
35
|
-
end
|
36
34
|
end
|
37
35
|
|
38
36
|
def user_should_exist
|
@@ -46,6 +46,7 @@ describe "chef-client" do
|
|
46
46
|
# we're running `chef-client` from the source tree and not the external one.
|
47
47
|
# cf. CHEF-4914
|
48
48
|
let(:chef_client) { "ruby '#{chef_dir}/chef-client' --minimal-ohai" }
|
49
|
+
let(:chef_solo) { "ruby '#{chef_dir}/chef-solo' --minimal-ohai" }
|
49
50
|
|
50
51
|
let(:critical_env_vars) { %w{_ORIGINAL_GEM_PATH GEM_PATH GEM_HOME GEM_ROOT BUNDLE_BIN_PATH BUNDLE_GEMFILE RUBYLIB RUBYOPT RUBY_ENGINE RUBY_ROOT RUBY_VERSION PATH}.map { |o| "#{o}=#{ENV[o]}" } .join(" ") }
|
51
52
|
|
@@ -499,4 +500,36 @@ EOM
|
|
499
500
|
expect(result.exitstatus).not_to eq(0)
|
500
501
|
end
|
501
502
|
end
|
503
|
+
|
504
|
+
when_the_repository "has a cookbook with broken metadata.rb, but has metadata.json" do
|
505
|
+
before do
|
506
|
+
file "cookbooks/x/recipes/default.rb", ""
|
507
|
+
file "cookbooks/x/metadata.rb", <<EOM
|
508
|
+
name 'x'
|
509
|
+
version '0.0.1'
|
510
|
+
raise "TEH SADNESS"
|
511
|
+
EOM
|
512
|
+
file "cookbooks/x/metadata.json", <<EOM
|
513
|
+
{
|
514
|
+
"name": "x",
|
515
|
+
"version": "0.0.1"
|
516
|
+
}
|
517
|
+
EOM
|
518
|
+
|
519
|
+
file "config/client.rb", <<EOM
|
520
|
+
local_mode true
|
521
|
+
cookbook_path "#{path_to('cookbooks')}"
|
522
|
+
EOM
|
523
|
+
end
|
524
|
+
|
525
|
+
it "the chef client run should succeed" do
|
526
|
+
command = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork", :cwd => chef_dir)
|
527
|
+
command.error!
|
528
|
+
end
|
529
|
+
|
530
|
+
it "a chef-solo run should succeed" do
|
531
|
+
command = shell_out("#{chef_solo} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork", :cwd => chef_dir)
|
532
|
+
command.error!
|
533
|
+
end
|
534
|
+
end
|
502
535
|
end
|
@@ -861,9 +861,9 @@ describe "Recipe DSL methods" do
|
|
861
861
|
before { resource_class_a } # pull on it so it gets defined before the recipe runs
|
862
862
|
|
863
863
|
it "two_classes_one_dsl resolves to A (alphabetically earliest)" do
|
864
|
-
|
864
|
+
temp_two_classes_one_dsl = two_classes_one_dsl
|
865
865
|
recipe = converge do
|
866
|
-
instance_eval("#{
|
866
|
+
instance_eval("#{temp_two_classes_one_dsl} 'blah'")
|
867
867
|
end
|
868
868
|
expect(recipe.logged_warnings).to eq ""
|
869
869
|
expect(BaseThingy.created_resource).to eq resource_class_a
|
@@ -891,9 +891,9 @@ describe "Recipe DSL methods" do
|
|
891
891
|
before { resource_class_z } # pull on it so it gets defined before the recipe runs
|
892
892
|
|
893
893
|
it "two_classes_one_dsl resolves to B (alphabetically earliest)" do
|
894
|
-
|
894
|
+
temp_two_classes_one_dsl = two_classes_one_dsl
|
895
895
|
recipe = converge do
|
896
|
-
instance_eval("#{
|
896
|
+
instance_eval("#{temp_two_classes_one_dsl} 'blah'")
|
897
897
|
end
|
898
898
|
expect(recipe.logged_warnings).to eq ""
|
899
899
|
expect(BaseThingy.created_resource).to eq resource_class
|
@@ -909,9 +909,9 @@ describe "Recipe DSL methods" do
|
|
909
909
|
end
|
910
910
|
|
911
911
|
it "two_classes_one_dsl resolves to Z (respects the priority array)" do
|
912
|
-
|
912
|
+
temp_two_classes_one_dsl = two_classes_one_dsl
|
913
913
|
recipe = converge do
|
914
|
-
instance_eval("#{
|
914
|
+
instance_eval("#{temp_two_classes_one_dsl} 'blah'")
|
915
915
|
end
|
916
916
|
expect(recipe.logged_warnings).to eq ""
|
917
917
|
expect(BaseThingy.created_resource).to eq resource_class_z
|
@@ -927,9 +927,9 @@ describe "Recipe DSL methods" do
|
|
927
927
|
end
|
928
928
|
|
929
929
|
it "two_classes_one_dsl resolves to B (picks the next thing in the priority array)" do
|
930
|
-
|
930
|
+
temp_two_classes_one_dsl = two_classes_one_dsl
|
931
931
|
recipe = converge do
|
932
|
-
instance_eval("#{
|
932
|
+
instance_eval("#{temp_two_classes_one_dsl} 'blah'")
|
933
933
|
end
|
934
934
|
expect(recipe.logged_warnings).to eq ""
|
935
935
|
expect(BaseThingy.created_resource).to eq resource_class
|
@@ -948,9 +948,9 @@ describe "Recipe DSL methods" do
|
|
948
948
|
end
|
949
949
|
|
950
950
|
it "two_classes_one_dsl resolves to Z (respects the most recent priority array)" do
|
951
|
-
|
951
|
+
temp_two_classes_one_dsl = two_classes_one_dsl
|
952
952
|
recipe = converge do
|
953
|
-
instance_eval("#{
|
953
|
+
instance_eval("#{temp_two_classes_one_dsl} 'blah'")
|
954
954
|
end
|
955
955
|
expect(recipe.logged_warnings).to eq ""
|
956
956
|
expect(BaseThingy.created_resource).to eq resource_class_z
|
@@ -966,9 +966,9 @@ describe "Recipe DSL methods" do
|
|
966
966
|
end
|
967
967
|
|
968
968
|
it "two_classes_one_dsl resolves to B (picks the first match from the other priority array)" do
|
969
|
-
|
969
|
+
temp_two_classes_one_dsl = two_classes_one_dsl
|
970
970
|
recipe = converge do
|
971
|
-
instance_eval("#{
|
971
|
+
instance_eval("#{temp_two_classes_one_dsl} 'blah'")
|
972
972
|
end
|
973
973
|
expect(recipe.logged_warnings).to eq ""
|
974
974
|
expect(BaseThingy.created_resource).to eq resource_class
|
@@ -991,9 +991,9 @@ describe "Recipe DSL methods" do
|
|
991
991
|
end
|
992
992
|
|
993
993
|
it "two_classes_one_dsl resolves to B (picks the first match outside the priority array)" do
|
994
|
-
|
994
|
+
temp_two_classes_one_dsl = two_classes_one_dsl
|
995
995
|
recipe = converge do
|
996
|
-
instance_eval("#{
|
996
|
+
instance_eval("#{temp_two_classes_one_dsl} 'blah'")
|
997
997
|
end
|
998
998
|
expect(recipe.logged_warnings).to eq ""
|
999
999
|
expect(BaseThingy.created_resource).to eq resource_class
|
@@ -1044,9 +1044,9 @@ describe "Recipe DSL methods" do
|
|
1044
1044
|
before { provider_class_a.provides two_classes_one_dsl }
|
1045
1045
|
|
1046
1046
|
it "two_classes_one_dsl resolves to A (alphabetically earliest)" do
|
1047
|
-
|
1047
|
+
temp_two_classes_one_dsl = two_classes_one_dsl
|
1048
1048
|
recipe = converge do
|
1049
|
-
instance_eval("#{
|
1049
|
+
instance_eval("#{temp_two_classes_one_dsl} 'blah'")
|
1050
1050
|
end
|
1051
1051
|
expect(recipe.logged_warnings).to eq ""
|
1052
1052
|
expect(BaseThingy.created_provider).to eq provider_class_a
|
@@ -1056,9 +1056,9 @@ describe "Recipe DSL methods" do
|
|
1056
1056
|
before { provider_class_a.provides(two_classes_one_dsl) { false } }
|
1057
1057
|
|
1058
1058
|
it "two_classes_one_dsl resolves to B (since A declined)" do
|
1059
|
-
|
1059
|
+
temp_two_classes_one_dsl = two_classes_one_dsl
|
1060
1060
|
recipe = converge do
|
1061
|
-
instance_eval("#{
|
1061
|
+
instance_eval("#{temp_two_classes_one_dsl} 'blah'")
|
1062
1062
|
end
|
1063
1063
|
expect(recipe.logged_warnings).to eq ""
|
1064
1064
|
expect(BaseThingy.created_provider).to eq provider_class
|
@@ -1085,9 +1085,9 @@ describe "Recipe DSL methods" do
|
|
1085
1085
|
before { provider_class_z.provides two_classes_one_dsl }
|
1086
1086
|
|
1087
1087
|
it "two_classes_one_dsl resolves to B (alphabetically earliest)" do
|
1088
|
-
|
1088
|
+
temp_two_classes_one_dsl = two_classes_one_dsl
|
1089
1089
|
recipe = converge do
|
1090
|
-
instance_eval("#{
|
1090
|
+
instance_eval("#{temp_two_classes_one_dsl} 'blah'")
|
1091
1091
|
end
|
1092
1092
|
expect(recipe.logged_warnings).to eq ""
|
1093
1093
|
expect(BaseThingy.created_provider).to eq provider_class
|
@@ -1097,9 +1097,9 @@ describe "Recipe DSL methods" do
|
|
1097
1097
|
before { Chef.set_provider_priority_array two_classes_one_dsl, [ provider_class_z, provider_class ] }
|
1098
1098
|
|
1099
1099
|
it "two_classes_one_dsl resolves to Z (respects the priority map)" do
|
1100
|
-
|
1100
|
+
temp_two_classes_one_dsl = two_classes_one_dsl
|
1101
1101
|
recipe = converge do
|
1102
|
-
instance_eval("#{
|
1102
|
+
instance_eval("#{temp_two_classes_one_dsl} 'blah'")
|
1103
1103
|
end
|
1104
1104
|
expect(recipe.logged_warnings).to eq ""
|
1105
1105
|
expect(BaseThingy.created_provider).to eq provider_class_z
|
@@ -1114,9 +1114,9 @@ describe "Recipe DSL methods" do
|
|
1114
1114
|
before { Chef.set_provider_priority_array two_classes_one_dsl, [ provider_class_z, provider_class ] }
|
1115
1115
|
|
1116
1116
|
it "two_classes_one_dsl resolves to B (the next one in the priority map)" do
|
1117
|
-
|
1117
|
+
temp_two_classes_one_dsl = two_classes_one_dsl
|
1118
1118
|
recipe = converge do
|
1119
|
-
instance_eval("#{
|
1119
|
+
instance_eval("#{temp_two_classes_one_dsl} 'blah'")
|
1120
1120
|
end
|
1121
1121
|
expect(recipe.logged_warnings).to eq ""
|
1122
1122
|
expect(BaseThingy.created_provider).to eq provider_class
|
@@ -1128,9 +1128,9 @@ describe "Recipe DSL methods" do
|
|
1128
1128
|
before { Chef.set_provider_priority_array two_classes_one_dsl, [ provider_class ] }
|
1129
1129
|
|
1130
1130
|
it "two_classes_one_dsl resolves to B (the one in the next priority map)" do
|
1131
|
-
|
1131
|
+
temp_two_classes_one_dsl = two_classes_one_dsl
|
1132
1132
|
recipe = converge do
|
1133
|
-
instance_eval("#{
|
1133
|
+
instance_eval("#{temp_two_classes_one_dsl} 'blah'")
|
1134
1134
|
end
|
1135
1135
|
expect(recipe.logged_warnings).to eq ""
|
1136
1136
|
expect(BaseThingy.created_provider).to eq provider_class
|
@@ -1158,22 +1158,22 @@ describe "Recipe DSL methods" do
|
|
1158
1158
|
before { resource_class_blarghle } # pull on it so it gets defined before the recipe runs
|
1159
1159
|
|
1160
1160
|
it "on os = blarghle, two_classes_one_dsl resolves to Blarghle" do
|
1161
|
-
|
1161
|
+
temp_two_classes_one_dsl = two_classes_one_dsl
|
1162
1162
|
recipe = converge do
|
1163
1163
|
# this is an ugly way to test, make Cheffish expose node attrs
|
1164
1164
|
run_context.node.automatic[:os] = "blarghle"
|
1165
|
-
instance_eval("#{
|
1165
|
+
instance_eval("#{temp_two_classes_one_dsl} 'blah' do; end")
|
1166
1166
|
end
|
1167
1167
|
expect(recipe.logged_warnings).to eq ""
|
1168
1168
|
expect(BaseThingy.created_resource).to eq resource_class_blarghle
|
1169
1169
|
end
|
1170
1170
|
|
1171
1171
|
it "on os = linux, two_classes_one_dsl resolves to B" do
|
1172
|
-
|
1172
|
+
temp_two_classes_one_dsl = two_classes_one_dsl
|
1173
1173
|
recipe = converge do
|
1174
1174
|
# this is an ugly way to test, make Cheffish expose node attrs
|
1175
1175
|
run_context.node.automatic[:os] = "linux"
|
1176
|
-
instance_eval("#{
|
1176
|
+
instance_eval("#{temp_two_classes_one_dsl} 'blah' do; end")
|
1177
1177
|
end
|
1178
1178
|
expect(recipe.logged_warnings).to eq ""
|
1179
1179
|
expect(BaseThingy.created_resource).to eq resource_class
|
@@ -1202,15 +1202,15 @@ describe "Recipe DSL methods" do
|
|
1202
1202
|
|
1203
1203
|
context "with provides? returning true to my_resource" do
|
1204
1204
|
before do
|
1205
|
-
|
1205
|
+
temp_my_resource = my_resource
|
1206
1206
|
resource_class.define_singleton_method(:provides?) do |node, resource_name|
|
1207
1207
|
@called_provides = true
|
1208
|
-
resource_name ==
|
1208
|
+
resource_name == temp_my_resource
|
1209
1209
|
end
|
1210
1210
|
end
|
1211
1211
|
|
1212
1212
|
it "my_resource returns the resource and calls provides?, but does not emit a warning" do
|
1213
|
-
dsl_name =
|
1213
|
+
dsl_name = my_resource
|
1214
1214
|
recipe = converge do
|
1215
1215
|
instance_eval("#{dsl_name} 'foo'")
|
1216
1216
|
end
|
@@ -1222,15 +1222,15 @@ describe "Recipe DSL methods" do
|
|
1222
1222
|
|
1223
1223
|
context "with provides? returning true to blarghle_blarghle_little_star and not resource_name" do
|
1224
1224
|
before do
|
1225
|
-
|
1225
|
+
temp_blarghle_blarghle_little_star = blarghle_blarghle_little_star
|
1226
1226
|
resource_class.define_singleton_method(:provides?) do |node, resource_name|
|
1227
1227
|
@called_provides = true
|
1228
|
-
resource_name ==
|
1228
|
+
resource_name == temp_blarghle_blarghle_little_star
|
1229
1229
|
end
|
1230
1230
|
end
|
1231
1231
|
|
1232
1232
|
it "my_resource does not return the resource" do
|
1233
|
-
dsl_name =
|
1233
|
+
dsl_name = my_resource
|
1234
1234
|
expect_converge do
|
1235
1235
|
instance_eval("#{dsl_name} 'foo'")
|
1236
1236
|
end.to raise_error(Chef::Exceptions::NoSuchResourceType)
|
@@ -1239,7 +1239,7 @@ describe "Recipe DSL methods" do
|
|
1239
1239
|
|
1240
1240
|
it "blarghle_blarghle_little_star 'foo' returns the resource and emits a warning" do
|
1241
1241
|
Chef::Config[:treat_deprecation_warnings_as_errors] = false
|
1242
|
-
dsl_name =
|
1242
|
+
dsl_name = blarghle_blarghle_little_star
|
1243
1243
|
recipe = converge do
|
1244
1244
|
instance_eval("#{dsl_name} 'foo'")
|
1245
1245
|
end
|
@@ -1281,9 +1281,9 @@ describe "Recipe DSL methods" do
|
|
1281
1281
|
end
|
1282
1282
|
|
1283
1283
|
it "my_resource runs the provider and does not emit a warning" do
|
1284
|
-
|
1284
|
+
temp_my_resource = my_resource
|
1285
1285
|
recipe = converge do
|
1286
|
-
instance_eval("#{
|
1286
|
+
instance_eval("#{temp_my_resource} 'foo'")
|
1287
1287
|
end
|
1288
1288
|
expect(recipe.logged_warnings).to eq ""
|
1289
1289
|
expect(BaseThingy.created_provider).to eq provider_class
|
@@ -1311,9 +1311,9 @@ describe "Recipe DSL methods" do
|
|
1311
1311
|
end
|
1312
1312
|
|
1313
1313
|
it "my_resource runs the first provider" do
|
1314
|
-
|
1314
|
+
temp_my_resource = my_resource
|
1315
1315
|
recipe = converge do
|
1316
|
-
instance_eval("#{
|
1316
|
+
instance_eval("#{temp_my_resource} 'foo'")
|
1317
1317
|
end
|
1318
1318
|
expect(recipe.logged_warnings).to eq ""
|
1319
1319
|
expect(BaseThingy.created_provider).to eq provider_class
|
@@ -1328,9 +1328,9 @@ describe "Recipe DSL methods" do
|
|
1328
1328
|
|
1329
1329
|
# TODO no warning? ick
|
1330
1330
|
it "my_resource runs the provider anyway" do
|
1331
|
-
|
1331
|
+
temp_my_resource = my_resource
|
1332
1332
|
recipe = converge do
|
1333
|
-
instance_eval("#{
|
1333
|
+
instance_eval("#{temp_my_resource} 'foo'")
|
1334
1334
|
end
|
1335
1335
|
expect(recipe.logged_warnings).to eq ""
|
1336
1336
|
expect(BaseThingy.created_provider).to eq provider_class
|
@@ -1338,7 +1338,7 @@ describe "Recipe DSL methods" do
|
|
1338
1338
|
|
1339
1339
|
context "and another provider supporting :my_resource with supports? true" do
|
1340
1340
|
let(:provider_class2) do
|
1341
|
-
|
1341
|
+
temp_my_resource = my_resource
|
1342
1342
|
Class.new(BaseThingy::Provider) do
|
1343
1343
|
def self.name
|
1344
1344
|
"MyProvider2"
|
@@ -1351,7 +1351,7 @@ describe "Recipe DSL methods" do
|
|
1351
1351
|
def self.called_provides
|
1352
1352
|
@called_provides
|
1353
1353
|
end
|
1354
|
-
provides
|
1354
|
+
provides temp_my_resource
|
1355
1355
|
def self.supports?(resource, action)
|
1356
1356
|
true
|
1357
1357
|
end
|
@@ -1360,9 +1360,9 @@ describe "Recipe DSL methods" do
|
|
1360
1360
|
before { provider_class2 } # make sure the provider class shows up
|
1361
1361
|
|
1362
1362
|
it "my_resource runs the other provider" do
|
1363
|
-
|
1363
|
+
temp_my_resource = my_resource
|
1364
1364
|
recipe = converge do
|
1365
|
-
instance_eval("#{
|
1365
|
+
instance_eval("#{temp_my_resource} 'foo'")
|
1366
1366
|
end
|
1367
1367
|
expect(recipe.logged_warnings).to eq ""
|
1368
1368
|
expect(BaseThingy.created_provider).to eq provider_class2
|
@@ -1373,10 +1373,10 @@ describe "Recipe DSL methods" do
|
|
1373
1373
|
|
1374
1374
|
context "with provides? returning true" do
|
1375
1375
|
before do
|
1376
|
-
|
1376
|
+
temp_my_resource = my_resource
|
1377
1377
|
provider_class.define_singleton_method(:provides?) do |node, resource|
|
1378
1378
|
@called_provides = true
|
1379
|
-
resource.declared_type ==
|
1379
|
+
resource.declared_type == temp_my_resource
|
1380
1380
|
end
|
1381
1381
|
end
|
1382
1382
|
|
@@ -1386,9 +1386,9 @@ describe "Recipe DSL methods" do
|
|
1386
1386
|
end
|
1387
1387
|
|
1388
1388
|
it "my_resource calls the provider (and calls provides?), but does not emit a warning" do
|
1389
|
-
|
1389
|
+
temp_my_resource = my_resource
|
1390
1390
|
recipe = converge do
|
1391
|
-
instance_eval("#{
|
1391
|
+
instance_eval("#{temp_my_resource} 'foo'")
|
1392
1392
|
end
|
1393
1393
|
expect(recipe.logged_warnings).to eq ""
|
1394
1394
|
expect(BaseThingy.created_provider).to eq provider_class
|
@@ -1399,9 +1399,9 @@ describe "Recipe DSL methods" do
|
|
1399
1399
|
context "that does not call provides :my_resource" do
|
1400
1400
|
it "my_resource calls the provider (and calls provides?), and emits a warning" do
|
1401
1401
|
Chef::Config[:treat_deprecation_warnings_as_errors] = false
|
1402
|
-
|
1402
|
+
temp_my_resource = my_resource
|
1403
1403
|
recipe = converge do
|
1404
|
-
instance_eval("#{
|
1404
|
+
instance_eval("#{temp_my_resource} 'foo'")
|
1405
1405
|
end
|
1406
1406
|
expect(recipe.logged_warnings).to include("WARN: #{provider_class}.provides? returned true when asked if it provides DSL #{my_resource}, but provides :#{my_resource} was never called!")
|
1407
1407
|
expect(BaseThingy.created_provider).to eq provider_class
|
@@ -1412,7 +1412,7 @@ describe "Recipe DSL methods" do
|
|
1412
1412
|
|
1413
1413
|
context "with provides? returning false to my_resource" do
|
1414
1414
|
before do
|
1415
|
-
|
1415
|
+
temp_my_resource = my_resource
|
1416
1416
|
provider_class.define_singleton_method(:provides?) do |node, resource|
|
1417
1417
|
@called_provides = true
|
1418
1418
|
false
|
@@ -1426,9 +1426,9 @@ describe "Recipe DSL methods" do
|
|
1426
1426
|
|
1427
1427
|
it "my_resource fails to find a provider (and calls provides)" do
|
1428
1428
|
Chef::Config[:treat_deprecation_warnings_as_errors] = false
|
1429
|
-
|
1429
|
+
temp_my_resource = my_resource
|
1430
1430
|
expect_converge do
|
1431
|
-
instance_eval("#{
|
1431
|
+
instance_eval("#{temp_my_resource} 'foo'")
|
1432
1432
|
end.to raise_error(Chef::Exceptions::ProviderNotFound)
|
1433
1433
|
expect(provider_class.called_provides).to be_truthy
|
1434
1434
|
end
|
@@ -1437,9 +1437,9 @@ describe "Recipe DSL methods" do
|
|
1437
1437
|
context "that does not provide :my_resource" do
|
1438
1438
|
it "my_resource fails to find a provider (and calls provides)" do
|
1439
1439
|
Chef::Config[:treat_deprecation_warnings_as_errors] = false
|
1440
|
-
|
1440
|
+
temp_my_resource = my_resource
|
1441
1441
|
expect_converge do
|
1442
|
-
instance_eval("#{
|
1442
|
+
instance_eval("#{temp_my_resource} 'foo'")
|
1443
1443
|
end.to raise_error(Chef::Exceptions::ProviderNotFound)
|
1444
1444
|
expect(provider_class.called_provides).to be_truthy
|
1445
1445
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -152,6 +152,10 @@ RSpec.configure do |config|
|
|
152
152
|
config.filter_run_excluding :windows_powershell_no_dsc_only => true unless ! windows_powershell_dsc?
|
153
153
|
config.filter_run_excluding :windows_domain_joined_only => true unless windows_domain_joined?
|
154
154
|
config.filter_run_excluding :windows_not_domain_joined_only => true if windows_domain_joined?
|
155
|
+
# We think this line was causing rspec tests to not run on the Jenkins windows
|
156
|
+
# testers. If we ever fix it we should restore it.
|
157
|
+
# config.filter_run_excluding :windows_service_requires_assign_token => true if !STDOUT.isatty && !windows_user_right?("SeAssignPrimaryTokenPrivilege")
|
158
|
+
config.filter_run_excluding :windows_service_requires_assign_token => true
|
155
159
|
config.filter_run_excluding :solaris_only => true unless solaris?
|
156
160
|
config.filter_run_excluding :system_windows_service_gem_only => true unless system_windows_service_gem?
|
157
161
|
config.filter_run_excluding :unix_only => true unless unix?
|