chef 11.18.12-x86-mingw32 → 12.0.0.alpha.0-x86-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +10 -0
- data/README.md +1 -1
- data/distro/common/html/_sources/index.txt +5 -2
- data/distro/common/html/_sources/knife_serve.txt +19 -0
- data/distro/common/html/_sources/knife_ssl_check.txt +2 -2
- data/distro/common/html/_sources/knife_ssl_fetch.txt +2 -2
- data/distro/common/html/_static/basic.css +1 -1
- data/distro/common/html/_static/doctools.js +1 -1
- data/distro/common/html/_static/searchtools.js +1 -1
- data/distro/common/html/_static/websupport.js +1 -1
- data/distro/common/html/ctl_chef_client.html +19 -9
- data/distro/common/html/ctl_chef_server.html +7 -1
- data/distro/common/html/ctl_chef_shell.html +3 -4
- data/distro/common/html/ctl_chef_solo.html +12 -7
- data/distro/common/html/index.html +19 -12
- data/distro/common/html/knife.html +1 -2
- data/distro/common/html/knife_bootstrap.html +16 -5
- data/distro/common/html/knife_client.html +8 -5
- data/distro/common/html/knife_common_options.html +11 -12
- data/distro/common/html/knife_configure.html +2 -3
- data/distro/common/html/knife_cookbook.html +16 -17
- data/distro/common/html/knife_cookbook_site.html +19 -18
- data/distro/common/html/knife_data_bag.html +6 -7
- data/distro/common/html/knife_delete.html +2 -3
- data/distro/common/html/knife_deps.html +2 -3
- data/distro/common/html/knife_diff.html +3 -4
- data/distro/common/html/knife_download.html +6 -7
- data/distro/common/html/knife_edit.html +0 -1
- data/distro/common/html/knife_environment.html +3 -4
- data/distro/common/html/knife_exec.html +0 -1
- data/distro/common/html/knife_index_rebuild.html +0 -1
- data/distro/common/html/knife_list.html +5 -6
- data/distro/common/html/knife_node.html +13 -6
- data/distro/common/html/knife_raw.html +0 -1
- data/distro/common/html/knife_recipe_list.html +0 -1
- data/distro/common/html/knife_role.html +1 -2
- data/distro/common/html/knife_search.html +2 -3
- data/distro/common/html/knife_serve.html +79 -0
- data/distro/common/html/knife_show.html +1 -2
- data/distro/common/html/knife_ssh.html +2 -3
- data/distro/common/html/knife_ssl_check.html +12 -9
- data/distro/common/html/knife_ssl_fetch.html +9 -10
- data/distro/common/html/knife_status.html +2 -3
- data/distro/common/html/knife_tag.html +0 -1
- data/distro/common/html/knife_upload.html +3 -4
- data/distro/common/html/knife_user.html +2 -3
- data/distro/common/html/knife_using.html +0 -1
- data/distro/common/html/knife_xargs.html +3 -4
- data/distro/common/html/search.html +0 -1
- data/distro/common/html/searchindex.js +1 -1
- data/lib/chef/api_client.rb +1 -1
- data/lib/chef/application.rb +24 -67
- data/lib/chef/application/client.rb +1 -1
- data/lib/chef/application/knife.rb +1 -1
- data/lib/chef/chef_fs/chef_fs_data_store.rb +2 -3
- data/lib/chef/chef_fs/command_line.rb +2 -3
- data/lib/chef/chef_fs/data_handler/group_data_handler.rb +1 -5
- data/lib/chef/chef_fs/file_system/acl_entry.rb +1 -2
- data/lib/chef/chef_fs/file_system/chef_repository_file_system_entry.rb +1 -2
- data/lib/chef/chef_fs/file_system/cookbooks_dir.rb +2 -2
- data/lib/chef/chef_fs/file_system/rest_list_dir.rb +2 -3
- data/lib/chef/chef_fs/file_system/rest_list_entry.rb +4 -5
- data/lib/chef/config.rb +26 -2
- data/lib/chef/config_fetcher.rb +1 -1
- data/lib/chef/cookbook/cookbook_version_loader.rb +4 -4
- data/lib/chef/cookbook/metadata.rb +1 -1
- data/lib/chef/cookbook/synchronizer.rb +50 -8
- data/lib/chef/cookbook_uploader.rb +9 -23
- data/lib/chef/cookbook_version.rb +3 -2
- data/lib/chef/data_bag.rb +1 -1
- data/lib/chef/data_bag_item.rb +1 -1
- data/lib/chef/dsl/recipe.rb +1 -14
- data/lib/chef/encrypted_data_bag_item/decryptor.rb +3 -3
- data/lib/chef/environment.rb +1 -1
- data/lib/chef/exceptions.rb +2 -24
- data/lib/chef/file_content_management/tempfile.rb +8 -1
- data/lib/chef/formatters/base.rb +0 -7
- data/lib/chef/http.rb +12 -19
- data/lib/chef/http/json_input.rb +12 -1
- data/lib/chef/json_compat.rb +45 -64
- data/lib/chef/knife.rb +2 -5
- data/lib/chef/knife/bootstrap.rb +2 -2
- data/lib/chef/knife/bootstrap/archlinux-gems.erb +2 -2
- data/lib/chef/knife/bootstrap/centos5-gems.erb +2 -2
- data/lib/chef/knife/bootstrap/chef-aix.erb +2 -2
- data/lib/chef/knife/bootstrap/chef-full.erb +2 -2
- data/lib/chef/knife/bootstrap/fedora13-gems.erb +2 -2
- data/lib/chef/knife/bootstrap/ubuntu10.04-apt.erb +2 -2
- data/lib/chef/knife/bootstrap/ubuntu10.04-gems.erb +2 -2
- data/lib/chef/knife/bootstrap/ubuntu12.04-gems.erb +2 -2
- data/lib/chef/knife/cookbook_site_download.rb +1 -1
- data/lib/chef/knife/cookbook_site_install.rb +10 -34
- data/lib/chef/knife/cookbook_site_list.rb +1 -1
- data/lib/chef/knife/cookbook_site_search.rb +1 -1
- data/lib/chef/knife/cookbook_site_share.rb +3 -3
- data/lib/chef/knife/cookbook_site_show.rb +3 -3
- data/lib/chef/knife/cookbook_site_unshare.rb +1 -1
- data/lib/chef/knife/cookbook_upload.rb +1 -1
- data/lib/chef/knife/core/subcommand_loader.rb +0 -24
- data/lib/chef/knife/core/ui.rb +8 -7
- data/lib/chef/knife/deps.rb +2 -3
- data/lib/chef/knife/serve.rb +2 -1
- data/lib/chef/local_mode.rb +105 -0
- data/lib/chef/mixin/file_class.rb +1 -4
- data/lib/chef/mixin/shell_out.rb +15 -0
- data/lib/chef/mixin/windows_architecture_helper.rb +0 -16
- data/lib/chef/node.rb +1 -1
- data/lib/chef/platform/query_helpers.rb +1 -5
- data/lib/chef/policy_builder/expand_node_object.rb +3 -0
- data/lib/chef/provider.rb +2 -0
- data/lib/chef/provider/cookbook_file.rb +0 -1
- data/lib/chef/provider/deploy.rb +0 -1
- data/lib/chef/provider/deploy/revision.rb +1 -1
- data/lib/chef/provider/env.rb +10 -25
- data/lib/chef/provider/env/windows.rb +23 -10
- data/lib/chef/provider/execute.rb +0 -3
- data/lib/chef/provider/file.rb +0 -3
- data/lib/chef/provider/git.rb +0 -6
- data/lib/chef/provider/group/dscl.rb +9 -27
- data/lib/chef/provider/group/gpasswd.rb +0 -3
- data/lib/chef/provider/group/groupmod.rb +0 -4
- data/lib/chef/provider/group/suse.rb +0 -3
- data/lib/chef/provider/group/usermod.rb +0 -3
- data/lib/chef/provider/link.rb +22 -5
- data/lib/chef/provider/log.rb +15 -4
- data/lib/chef/provider/mdadm.rb +0 -3
- data/lib/chef/provider/mount/mount.rb +0 -2
- data/lib/chef/provider/mount/solaris.rb +0 -2
- data/lib/chef/provider/package.rb +0 -1
- data/lib/chef/provider/package/apt.rb +0 -3
- data/lib/chef/provider/package/dpkg.rb +0 -1
- data/lib/chef/provider/package/easy_install.rb +0 -4
- data/lib/chef/provider/package/freebsd/base.rb +0 -3
- data/lib/chef/provider/package/freebsd/pkgng.rb +0 -2
- data/lib/chef/provider/package/freebsd/port.rb +0 -2
- data/lib/chef/provider/package/ips.rb +0 -3
- data/lib/chef/provider/package/paludis.rb +0 -5
- data/lib/chef/provider/package/portage.rb +0 -2
- data/lib/chef/provider/package/rpm.rb +2 -4
- data/lib/chef/provider/package/rubygems.rb +0 -4
- data/lib/chef/provider/package/smartos.rb +0 -3
- data/lib/chef/provider/package/windows/msi.rb +0 -2
- data/lib/chef/provider/package/yum.rb +0 -4
- data/lib/chef/provider/package/zypper.rb +0 -3
- data/lib/chef/provider/registry_key.rb +0 -2
- data/lib/chef/provider/remote_directory.rb +0 -1
- data/lib/chef/provider/remote_file.rb +0 -1
- data/lib/chef/provider/remote_file/cache_control_data.rb +1 -3
- data/lib/chef/provider/remote_file/content.rb +0 -1
- data/lib/chef/provider/remote_file/fetcher.rb +0 -2
- data/lib/chef/provider/remote_file/ftp.rb +0 -1
- data/lib/chef/provider/resource_update.rb +0 -3
- data/lib/chef/provider/service/freebsd.rb +0 -3
- data/lib/chef/provider/service/init.rb +0 -3
- data/lib/chef/provider/service/macosx.rb +0 -1
- data/lib/chef/provider/service/redhat.rb +0 -2
- data/lib/chef/provider/service/simple.rb +0 -3
- data/lib/chef/provider/service/solaris.rb +0 -3
- data/lib/chef/provider/service/systemd.rb +15 -14
- data/lib/chef/provider/service/windows.rb +0 -3
- data/lib/chef/provider/subversion.rb +0 -2
- data/lib/chef/provider/template.rb +0 -2
- data/lib/chef/provider/template/content.rb +0 -1
- data/lib/chef/provider/user/dscl.rb +156 -549
- data/lib/chef/provider/user/solaris.rb +0 -1
- data/lib/chef/provider/user/useradd.rb +0 -3
- data/lib/chef/provider/whyrun_safe_ruby_block.rb +1 -1
- data/lib/chef/providers.rb +0 -1
- data/lib/chef/resource.rb +1 -4
- data/lib/chef/resource/freebsd_package.rb +2 -10
- data/lib/chef/resource/lwrp_base.rb +1 -12
- data/lib/chef/resource/user.rb +0 -18
- data/lib/chef/resource_collection.rb +1 -1
- data/lib/chef/resource_reporter.rb +10 -10
- data/lib/chef/resources.rb +0 -1
- data/lib/chef/role.rb +3 -3
- data/lib/chef/run_list.rb +1 -1
- data/lib/chef/tasks/chef_repo.rake +131 -264
- data/lib/chef/user.rb +1 -1
- data/lib/chef/util/path_helper.rb +2 -2
- data/lib/chef/version.rb +9 -1
- data/lib/chef/win32/api/system.rb +0 -9
- data/spec/data/bootstrap/test-hints.erb +1 -1
- data/spec/data/bootstrap/test.erb +1 -1
- data/spec/functional/dsl/reboot_pending_spec.rb +53 -58
- data/spec/functional/knife/cookbook_delete_spec.rb +3 -3
- data/spec/functional/knife/exec_spec.rb +1 -1
- data/spec/functional/mixin/shell_out_spec.rb +48 -0
- data/spec/functional/resource/base.rb +0 -10
- data/spec/functional/resource/group_spec.rb +1 -5
- data/spec/functional/resource/link_spec.rb +8 -0
- data/spec/functional/resource/{user/useradd_spec.rb → user_spec.rb} +1 -1
- data/spec/integration/knife/chef_fs_data_store_spec.rb +3 -3
- data/spec/integration/knife/chef_repo_path_spec.rb +1 -6
- data/spec/integration/knife/chef_repository_file_system_spec.rb +1 -1
- data/spec/integration/knife/chefignore_spec.rb +1 -1
- data/spec/integration/knife/common_options_spec.rb +50 -3
- data/spec/integration/knife/cookbook_api_ipv6_spec.rb +1 -1
- data/spec/integration/knife/delete_spec.rb +1 -1
- data/spec/integration/knife/deps_spec.rb +1 -1
- data/spec/integration/knife/diff_spec.rb +3 -3
- data/spec/integration/knife/download_spec.rb +3 -3
- data/spec/integration/knife/list_spec.rb +1 -1
- data/spec/integration/knife/raw_spec.rb +1 -11
- data/spec/integration/knife/redirection_spec.rb +1 -1
- data/spec/integration/knife/serve_spec.rb +2 -2
- data/spec/integration/knife/show_spec.rb +1 -1
- data/spec/integration/knife/upload_spec.rb +9 -9
- data/spec/spec_helper.rb +0 -9
- data/spec/support/pedant/pedant_config.rb +2 -1
- data/spec/support/pedant/run_pedant.rb +2 -1
- data/spec/support/platform_helpers.rb +5 -24
- data/spec/support/shared/integration/integration_helper.rb +2 -1
- data/spec/support/shared/matchers.rb +17 -0
- data/spec/tiny_server.rb +1 -2
- data/spec/unit/api_client_spec.rb +3 -3
- data/spec/unit/application_spec.rb +9 -32
- data/spec/unit/config_fetcher_spec.rb +1 -1
- data/spec/unit/cookbook/metadata_spec.rb +3 -7
- data/spec/unit/cookbook/synchronizer_spec.rb +441 -226
- data/spec/unit/cookbook_loader_spec.rb +1 -1
- data/spec/unit/cookbook_uploader_spec.rb +160 -0
- data/spec/unit/cookbook_version_spec.rb +0 -4
- data/spec/unit/data_bag_item_spec.rb +1 -5
- data/spec/unit/data_bag_spec.rb +1 -5
- data/spec/unit/deprecation_spec.rb +1 -1
- data/spec/unit/dsl/recipe_spec.rb +12 -0
- data/spec/unit/encrypted_data_bag_item_spec.rb +7 -14
- data/spec/unit/environment_spec.rb +3 -7
- data/spec/unit/exceptions_spec.rb +0 -6
- data/spec/unit/http/json_input_spec.rb +128 -0
- data/spec/unit/json_compat_spec.rb +17 -58
- data/spec/unit/knife/client_create_spec.rb +3 -3
- data/spec/unit/knife/configure_client_spec.rb +6 -5
- data/spec/unit/knife/cookbook_delete_spec.rb +1 -1
- data/spec/unit/knife/cookbook_download_spec.rb +5 -5
- data/spec/unit/knife/cookbook_metadata_from_file_spec.rb +1 -0
- data/spec/unit/knife/cookbook_metadata_spec.rb +1 -1
- data/spec/unit/knife/cookbook_site_download_spec.rb +10 -11
- data/spec/unit/knife/cookbook_site_install_spec.rb +116 -161
- data/spec/unit/knife/cookbook_site_share_spec.rb +8 -8
- data/spec/unit/knife/cookbook_upload_spec.rb +3 -2
- data/spec/unit/knife/core/bootstrap_context_spec.rb +3 -3
- data/spec/unit/knife/core/subcommand_loader_spec.rb +1 -66
- data/spec/unit/knife/data_bag_from_file_spec.rb +2 -1
- data/spec/unit/knife/tag_create_spec.rb +3 -3
- data/spec/unit/knife/tag_delete_spec.rb +3 -3
- data/spec/unit/knife/user_create_spec.rb +1 -1
- data/spec/unit/knife_spec.rb +14 -14
- data/spec/unit/lwrp_spec.rb +1 -21
- data/spec/unit/mixin/shell_out_spec.rb +92 -0
- data/spec/unit/node_spec.rb +0 -4
- data/spec/unit/platform/query_helpers_spec.rb +0 -23
- data/spec/unit/provider/env/windows_spec.rb +34 -70
- data/spec/unit/provider/env_spec.rb +11 -76
- data/spec/unit/provider/group/dscl_spec.rb +1 -38
- data/spec/unit/provider/log_spec.rb +18 -0
- data/spec/unit/provider/package/rpm_spec.rb +0 -12
- data/spec/unit/provider/remote_file/cache_control_data_spec.rb +1 -1
- data/spec/unit/provider/service/systemd_service_spec.rb +44 -27
- data/spec/unit/provider/user/dscl_spec.rb +264 -660
- data/spec/unit/provider/user/useradd_spec.rb +0 -1
- data/spec/unit/provider/whyrun_safe_ruby_block_spec.rb +2 -2
- data/spec/unit/provider_spec.rb +12 -0
- data/spec/unit/recipe_spec.rb +0 -41
- data/spec/unit/resource_collection_spec.rb +1 -5
- data/spec/unit/resource_reporter_spec.rb +3 -51
- data/spec/unit/resource_spec.rb +3 -14
- data/spec/unit/rest_spec.rb +1 -4
- data/spec/unit/role_spec.rb +0 -10
- data/spec/unit/run_list_spec.rb +1 -5
- data/spec/unit/user_spec.rb +1 -5
- metadata +20 -100
- data/lib/chef/mixin/windows_env_helper.rb +0 -56
- data/lib/chef/provider/dsc_script.rb +0 -175
- data/lib/chef/resource/dsc_script.rb +0 -126
- data/lib/chef/streaming_cookbook_uploader.rb +0 -205
- data/lib/chef/util/dsc/configuration_generator.rb +0 -115
- data/lib/chef/util/dsc/lcm_output_parser.rb +0 -133
- data/lib/chef/util/dsc/local_configuration_manager.rb +0 -141
- data/lib/chef/util/dsc/resource_info.rb +0 -26
- data/lib/chef/util/powershell/cmdlet.rb +0 -136
- data/lib/chef/util/powershell/cmdlet_result.rb +0 -46
- data/spec/data/mac_users/10.7-8.plist.xml +0 -559
- data/spec/data/mac_users/10.7-8.shadow.xml +0 -11
- data/spec/data/mac_users/10.7.plist.xml +0 -559
- data/spec/data/mac_users/10.7.shadow.xml +0 -11
- data/spec/data/mac_users/10.8.plist.xml +0 -559
- data/spec/data/mac_users/10.8.shadow.xml +0 -21
- data/spec/data/mac_users/10.9.plist.xml +0 -560
- data/spec/data/mac_users/10.9.shadow.xml +0 -21
- data/spec/functional/provider/whyrun_safe_ruby_block_spec.rb +0 -51
- data/spec/functional/resource/dsc_script_spec.rb +0 -382
- data/spec/functional/resource/env_spec.rb +0 -182
- data/spec/functional/resource/user/dscl_spec.rb +0 -199
- data/spec/functional/util/powershell/cmdlet_spec.rb +0 -113
- data/spec/support/lib/chef/resource/zen_follower.rb +0 -46
- data/spec/support/shared/shared_examples.rb +0 -10
- data/spec/unit/chef_fs/data_handler/group_handler_spec.rb +0 -63
- data/spec/unit/formatters/base_spec.rb +0 -48
- data/spec/unit/provider/dsc_script_spec.rb +0 -174
- data/spec/unit/resource/dsc_script_spec.rb +0 -98
- data/spec/unit/util/dsc/configuration_generator_spec.rb +0 -171
- data/spec/unit/util/dsc/lcm_output_parser_spec.rb +0 -169
- data/spec/unit/util/dsc/local_configuration_manager_spec.rb +0 -139
- data/spec/unit/util/powershell/cmdlet_spec.rb +0 -106
data/spec/unit/node_spec.rb
CHANGED
@@ -762,10 +762,6 @@ describe Chef::Node do
|
|
762
762
|
end
|
763
763
|
serialized_node.run_list.should == node.run_list
|
764
764
|
end
|
765
|
-
|
766
|
-
include_examples "to_json equalivent to Chef::JSONCompat.to_json" do
|
767
|
-
let(:subject) { node.from_file(File.expand_path("nodes/test.example.com.rb", CHEF_SPEC_DATA)) }
|
768
|
-
end
|
769
765
|
end
|
770
766
|
|
771
767
|
describe "to_s" do
|
@@ -30,26 +30,3 @@ describe "Chef::Platform#windows_server_2003?" do
|
|
30
30
|
expect { Thread.fork { Chef::Platform.windows_server_2003? }.join }.not_to raise_error
|
31
31
|
end
|
32
32
|
end
|
33
|
-
|
34
|
-
describe 'Chef::Platform#supports_dsc?' do
|
35
|
-
it 'returns false if powershell is not present' do
|
36
|
-
node = Chef::Node.new
|
37
|
-
Chef::Platform.supports_dsc?(node).should be_false
|
38
|
-
end
|
39
|
-
|
40
|
-
['1.0', '2.0', '3.0'].each do |version|
|
41
|
-
it "returns false for Powershell #{version}" do
|
42
|
-
node = Chef::Node.new
|
43
|
-
node.automatic[:languages][:powershell][:version] = version
|
44
|
-
Chef::Platform.supports_dsc?(node).should be_false
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
['4.0', '5.0'].each do |version|
|
49
|
-
it "returns true for Powershell #{version}" do
|
50
|
-
node = Chef::Node.new
|
51
|
-
node.automatic[:languages][:powershell][:version] = version
|
52
|
-
Chef::Platform.supports_dsc?(node).should be_true
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
@@ -19,85 +19,49 @@
|
|
19
19
|
require 'spec_helper'
|
20
20
|
|
21
21
|
describe Chef::Provider::Env::Windows, :windows_only do
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
}
|
32
|
-
let(:provider) {
|
33
|
-
provider = Chef::Provider::Env::Windows.new(new_resource, run_context)
|
34
|
-
provider.stub(:env_obj).and_return(double('null object').as_null_object)
|
35
|
-
provider
|
36
|
-
}
|
37
|
-
|
38
|
-
describe "action_create" do
|
39
|
-
before do
|
40
|
-
ENV.delete('CHEF_WINDOWS_ENV_TEST')
|
41
|
-
provider.key_exists = false
|
42
|
-
end
|
22
|
+
before do
|
23
|
+
@node = Chef::Node.new
|
24
|
+
@events = Chef::EventDispatch::Dispatcher.new
|
25
|
+
@run_context = Chef::RunContext.new(@node, {}, @events)
|
26
|
+
@new_resource = Chef::Resource::Env.new("CHEF_WINDOWS_ENV_TEST")
|
27
|
+
@new_resource.value("foo")
|
28
|
+
@provider = Chef::Provider::Env::Windows.new(@new_resource, @run_context)
|
29
|
+
@provider.stub(:env_obj).and_return(double('null object').as_null_object)
|
30
|
+
end
|
43
31
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
32
|
+
describe "action_create" do
|
33
|
+
before do
|
34
|
+
ENV.delete('CHEF_WINDOWS_ENV_TEST')
|
35
|
+
@provider.key_exists = false
|
48
36
|
end
|
49
37
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
end
|
54
|
-
|
55
|
-
it "should update the ruby ENV object when it updates the value" do
|
56
|
-
provider.should_receive(:requires_modify_or_create?).and_return(true)
|
57
|
-
new_resource.value("foobar")
|
58
|
-
provider.action_modify
|
59
|
-
expect(ENV['CHEF_WINDOWS_ENV_TEST']).to eql('foobar')
|
60
|
-
end
|
61
|
-
|
62
|
-
describe "action_delete" do
|
63
|
-
before do
|
64
|
-
ENV['CHEF_WINDOWS_ENV_TEST'] = 'foo'
|
65
|
-
end
|
66
|
-
|
67
|
-
it "should update the ruby ENV object when it deletes the key" do
|
68
|
-
provider.action_delete
|
69
|
-
expect(ENV['CHEF_WINDOWS_ENV_TEST']).to eql(nil)
|
70
|
-
end
|
71
|
-
end
|
38
|
+
it "should update the ruby ENV object when it creates the key" do
|
39
|
+
@provider.action_create
|
40
|
+
expect(ENV['CHEF_WINDOWS_ENV_TEST']).to eql('foo')
|
72
41
|
end
|
73
42
|
end
|
74
43
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
let(:new_resource) {
|
80
|
-
new_resource = Chef::Resource::Env.new('PATH')
|
81
|
-
new_resource.value(system_root)
|
82
|
-
new_resource
|
83
|
-
}
|
84
|
-
let(:provider) {
|
85
|
-
provider = Chef::Provider::Env::Windows.new(new_resource, run_context)
|
86
|
-
provider.stub(:env_obj).and_return(double('null object').as_null_object)
|
87
|
-
provider
|
88
|
-
}
|
44
|
+
describe "action_modify" do
|
45
|
+
before do
|
46
|
+
ENV['CHEF_WINDOWS_ENV_TEST'] = 'foo'
|
47
|
+
end
|
89
48
|
|
90
|
-
|
91
|
-
|
92
|
-
|
49
|
+
it "should update the ruby ENV object when it updates the value" do
|
50
|
+
@provider.should_receive(:compare_value).and_return(true)
|
51
|
+
@new_resource.value("foobar")
|
52
|
+
@provider.action_modify
|
53
|
+
expect(ENV['CHEF_WINDOWS_ENV_TEST']).to eql('foobar')
|
54
|
+
end
|
55
|
+
end
|
93
56
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
provider.action_modify
|
98
|
-
expect(ENV['PATH']).to eql(system_root_value)
|
99
|
-
end
|
57
|
+
describe "action_delete" do
|
58
|
+
before do
|
59
|
+
ENV['CHEF_WINDOWS_ENV_TEST'] = 'foo'
|
100
60
|
end
|
101
61
|
|
62
|
+
it "should update the ruby ENV object when it deletes the key" do
|
63
|
+
@provider.action_delete
|
64
|
+
expect(ENV['CHEF_WINDOWS_ENV_TEST']).to eql(nil)
|
65
|
+
end
|
102
66
|
end
|
103
67
|
end
|
@@ -88,20 +88,20 @@ describe Chef::Provider::Env do
|
|
88
88
|
|
89
89
|
it "should check to see if the values are the same if the key exists" do
|
90
90
|
@provider.key_exists = true
|
91
|
-
@provider.should_receive(:
|
91
|
+
@provider.should_receive(:compare_value).and_return(false)
|
92
92
|
@provider.action_create
|
93
93
|
end
|
94
94
|
|
95
95
|
it "should call modify_env if the key exists and values are not equal" do
|
96
96
|
@provider.key_exists = true
|
97
|
-
@provider.stub(:
|
97
|
+
@provider.stub(:compare_value).and_return(true)
|
98
98
|
@provider.should_receive(:modify_env).and_return(true)
|
99
99
|
@provider.action_create
|
100
100
|
end
|
101
101
|
|
102
102
|
it "should set the new_resources updated flag when it updates an existing value" do
|
103
103
|
@provider.key_exists = true
|
104
|
-
@provider.stub(:
|
104
|
+
@provider.stub(:compare_value).and_return(true)
|
105
105
|
@provider.stub(:modify_env).and_return(true)
|
106
106
|
@provider.action_create
|
107
107
|
@new_resource.should be_updated
|
@@ -147,20 +147,20 @@ describe Chef::Provider::Env do
|
|
147
147
|
end
|
148
148
|
|
149
149
|
it "should call modify_group if the key exists and values are not equal" do
|
150
|
-
@provider.should_receive(:
|
150
|
+
@provider.should_receive(:compare_value).and_return(true)
|
151
151
|
@provider.should_receive(:modify_env).and_return(true)
|
152
152
|
@provider.action_modify
|
153
153
|
end
|
154
154
|
|
155
155
|
it "should set the new resources updated flag to true if modify_env is called" do
|
156
|
-
@provider.stub(:
|
156
|
+
@provider.stub(:compare_value).and_return(true)
|
157
157
|
@provider.stub(:modify_env).and_return(true)
|
158
158
|
@provider.action_modify
|
159
159
|
@new_resource.should be_updated
|
160
160
|
end
|
161
161
|
|
162
162
|
it "should not call modify_env if the key exists but the values are equal" do
|
163
|
-
@provider.should_receive(:
|
163
|
+
@provider.should_receive(:compare_value).and_return(false)
|
164
164
|
@provider.should_not_receive(:modify_env)
|
165
165
|
@provider.action_modify
|
166
166
|
end
|
@@ -198,31 +198,9 @@ describe Chef::Provider::Env do
|
|
198
198
|
@provider.delete_element.should eql(true)
|
199
199
|
@new_resource.should be_updated
|
200
200
|
end
|
201
|
-
|
202
|
-
context "when new_resource's value contains the delimiter" do
|
203
|
-
it "should return false if all the elements are deleted" do
|
204
|
-
# This indicates that the entire key needs to be deleted
|
205
|
-
@new_resource.value("C:/foo/bin;C:/bar/bin")
|
206
|
-
@provider.delete_element.should eql(false)
|
207
|
-
@new_resource.should_not be_updated # This will be updated in action_delete
|
208
|
-
end
|
209
|
-
|
210
|
-
it "should return true if any, but not all, of the elements are deleted" do
|
211
|
-
@new_resource.value("C:/foo/bin;C:/notbaz/bin")
|
212
|
-
@provider.should_receive(:create_env)
|
213
|
-
@provider.delete_element.should eql(true)
|
214
|
-
@new_resource.should be_updated
|
215
|
-
end
|
216
|
-
|
217
|
-
it "should return true if none of the elements are deleted" do
|
218
|
-
@new_resource.value("C:/notfoo/bin;C:/notbaz/bin")
|
219
|
-
@provider.delete_element.should eql(true)
|
220
|
-
@new_resource.should_not be_updated
|
221
|
-
end
|
222
|
-
end
|
223
201
|
end
|
224
202
|
|
225
|
-
describe "
|
203
|
+
describe "compare_value" do
|
226
204
|
before(:each) do
|
227
205
|
@new_resource.value("C:/bar")
|
228
206
|
@current_resource = @new_resource.clone
|
@@ -230,68 +208,25 @@ describe Chef::Provider::Env do
|
|
230
208
|
end
|
231
209
|
|
232
210
|
it "should return false if the values are equal" do
|
233
|
-
@provider.
|
211
|
+
@provider.compare_value.should be_false
|
234
212
|
end
|
235
213
|
|
236
214
|
it "should return true if the values not are equal" do
|
237
215
|
@new_resource.value("C:/elsewhere")
|
238
|
-
@provider.
|
216
|
+
@provider.compare_value.should be_true
|
239
217
|
end
|
240
218
|
|
241
219
|
it "should return false if the current value contains the element" do
|
242
220
|
@new_resource.delim(";")
|
243
221
|
@current_resource.value("C:/bar;C:/foo;C:/baz")
|
244
222
|
|
245
|
-
@provider.
|
223
|
+
@provider.compare_value.should be_false
|
246
224
|
end
|
247
225
|
|
248
226
|
it "should return true if the current value does not contain the element" do
|
249
227
|
@new_resource.delim(";")
|
250
228
|
@current_resource.value("C:/biz;C:/foo/bin;C:/baz")
|
251
|
-
@provider.
|
252
|
-
end
|
253
|
-
|
254
|
-
context "when new_resource's value contains the delimiter" do
|
255
|
-
it "should return false if all the current values are contained" do
|
256
|
-
@new_resource.value("C:/biz;C:/baz")
|
257
|
-
@new_resource.delim(";")
|
258
|
-
@current_resource.value("C:/biz;C:/foo/bin;C:/baz")
|
259
|
-
@provider.requires_modify_or_create?.should be_false
|
260
|
-
end
|
261
|
-
|
262
|
-
it "should return true if any of the new values are not contained" do
|
263
|
-
@new_resource.value("C:/biz;C:/baz;C:/bin")
|
264
|
-
@new_resource.delim(";")
|
265
|
-
@current_resource.value("C:/biz;C:/foo/bin;C:/baz")
|
266
|
-
@provider.requires_modify_or_create?.should be_true
|
267
|
-
end
|
268
|
-
end
|
269
|
-
end
|
270
|
-
|
271
|
-
describe "modify_env" do
|
272
|
-
before(:each) do
|
273
|
-
@provider.stub(:create_env).and_return(true)
|
274
|
-
@new_resource.delim ";"
|
275
|
-
|
276
|
-
@current_resource = Chef::Resource::Env.new("FOO")
|
277
|
-
@current_resource.value "C:/foo/bin"
|
278
|
-
@provider.current_resource = @current_resource
|
279
|
-
end
|
280
|
-
|
281
|
-
it "should not modify the variable passed to the resource" do
|
282
|
-
new_value = "C:/bar/bin"
|
283
|
-
passed_value = new_value.dup
|
284
|
-
@new_resource.value(passed_value)
|
285
|
-
@provider.modify_env
|
286
|
-
passed_value.should == new_value
|
287
|
-
end
|
288
|
-
|
289
|
-
it "should only add values not already contained when a delimiter is provided" do
|
290
|
-
@new_resource.value("C:/foo;C:/bar;C:/baz")
|
291
|
-
@new_resource.delim(";")
|
292
|
-
@current_resource.value("C:/foo/bar;C:/bar;C:/baz")
|
293
|
-
@provider.modify_env
|
294
|
-
@new_resource.value.should eq("C:/foo;C:/foo/bar;C:/bar;C:/baz")
|
229
|
+
@provider.compare_value.should be_true
|
295
230
|
end
|
296
231
|
end
|
297
232
|
end
|
@@ -240,7 +240,6 @@ describe Chef::Provider::Group::Dscl do
|
|
240
240
|
@provider.load_current_resource
|
241
241
|
@provider.define_resource_requirements
|
242
242
|
end
|
243
|
-
|
244
243
|
it "raises an error if the required binary /usr/bin/dscl doesn't exist" do
|
245
244
|
File.should_receive(:exists?).with("/usr/bin/dscl").and_return(false)
|
246
245
|
|
@@ -252,7 +251,7 @@ describe Chef::Provider::Group::Dscl do
|
|
252
251
|
lambda { @provider.process_resource_requirements }.should_not raise_error
|
253
252
|
end
|
254
253
|
end
|
255
|
-
|
254
|
+
|
256
255
|
describe "when creating the group" do
|
257
256
|
it "creates the group, password field, gid, and sets group membership" do
|
258
257
|
@provider.should_receive(:set_gid).and_return(true)
|
@@ -295,39 +294,3 @@ describe Chef::Provider::Group::Dscl do
|
|
295
294
|
end
|
296
295
|
end
|
297
296
|
end
|
298
|
-
|
299
|
-
describe 'Test DSCL loading' do
|
300
|
-
before do
|
301
|
-
@node = Chef::Node.new
|
302
|
-
@events = Chef::EventDispatch::Dispatcher.new
|
303
|
-
@run_context = Chef::RunContext.new(@node, {}, @events)
|
304
|
-
@new_resource = Chef::Resource::Group.new("aj")
|
305
|
-
@provider = Chef::Provider::Group::Dscl.new(@new_resource, @run_context)
|
306
|
-
@output = <<-EOF
|
307
|
-
AppleMetaNodeLocation: /Local/Default
|
308
|
-
Comment:
|
309
|
-
Test Group
|
310
|
-
GeneratedUID: AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA
|
311
|
-
NestedGroups: AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAB
|
312
|
-
Password: *
|
313
|
-
PrimaryGroupID: 999
|
314
|
-
RealName:
|
315
|
-
TestGroup
|
316
|
-
RecordName: com.apple.aj
|
317
|
-
RecordType: dsRecTypeStandard:Groups
|
318
|
-
GroupMembership: waka bar
|
319
|
-
EOF
|
320
|
-
@provider.stub(:safe_dscl).with("read /Groups/aj").and_return(@output)
|
321
|
-
@current_resource = @provider.load_current_resource
|
322
|
-
|
323
|
-
end
|
324
|
-
|
325
|
-
it 'should parse gid properly' do
|
326
|
-
File.stub(:exists?).and_return(true)
|
327
|
-
@current_resource.gid.should eq("999")
|
328
|
-
end
|
329
|
-
it 'should parse members properly' do
|
330
|
-
File.stub(:exists?).and_return(true)
|
331
|
-
@current_resource.members.should eq(['waka', 'bar'])
|
332
|
-
end
|
333
|
-
end
|
@@ -78,4 +78,22 @@ describe Chef::Provider::Log::ChefLog do
|
|
78
78
|
@provider.action_write
|
79
79
|
end
|
80
80
|
|
81
|
+
it "should not update the resource if the message was not written to the log" do
|
82
|
+
Chef::Log.level = :fatal
|
83
|
+
@new_resource = Chef::Resource::Log.new(@log_str)
|
84
|
+
@new_resource.level :info
|
85
|
+
@provider = Chef::Provider::Log::ChefLog.new(@new_resource, @run_context)
|
86
|
+
@provider.action_write
|
87
|
+
@new_resource.updated.should be_false
|
88
|
+
end
|
89
|
+
|
90
|
+
it "should update the resource if the message has been written to the log" do
|
91
|
+
Chef::Log.level = :debug
|
92
|
+
@new_resource = Chef::Resource::Log.new(@log_str)
|
93
|
+
@new_resource.level :info
|
94
|
+
@provider = Chef::Provider::Log::ChefLog.new(@new_resource, @run_context)
|
95
|
+
@provider.action_write
|
96
|
+
@new_resource.updated.should be_true
|
97
|
+
end
|
98
|
+
|
81
99
|
end
|
@@ -80,18 +80,6 @@ describe Chef::Provider::Package::Rpm do
|
|
80
80
|
@provider.stub(:popen4).and_return(status)
|
81
81
|
lambda { @provider.run_action(:any) }.should raise_error(Chef::Exceptions::Package)
|
82
82
|
end
|
83
|
-
|
84
|
-
it "should not detect the package name as version when not installed" do
|
85
|
-
@status = double("Status", :exitstatus => -1)
|
86
|
-
@stdout = StringIO.new("package openssh-askpass is not installed")
|
87
|
-
@new_resource = Chef::Resource::Package.new("openssh-askpass")
|
88
|
-
@new_resource.source 'openssh-askpass'
|
89
|
-
@provider = Chef::Provider::Package::Rpm.new(@new_resource, @run_context)
|
90
|
-
@provider.should_receive(:popen4).with("rpm -qp --queryformat '%{NAME} %{VERSION}-%{RELEASE}\n' openssh-askpass").and_yield(@pid, @stdin, @stdout, @stderr).and_return(@status)
|
91
|
-
@provider.should_receive(:popen4).with("rpm -q --queryformat '%{NAME} %{VERSION}-%{RELEASE}\n' openssh-askpass").and_return(@status)
|
92
|
-
@provider.load_current_resource
|
93
|
-
@provider.current_resource.version.should be_nil
|
94
|
-
end
|
95
83
|
end
|
96
84
|
|
97
85
|
describe "after the current resource is loaded" do
|
@@ -25,6 +25,11 @@ describe Chef::Provider::Service::Systemd do
|
|
25
25
|
@run_context = Chef::RunContext.new(@node, {}, @events)
|
26
26
|
@new_resource = Chef::Resource::Service.new('rsyslog.service')
|
27
27
|
@provider = Chef::Provider::Service::Systemd.new(@new_resource, @run_context)
|
28
|
+
|
29
|
+
@shell_out_success = double('shell_out_with_systems_locale',
|
30
|
+
:exitstatus => 0, :error? => false)
|
31
|
+
@shell_out_failure = double('shell_out_with_systems_locale',
|
32
|
+
:exitstatus => 1, :error? => true)
|
28
33
|
end
|
29
34
|
|
30
35
|
describe "load_current_resource" do
|
@@ -69,25 +74,25 @@ describe Chef::Provider::Service::Systemd do
|
|
69
74
|
end
|
70
75
|
|
71
76
|
it "should run the services status command if one has been specified" do
|
72
|
-
@provider.stub(:
|
77
|
+
@provider.stub(:shell_out_with_systems_locale).and_return(@shell_out_success)
|
73
78
|
@current_resource.should_receive(:running).with(true)
|
74
79
|
@provider.load_current_resource
|
75
80
|
end
|
76
81
|
|
77
82
|
it "should run the services status command if one has been specified and properly set status check state" do
|
78
|
-
@provider.stub(:
|
83
|
+
@provider.stub(:shell_out_with_systems_locale).with("/bin/chefhasmonkeypants status").and_return(@shell_out_success)
|
79
84
|
@provider.load_current_resource
|
80
85
|
@provider.instance_variable_get("@status_check_success").should be_true
|
81
86
|
end
|
82
87
|
|
83
|
-
it "should set running to false if
|
84
|
-
@provider.stub(:
|
88
|
+
it "should set running to false if a status command fails" do
|
89
|
+
@provider.stub(:shell_out_with_systems_locale).and_return(@shell_out_failure)
|
85
90
|
@current_resource.should_receive(:running).with(false)
|
86
91
|
@provider.load_current_resource
|
87
92
|
end
|
88
93
|
|
89
|
-
it "should update state to indicate status check failed when
|
90
|
-
@provider.stub(:
|
94
|
+
it "should update state to indicate status check failed when a status command fails" do
|
95
|
+
@provider.stub(:shell_out_with_systems_locale).and_return(@shell_out_failure)
|
91
96
|
@provider.load_current_resource
|
92
97
|
@provider.instance_variable_get("@status_check_success").should be_false
|
93
98
|
end
|
@@ -129,13 +134,13 @@ describe Chef::Provider::Service::Systemd do
|
|
129
134
|
end
|
130
135
|
|
131
136
|
it "should call '/bin/systemctl start service_name' if no start command is specified" do
|
132
|
-
@provider.should_receive(:
|
137
|
+
@provider.should_receive(:shell_out_with_systems_locale).with("/bin/systemctl start #{@new_resource.service_name}").and_return(@shell_out_success)
|
133
138
|
@provider.start_service
|
134
139
|
end
|
135
140
|
|
136
141
|
it "should not call '/bin/systemctl start service_name' if it is already running" do
|
137
142
|
@current_resource.stub(:running).and_return(true)
|
138
|
-
@provider.should_not_receive(:
|
143
|
+
@provider.should_not_receive(:shell_out_with_systems_locale).with("/bin/systemctl start #{@new_resource.service_name}")
|
139
144
|
@provider.start_service
|
140
145
|
end
|
141
146
|
|
@@ -148,21 +153,33 @@ describe Chef::Provider::Service::Systemd do
|
|
148
153
|
|
149
154
|
it "should call '/bin/systemctl restart service_name' if no restart command is specified" do
|
150
155
|
@current_resource.stub(:running).and_return(true)
|
151
|
-
@provider.should_receive(:
|
156
|
+
@provider.should_receive(:shell_out_with_systems_locale).with("/bin/systemctl restart #{@new_resource.service_name}").and_return(@shell_out_success)
|
152
157
|
@provider.restart_service
|
153
158
|
end
|
154
159
|
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
160
|
+
describe "reload service" do
|
161
|
+
context "when a reload command is specified" do
|
162
|
+
it "should call the reload command" do
|
163
|
+
@current_resource.stub(:running).and_return(true)
|
164
|
+
@new_resource.stub(:reload_command).and_return("/sbin/rsyslog reloadyousillysally")
|
165
|
+
@provider.should_receive(:shell_out!).with("/sbin/rsyslog reloadyousillysally")
|
166
|
+
@provider.reload_service
|
167
|
+
end
|
168
|
+
end
|
161
169
|
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
170
|
+
context "when a reload command is not specified" do
|
171
|
+
it "should call '/bin/systemctl reload service_name' if the service is running" do
|
172
|
+
@current_resource.stub(:running).and_return(true)
|
173
|
+
@provider.should_receive(:shell_out_with_systems_locale).with("/bin/systemctl reload #{@new_resource.service_name}").and_return(@shell_out_success)
|
174
|
+
@provider.reload_service
|
175
|
+
end
|
176
|
+
|
177
|
+
it "should start the service if the service is not running" do
|
178
|
+
@current_resource.stub(:running).and_return(false)
|
179
|
+
@provider.should_receive(:start_service).and_return(true)
|
180
|
+
@provider.reload_service
|
181
|
+
end
|
182
|
+
end
|
166
183
|
end
|
167
184
|
|
168
185
|
it "should call the stop command if one is specified" do
|
@@ -174,13 +191,13 @@ describe Chef::Provider::Service::Systemd do
|
|
174
191
|
|
175
192
|
it "should call '/bin/systemctl stop service_name' if no stop command is specified" do
|
176
193
|
@current_resource.stub(:running).and_return(true)
|
177
|
-
@provider.should_receive(:
|
194
|
+
@provider.should_receive(:shell_out_with_systems_locale).with("/bin/systemctl stop #{@new_resource.service_name}").and_return(@shell_out_success)
|
178
195
|
@provider.stop_service
|
179
196
|
end
|
180
197
|
|
181
198
|
it "should not call '/bin/systemctl stop service_name' if it is already stopped" do
|
182
199
|
@current_resource.stub(:running).and_return(false)
|
183
|
-
@provider.should_not_receive(:
|
200
|
+
@provider.should_not_receive(:shell_out_with_systems_locale).with("/bin/systemctl stop #{@new_resource.service_name}")
|
184
201
|
@provider.stop_service
|
185
202
|
end
|
186
203
|
end
|
@@ -193,12 +210,12 @@ describe Chef::Provider::Service::Systemd do
|
|
193
210
|
end
|
194
211
|
|
195
212
|
it "should call '/bin/systemctl enable service_name' to enable the service" do
|
196
|
-
@provider.should_receive(:
|
213
|
+
@provider.should_receive(:shell_out_with_systems_locale).with("/bin/systemctl enable #{@new_resource.service_name}").and_return(@shell_out_success)
|
197
214
|
@provider.enable_service
|
198
215
|
end
|
199
216
|
|
200
217
|
it "should call '/bin/systemctl disable service_name' to disable the service" do
|
201
|
-
@provider.should_receive(:
|
218
|
+
@provider.should_receive(:shell_out_with_systems_locale).with("/bin/systemctl disable #{@new_resource.service_name}").and_return(@shell_out_success)
|
202
219
|
@provider.disable_service
|
203
220
|
end
|
204
221
|
end
|
@@ -210,12 +227,12 @@ describe Chef::Provider::Service::Systemd do
|
|
210
227
|
end
|
211
228
|
|
212
229
|
it "should return true if '/bin/systemctl is-active service_name' returns 0" do
|
213
|
-
@provider.should_receive(:
|
230
|
+
@provider.should_receive(:shell_out_with_systems_locale).with('/bin/systemctl is-active rsyslog.service --quiet').and_return(@shell_out_success)
|
214
231
|
@provider.is_active?.should be_true
|
215
232
|
end
|
216
233
|
|
217
234
|
it "should return false if '/bin/systemctl is-active service_name' returns anything except 0" do
|
218
|
-
@provider.should_receive(:
|
235
|
+
@provider.should_receive(:shell_out_with_systems_locale).with('/bin/systemctl is-active rsyslog.service --quiet').and_return(@shell_out_failure)
|
219
236
|
@provider.is_active?.should be_false
|
220
237
|
end
|
221
238
|
end
|
@@ -227,12 +244,12 @@ describe Chef::Provider::Service::Systemd do
|
|
227
244
|
end
|
228
245
|
|
229
246
|
it "should return true if '/bin/systemctl is-enabled service_name' returns 0" do
|
230
|
-
@provider.should_receive(:
|
247
|
+
@provider.should_receive(:shell_out_with_systems_locale).with('/bin/systemctl is-enabled rsyslog.service --quiet').and_return(@shell_out_success)
|
231
248
|
@provider.is_enabled?.should be_true
|
232
249
|
end
|
233
250
|
|
234
251
|
it "should return false if '/bin/systemctl is-enabled service_name' returns anything except 0" do
|
235
|
-
@provider.should_receive(:
|
252
|
+
@provider.should_receive(:shell_out_with_systems_locale).with('/bin/systemctl is-enabled rsyslog.service --quiet').and_return(@shell_out_failure)
|
236
253
|
@provider.is_enabled?.should be_false
|
237
254
|
end
|
238
255
|
end
|