chef 13.6.4-universal-mingw32 → 13.7.16-universal-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 +5 -5
- data/VERSION +1 -1
- data/acceptance/Gemfile +2 -2
- data/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/libraries/top_cookbooks.rb +1 -6
- data/distro/powershell/chef/chef.psm1 +1 -5
- data/lib/chef/api_client.rb +5 -5
- data/lib/chef/api_client_v1.rb +6 -6
- data/lib/chef/application.rb +3 -2
- data/lib/chef/application/knife.rb +4 -0
- data/lib/chef/chef_class.rb +2 -2
- data/lib/chef/chef_fs/data_handler/data_bag_item_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/data_handler_base.rb +2 -4
- data/lib/chef/client.rb +3 -3
- data/lib/chef/cookbook/chefignore.rb +4 -0
- data/lib/chef/cookbook/cookbook_collection.rb +2 -2
- data/lib/chef/cookbook/metadata.rb +2 -2
- data/lib/chef/data_bag.rb +1 -1
- data/lib/chef/deprecated.rb +10 -0
- data/lib/chef/event_dispatch/base.rb +2 -2
- data/lib/chef/http.rb +10 -10
- data/lib/chef/knife.rb +16 -15
- data/lib/chef/knife/configure.rb +12 -36
- data/lib/chef/knife/cookbook_upload.rb +4 -4
- data/lib/chef/knife/core/bootstrap_context.rb +1 -1
- data/lib/chef/knife/core/status_presenter.rb +6 -2
- data/lib/chef/knife/core/ui.rb +1 -1
- data/lib/chef/knife/data_bag_secret_options.rb +1 -1
- data/lib/chef/knife/data_bag_show.rb +1 -1
- data/lib/chef/knife/edit.rb +1 -1
- data/lib/chef/knife/ssh.rb +47 -35
- data/lib/chef/knife/user_create.rb +2 -0
- data/lib/chef/knife/user_delete.rb +2 -0
- data/lib/chef/knife/user_edit.rb +2 -0
- data/lib/chef/knife/user_reregister.rb +2 -0
- data/lib/chef/knife/user_show.rb +2 -0
- data/lib/chef/mixin/powershell_out.rb +1 -1
- data/lib/chef/node/attribute.rb +46 -70
- data/lib/chef/node/attribute_collections.rb +5 -5
- data/lib/chef/node/common_api.rb +1 -1
- data/lib/chef/node/immutable_collections.rb +180 -23
- data/lib/chef/node/mixin/state_tracking.rb +6 -6
- data/lib/chef/node_map.rb +63 -45
- data/lib/chef/property.rb +8 -8
- data/lib/chef/provider.rb +9 -3
- data/lib/chef/provider/apt_preference.rb +1 -1
- data/lib/chef/provider/apt_repository.rb +1 -1
- data/lib/chef/provider/apt_update.rb +1 -1
- data/lib/chef/provider/file.rb +1 -1
- data/lib/chef/provider/group/dscl.rb +6 -2
- data/lib/chef/provider/ifconfig.rb +96 -34
- data/lib/chef/provider/launchd.rb +0 -1
- data/lib/chef/provider/log.rb +3 -13
- data/lib/chef/provider/package/dnf.rb +1 -1
- data/lib/chef/provider/package/smartos.rb +2 -2
- data/lib/chef/provider/reboot.rb +12 -0
- data/lib/chef/provider/remote_directory.rb +1 -1
- data/lib/chef/provider/remote_file/http.rb +3 -2
- data/lib/chef/provider/service/solaris.rb +6 -2
- data/lib/chef/provider/systemd_unit.rb +34 -33
- data/lib/chef/provider/user/dscl.rb +1 -1
- data/lib/chef/provider/windows_path.rb +6 -7
- data/lib/chef/provider/windows_task.rb +89 -33
- data/lib/chef/provider/yum_repository.rb +24 -9
- data/lib/chef/resource/apt_package.rb +1 -0
- data/lib/chef/resource/apt_preference.rb +4 -0
- data/lib/chef/resource/apt_repository.rb +4 -0
- data/lib/chef/resource/apt_update.rb +3 -0
- data/lib/chef/resource/bash.rb +4 -0
- data/lib/chef/resource/batch.rb +5 -0
- data/lib/chef/resource/bff_package.rb +4 -0
- data/lib/chef/resource/breakpoint.rb +6 -0
- data/lib/chef/resource/cab_package.rb +6 -6
- data/lib/chef/resource/chef_gem.rb +13 -0
- data/lib/chef/resource/chocolatey_package.rb +4 -6
- data/lib/chef/resource/cookbook_file.rb +13 -15
- data/lib/chef/resource/cron.rb +2 -0
- data/lib/chef/resource/csh.rb +4 -0
- data/lib/chef/resource/directory.rb +8 -26
- data/lib/chef/resource/dnf_package.rb +5 -0
- data/lib/chef/resource/dpkg_package.rb +2 -0
- data/lib/chef/resource/dsc_resource.rb +5 -0
- data/lib/chef/resource/dsc_script.rb +6 -0
- data/lib/chef/resource/env.rb +3 -0
- data/lib/chef/resource/erl_call.rb +5 -0
- data/lib/chef/resource/execute.rb +5 -1
- data/lib/chef/resource/file.rb +2 -1
- data/lib/chef/resource/file/verification.rb +10 -0
- data/lib/chef/resource/freebsd_package.rb +10 -2
- data/lib/chef/resource/gem_package.rb +2 -0
- data/lib/chef/resource/git.rb +2 -0
- data/lib/chef/resource/group.rb +1 -0
- data/lib/chef/resource/homebrew_package.rb +3 -0
- data/lib/chef/resource/http_request.rb +2 -0
- data/lib/chef/resource/ifconfig.rb +23 -150
- data/lib/chef/resource/ips_package.rb +1 -0
- data/lib/chef/resource/ksh.rb +6 -0
- data/lib/chef/resource/launchd.rb +5 -4
- data/lib/chef/resource/link.rb +10 -0
- data/lib/chef/resource/log.rb +19 -46
- data/lib/chef/resource/macports_package.rb +1 -0
- data/lib/chef/resource/mdadm.rb +4 -0
- data/lib/chef/resource/mount.rb +1 -0
- data/lib/chef/resource/msu_package.rb +7 -8
- data/lib/chef/resource/ohai.rb +2 -0
- data/lib/chef/resource/openbsd_package.rb +3 -0
- data/lib/chef/resource/osx_profile.rb +10 -40
- data/lib/chef/resource/package.rb +6 -0
- data/lib/chef/resource/pacman_package.rb +1 -0
- data/lib/chef/resource/paludis_package.rb +3 -0
- data/lib/chef/resource/perl.rb +4 -0
- data/lib/chef/resource/portage_package.rb +1 -0
- data/lib/chef/resource/powershell_package.rb +5 -0
- data/lib/chef/resource/powershell_script.rb +8 -0
- data/lib/chef/resource/python.rb +4 -0
- data/lib/chef/resource/reboot.rb +14 -20
- data/lib/chef/resource/registry_key.rb +1 -0
- data/lib/chef/resource/remote_directory.rb +3 -0
- data/lib/chef/resource/remote_file.rb +2 -0
- data/lib/chef/resource/resource_notification.rb +17 -0
- data/lib/chef/resource/route.rb +1 -0
- data/lib/chef/resource/rpm_package.rb +1 -0
- data/lib/chef/resource/ruby.rb +4 -0
- data/lib/chef/resource/ruby_block.rb +3 -0
- data/lib/chef/resource/script.rb +4 -0
- data/lib/chef/resource/service.rb +1 -0
- data/lib/chef/resource/smartos_package.rb +1 -0
- data/lib/chef/resource/solaris_package.rb +1 -0
- data/lib/chef/resource/subversion.rb +1 -0
- data/lib/chef/resource/systemd_unit.rb +6 -0
- data/lib/chef/resource/template.rb +9 -0
- data/lib/chef/resource/user.rb +1 -0
- data/lib/chef/resource/windows_package.rb +2 -0
- data/lib/chef/resource/windows_path.rb +5 -10
- data/lib/chef/resource/windows_service.rb +3 -0
- data/lib/chef/resource/windows_task.rb +66 -87
- data/lib/chef/resource/yum_repository.rb +26 -22
- data/lib/chef/resource/zypper_package.rb +2 -0
- data/lib/chef/resource/zypper_repository.rb +6 -1
- data/lib/chef/run_context.rb +8 -2
- data/lib/chef/server_api.rb +1 -0
- data/lib/chef/util/selinux.rb +5 -4
- data/lib/chef/version.rb +1 -1
- data/lib/chef/version/platform.rb +18 -0
- data/lib/chef/version_constraint/platform.rb +2 -0
- data/spec/data/client.d_00/02-strings.rb +2 -0
- data/spec/functional/assets/chefinittest +6 -4
- data/spec/functional/knife/ssh_spec.rb +54 -7
- data/spec/functional/resource/bff_spec.rb +3 -3
- data/spec/functional/resource/ifconfig_spec.rb +1 -1
- data/spec/functional/resource/mount_spec.rb +7 -3
- data/spec/functional/resource/user/useradd_spec.rb +4 -4
- data/spec/functional/resource/windows_task_spec.rb +6 -6
- data/spec/functional/win32/security_spec.rb +7 -33
- data/spec/integration/knife/data_bag_show_spec.rb +1 -1
- data/spec/integration/recipes/noop_resource_spec.rb +1 -1
- data/spec/integration/recipes/recipe_dsl_spec.rb +30 -30
- data/spec/integration/recipes/resource_action_spec.rb +2 -2
- data/spec/integration/recipes/resource_converge_if_changed_spec.rb +71 -15
- data/spec/spec_helper.rb +19 -0
- data/spec/support/shared/functional/execute_resource.rb +1 -1
- data/spec/support/shared/unit/application_dot_d.rb +2 -0
- data/spec/support/shared/unit/execute_resource.rb +8 -1
- data/spec/support/shared/unit/provider/file.rb +9 -1
- data/spec/unit/chef_fs/data_handler/data_bag_item_data_handler.rb +10 -7
- data/spec/unit/chef_fs/file_system/repository/directory_spec.rb +2 -2
- data/spec/unit/client_spec.rb +1 -1
- data/spec/unit/deprecated_spec.rb +4 -4
- data/spec/unit/http_spec.rb +9 -0
- data/spec/unit/knife/bootstrap_spec.rb +5 -0
- data/spec/unit/knife/configure_spec.rb +10 -60
- data/spec/unit/knife/data_bag_create_spec.rb +40 -2
- data/spec/unit/knife/data_bag_show_spec.rb +16 -2
- data/spec/unit/knife/ssh_spec.rb +85 -39
- data/spec/unit/knife_spec.rb +2 -0
- data/spec/unit/lwrp_spec.rb +5 -3
- data/spec/unit/mixin/powershell_type_coercions_spec.rb +7 -6
- data/spec/unit/node/attribute_spec.rb +55 -24
- data/spec/unit/node/immutable_collections_spec.rb +28 -14
- data/spec/unit/node/vivid_mash_spec.rb +27 -10
- data/spec/unit/node_map_spec.rb +34 -0
- data/spec/unit/property_spec.rb +13 -13
- data/spec/unit/provider/group/dscl_spec.rb +14 -5
- data/spec/unit/provider/ifconfig_spec.rb +10 -3
- data/spec/unit/provider/remote_file/http_spec.rb +23 -19
- data/spec/unit/provider/service/solaris_smf_service_spec.rb +6 -5
- data/spec/unit/provider/user/dscl_spec.rb +26 -0
- data/spec/unit/provider/windows_task_spec.rb +148 -4
- data/spec/unit/provider_spec.rb +1 -1
- data/spec/unit/resource/apt_package_spec.rb +1 -1
- data/spec/unit/resource/bash_spec.rb +8 -10
- data/spec/unit/resource/batch_spec.rb +1 -1
- data/spec/unit/resource/cab_package_spec.rb +19 -1
- data/spec/unit/resource/chef_gem_spec.rb +3 -3
- data/spec/unit/resource/chocolatey_package_spec.rb +10 -10
- data/spec/unit/resource/conditional_spec.rb +2 -2
- data/spec/unit/resource/cookbook_file_spec.rb +24 -30
- data/spec/unit/resource/cron_spec.rb +79 -82
- data/spec/unit/resource/csh_spec.rb +8 -10
- data/spec/unit/resource/deploy_spec.rb +1 -1
- data/spec/unit/resource/directory_spec.rb +28 -31
- data/spec/unit/resource/dnf_package_spec.rb +9 -9
- data/spec/unit/resource/env_spec.rb +7 -7
- data/spec/unit/resource/erl_call_spec.rb +9 -9
- data/spec/unit/resource/execute_spec.rb +6 -6
- data/spec/unit/resource/file/verification_spec.rb +18 -4
- data/spec/unit/resource/file_spec.rb +53 -56
- data/spec/unit/resource/freebsd_package_spec.rb +7 -7
- data/spec/unit/resource/gem_package_spec.rb +1 -1
- data/spec/unit/resource/git_spec.rb +7 -9
- data/spec/unit/resource/group_spec.rb +60 -70
- data/spec/unit/resource/http_request_spec.rb +16 -19
- data/spec/unit/resource/ifconfig_spec.rb +3 -3
- data/spec/unit/resource/ips_package_spec.rb +3 -5
- data/spec/unit/resource/ksh_spec.rb +8 -10
- data/spec/unit/resource/launchd_spec.rb +17 -10
- data/spec/unit/resource/link_spec.rb +53 -53
- data/spec/unit/resource/log_spec.rb +24 -28
- data/spec/unit/resource/mdadm_spec.rb +42 -44
- data/spec/unit/resource/mount_spec.rb +97 -99
- data/spec/unit/resource/msu_package_spec.rb +14 -8
- data/spec/unit/resource/ohai_spec.rb +15 -17
- data/spec/unit/resource/openbsd_package_spec.rb +3 -3
- data/spec/unit/resource/osx_profile_spec.rb +7 -7
- data/spec/unit/resource/package_spec.rb +36 -40
- data/spec/unit/resource/perl_spec.rb +8 -11
- data/spec/unit/resource/portage_package_spec.rb +8 -10
- data/spec/unit/resource/powershell_package_spec.rb +9 -9
- data/spec/unit/resource/python_spec.rb +8 -11
- data/spec/unit/resource/reboot_spec.rb +50 -0
- data/spec/unit/resource/registry_key_spec.rb +84 -98
- data/spec/unit/resource/remote_directory_spec.rb +40 -42
- data/spec/unit/resource/remote_file_spec.rb +78 -80
- data/spec/unit/resource/route_spec.rb +42 -44
- data/spec/unit/resource/rpm_package_spec.rb +5 -7
- data/spec/unit/resource/ruby_block_spec.rb +14 -16
- data/spec/unit/resource/ruby_spec.rb +8 -12
- data/spec/unit/resource/scm_spec.rb +66 -69
- data/spec/unit/resource/script_spec.rb +1 -1
- data/spec/unit/resource/service_spec.rb +80 -83
- data/spec/unit/resource/smartos_package_spec.rb +5 -0
- data/spec/unit/resource/solaris_package_spec.rb +3 -5
- data/spec/unit/resource/subversion_spec.rb +18 -16
- data/spec/unit/resource/systemd_unit_spec.rb +50 -54
- data/spec/unit/resource/template_spec.rb +56 -61
- data/spec/unit/resource/user_spec.rb +47 -53
- data/spec/unit/resource/windows_package_spec.rb +1 -1
- data/spec/unit/resource/windows_path_spec.rb +11 -8
- data/spec/unit/resource/windows_task_spec.rb +129 -33
- data/spec/unit/resource/yum_package_spec.rb +1 -1
- data/spec/unit/resource/yum_repository_spec.rb +61 -8
- data/spec/unit/resource/zypper_repository_spec.rb +17 -18
- data/spec/unit/util/selinux_spec.rb +3 -6
- data/tasks/dependencies.rb +0 -5
- data/tasks/rspec.rb +1 -1
- metadata +7 -19
- data/acceptance/.DS_Store +0 -0
- data/acceptance/.bundle/config +0 -2
- data/acceptance/top-cookbooks/.kitchen.docker.yml +0 -13
- data/acceptance/top-cookbooks/.kitchen.git.yml +0 -11
- data/distro/.DS_Store +0 -0
- data/lib/.DS_Store +0 -0
- data/lib/chef/.DS_Store +0 -0
- data/lib/chef/knife/.DS_Store +0 -0
- data/lib/chef/mixin/.DS_Store +0 -0
- data/spec/.DS_Store +0 -0
- data/spec/functional/.DS_Store +0 -0
- data/spec/support/.DS_Store +0 -0
- data/spec/unit/.DS_Store +0 -0
- data/tasks/.DS_Store +0 -0
@@ -36,7 +36,7 @@ describe Chef::Resource::DnfPackage, "arch" do
|
|
36
36
|
@resource = Chef::Resource::DnfPackage.new("foo")
|
37
37
|
end
|
38
38
|
|
39
|
-
it "
|
39
|
+
it "sets the arch variable to whatever is passed in" do
|
40
40
|
@resource.arch("i386")
|
41
41
|
expect(@resource.arch).to eql(["i386"])
|
42
42
|
end
|
@@ -47,40 +47,40 @@ describe Chef::Resource::DnfPackage, "flush_cache" do
|
|
47
47
|
@resource = Chef::Resource::DnfPackage.new("foo")
|
48
48
|
end
|
49
49
|
|
50
|
-
it "
|
50
|
+
it "defaults the flush timing to false" do
|
51
51
|
flush_hash = { :before => false, :after => false }
|
52
52
|
expect(@resource.flush_cache).to eq(flush_hash)
|
53
53
|
end
|
54
54
|
|
55
|
-
it "
|
55
|
+
it "allows you to set the flush timing with an array" do
|
56
56
|
flush_array = [ :before, :after ]
|
57
57
|
flush_hash = { :before => true, :after => true }
|
58
58
|
@resource.flush_cache(flush_array)
|
59
59
|
expect(@resource.flush_cache).to eq(flush_hash)
|
60
60
|
end
|
61
61
|
|
62
|
-
it "
|
62
|
+
it "allows you to set the flush timing with a hash" do
|
63
63
|
flush_hash = { :before => true, :after => true }
|
64
64
|
@resource.flush_cache(flush_hash)
|
65
65
|
expect(@resource.flush_cache).to eq(flush_hash)
|
66
66
|
end
|
67
67
|
|
68
|
-
it "
|
68
|
+
it "allows 'true' for flush_cache" do
|
69
69
|
@resource.flush_cache(true)
|
70
70
|
expect(@resource.flush_cache).to eq({ before: true, after: true })
|
71
71
|
end
|
72
72
|
|
73
|
-
it "
|
73
|
+
it "allows 'false' for flush_cache" do
|
74
74
|
@resource.flush_cache(false)
|
75
75
|
expect(@resource.flush_cache).to eq({ before: false, after: false })
|
76
76
|
end
|
77
77
|
|
78
|
-
it "
|
78
|
+
it "allows ':before' for flush_cache" do
|
79
79
|
@resource.flush_cache(:before)
|
80
80
|
expect(@resource.flush_cache).to eq({ before: true, after: false })
|
81
81
|
end
|
82
82
|
|
83
|
-
it "
|
83
|
+
it "allows ':after' for flush_cache" do
|
84
84
|
@resource.flush_cache(:after)
|
85
85
|
expect(@resource.flush_cache).to eq({ before: false, after: true })
|
86
86
|
end
|
@@ -91,7 +91,7 @@ describe Chef::Resource::DnfPackage, "allow_downgrade" do
|
|
91
91
|
@resource = Chef::Resource::DnfPackage.new("foo")
|
92
92
|
end
|
93
93
|
|
94
|
-
it "
|
94
|
+
it "allows you to specify whether allow_downgrade is true or false" do
|
95
95
|
Chef::Config[:treat_deprecation_warnings_as_errors] = false
|
96
96
|
expect { @resource.allow_downgrade true }.not_to raise_error
|
97
97
|
expect { @resource.allow_downgrade false }.not_to raise_error
|
@@ -25,16 +25,16 @@ describe Chef::Resource::Env do
|
|
25
25
|
@resource = Chef::Resource::Env.new("FOO")
|
26
26
|
end
|
27
27
|
|
28
|
-
it "
|
28
|
+
it "creates a new Chef::Resource::Env" do
|
29
29
|
expect(@resource).to be_a_kind_of(Chef::Resource)
|
30
30
|
expect(@resource).to be_a_kind_of(Chef::Resource::Env)
|
31
31
|
end
|
32
32
|
|
33
|
-
it "
|
33
|
+
it "has a name" do
|
34
34
|
expect(@resource.name).to eql("FOO")
|
35
35
|
end
|
36
36
|
|
37
|
-
it "
|
37
|
+
it "has a default action of 'create'" do
|
38
38
|
expect(@resource.action).to eql([:create])
|
39
39
|
end
|
40
40
|
|
@@ -48,19 +48,19 @@ describe Chef::Resource::Env do
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
-
it "
|
51
|
+
it "uses the object name as the key_name by default" do
|
52
52
|
expect(@resource.key_name).to eql("FOO")
|
53
53
|
end
|
54
54
|
|
55
|
-
it "
|
55
|
+
it "accepts a string as the env value via 'value'" do
|
56
56
|
expect { @resource.value "bar" }.not_to raise_error
|
57
57
|
end
|
58
58
|
|
59
|
-
it "
|
59
|
+
it "does not accept a Hash for the env value via 'to'" do
|
60
60
|
expect { @resource.value Hash.new }.to raise_error(ArgumentError)
|
61
61
|
end
|
62
62
|
|
63
|
-
it "
|
63
|
+
it "allows you to set an env value via 'to'" do
|
64
64
|
@resource.value "bar"
|
65
65
|
expect(@resource.value).to eql("bar")
|
66
66
|
end
|
@@ -25,44 +25,44 @@ describe Chef::Resource::ErlCall do
|
|
25
25
|
@resource = Chef::Resource::ErlCall.new("fakey_fakerton")
|
26
26
|
end
|
27
27
|
|
28
|
-
it "
|
28
|
+
it "creates a new Chef::Resource::ErlCall" do
|
29
29
|
expect(@resource).to be_a_kind_of(Chef::Resource)
|
30
30
|
expect(@resource).to be_a_kind_of(Chef::Resource::ErlCall)
|
31
31
|
end
|
32
32
|
|
33
|
-
it "
|
33
|
+
it "has a resource name of :erl_call" do
|
34
34
|
expect(@resource.resource_name).to eql(:erl_call)
|
35
35
|
end
|
36
36
|
|
37
|
-
it "
|
37
|
+
it "has a default action of run" do
|
38
38
|
expect(@resource.action).to eql([:run])
|
39
39
|
end
|
40
40
|
|
41
|
-
it "
|
41
|
+
it "accepts run as an action" do
|
42
42
|
expect { @resource.action :run }.not_to raise_error
|
43
43
|
end
|
44
44
|
|
45
|
-
it "
|
45
|
+
it "allows you to set the code attribute" do
|
46
46
|
@resource.code "q()."
|
47
47
|
expect(@resource.code).to eql("q().")
|
48
48
|
end
|
49
49
|
|
50
|
-
it "
|
50
|
+
it "allows you to set the cookie attribute" do
|
51
51
|
@resource.cookie "nomnomnom"
|
52
52
|
expect(@resource.cookie).to eql("nomnomnom")
|
53
53
|
end
|
54
54
|
|
55
|
-
it "
|
55
|
+
it "allows you to set the distributed attribute" do
|
56
56
|
@resource.distributed true
|
57
57
|
expect(@resource.distributed).to eql(true)
|
58
58
|
end
|
59
59
|
|
60
|
-
it "
|
60
|
+
it "allows you to set the name_type attribute" do
|
61
61
|
@resource.name_type "sname"
|
62
62
|
expect(@resource.name_type).to eql("sname")
|
63
63
|
end
|
64
64
|
|
65
|
-
it "
|
65
|
+
it "allows you to set the node_name attribute" do
|
66
66
|
@resource.node_name "chef@erlang"
|
67
67
|
expect(@resource.node_name).to eql("chef@erlang")
|
68
68
|
end
|
@@ -24,7 +24,7 @@ describe Chef::Resource::Execute do
|
|
24
24
|
let(:execute_resource) { Chef::Resource::Execute.new(resource_instance_name) }
|
25
25
|
it_behaves_like "an execute resource"
|
26
26
|
|
27
|
-
it "default guard interpreter
|
27
|
+
it "default guard interpreter is :execute interpreter" do
|
28
28
|
expect(execute_resource.guard_interpreter).to be(:execute)
|
29
29
|
end
|
30
30
|
|
@@ -59,13 +59,13 @@ describe Chef::Resource::Execute do
|
|
59
59
|
|
60
60
|
shared_examples_for "it received valid credentials" do
|
61
61
|
describe "the validation method" do
|
62
|
-
it "
|
62
|
+
it "does not raise an error" do
|
63
63
|
expect { execute_resource.validate_identity_platform(username, password, domain) }.not_to raise_error
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
67
67
|
describe "the name qualification method" do
|
68
|
-
it "
|
68
|
+
it "correctly translates the user and domain" do
|
69
69
|
identity = nil
|
70
70
|
expect { identity = execute_resource.qualify_user(username, password, domain) }.not_to raise_error
|
71
71
|
expect(identity[:domain]).to eq(domain)
|
@@ -76,7 +76,7 @@ describe Chef::Resource::Execute do
|
|
76
76
|
|
77
77
|
shared_examples_for "it received invalid credentials" do
|
78
78
|
describe "the validation method" do
|
79
|
-
it "
|
79
|
+
it "raises an error" do
|
80
80
|
expect { execute_resource.validate_identity_platform(username, password, domain, elevated) }.to raise_error(ArgumentError)
|
81
81
|
end
|
82
82
|
end
|
@@ -84,7 +84,7 @@ describe Chef::Resource::Execute do
|
|
84
84
|
|
85
85
|
shared_examples_for "it received invalid username and domain" do
|
86
86
|
describe "the validation method" do
|
87
|
-
it "
|
87
|
+
it "raises an error" do
|
88
88
|
expect { execute_resource.qualify_user(username, password, domain) }.to raise_error(ArgumentError)
|
89
89
|
end
|
90
90
|
end
|
@@ -92,7 +92,7 @@ describe Chef::Resource::Execute do
|
|
92
92
|
|
93
93
|
shared_examples_for "it received credentials that are not valid on the platform" do
|
94
94
|
describe "the validation method" do
|
95
|
-
it "
|
95
|
+
it "raises an error" do
|
96
96
|
expect { execute_resource.validate_identity_platform(username, password, domain) }.to raise_error(Chef::Exceptions::UnsupportedPlatform)
|
97
97
|
end
|
98
98
|
end
|
@@ -66,6 +66,11 @@ describe Chef::Resource::File::Verification do
|
|
66
66
|
v = Chef::Resource::File::Verification.new(parent_resource, nil, {}, &f_block)
|
67
67
|
expect(v.verify(temp_path)).to eq(false)
|
68
68
|
end
|
69
|
+
|
70
|
+
it "responds to to_s" do
|
71
|
+
v = Chef::Resource::File::Verification.new(parent_resource, nil, {}) {}
|
72
|
+
expect(v.to_s).to eq("<Proc>")
|
73
|
+
end
|
69
74
|
end
|
70
75
|
|
71
76
|
context "with a verification command(String)" do
|
@@ -110,23 +115,32 @@ describe Chef::Resource::File::Verification do
|
|
110
115
|
v = Chef::Resource::File::Verification.new(parent_resource, "true", {})
|
111
116
|
expect(v.verify(temp_path)).to eq(true)
|
112
117
|
end
|
118
|
+
|
119
|
+
it "responds to to_s" do
|
120
|
+
v = Chef::Resource::File::Verification.new(parent_resource, "some command --here", {})
|
121
|
+
expect(v.to_s).to eq("some command --here")
|
122
|
+
end
|
113
123
|
end
|
114
124
|
|
115
125
|
context "with a named verification(Symbol)" do
|
126
|
+
let(:registered_verification) { double("registered_verification") }
|
127
|
+
subject { described_class.new(parent_resource, :cats, {}) }
|
116
128
|
before(:each) do
|
117
129
|
class Chef::Resource::File::Verification::Turtle < Chef::Resource::File::Verification
|
118
130
|
provides :cats
|
119
131
|
def verify(path, opts)
|
120
132
|
end
|
121
133
|
end
|
134
|
+
allow(Chef::Resource::File::Verification::Turtle).to receive(:new).and_return(registered_verification)
|
122
135
|
end
|
123
136
|
|
124
137
|
it "delegates to the registered verification" do
|
125
|
-
registered_verification = double()
|
126
|
-
allow(Chef::Resource::File::Verification::Turtle).to receive(:new).and_return(registered_verification)
|
127
|
-
v = Chef::Resource::File::Verification.new(parent_resource, :cats, {})
|
128
138
|
expect(registered_verification).to receive(:verify).with(temp_path, {})
|
129
|
-
|
139
|
+
subject.verify(temp_path, {})
|
140
|
+
end
|
141
|
+
|
142
|
+
it "responds to to_s" do
|
143
|
+
expect(subject.to_s).to eq(":cats (Chef::Resource::File::Verification::Turtle)")
|
130
144
|
end
|
131
145
|
end
|
132
146
|
end
|
@@ -20,88 +20,86 @@ require "spec_helper"
|
|
20
20
|
|
21
21
|
describe Chef::Resource::File do
|
22
22
|
|
23
|
-
|
24
|
-
@resource = Chef::Resource::File.new("fakey_fakerton")
|
25
|
-
end
|
23
|
+
let(:resource) { Chef::Resource::File.new("fakey_fakerton") }
|
26
24
|
|
27
|
-
it "
|
28
|
-
expect(
|
25
|
+
it "has a name" do
|
26
|
+
expect(resource.name).to eql("fakey_fakerton")
|
29
27
|
end
|
30
28
|
|
31
|
-
it "
|
32
|
-
expect(
|
29
|
+
it "has a default action of 'create'" do
|
30
|
+
expect(resource.action).to eql([:create])
|
33
31
|
end
|
34
32
|
|
35
|
-
it "
|
36
|
-
expect(
|
33
|
+
it "has a default content of nil" do
|
34
|
+
expect(resource.content).to be_nil
|
37
35
|
end
|
38
36
|
|
39
|
-
it "
|
40
|
-
expect(
|
37
|
+
it "is set to back up 5 files by default" do
|
38
|
+
expect(resource.backup).to eql(5)
|
41
39
|
end
|
42
40
|
|
43
|
-
it "
|
44
|
-
expect {
|
45
|
-
expect {
|
46
|
-
expect {
|
47
|
-
expect {
|
41
|
+
it "only accept strings for content" do
|
42
|
+
expect { resource.content 5 }.to raise_error(ArgumentError)
|
43
|
+
expect { resource.content :foo }.to raise_error(ArgumentError)
|
44
|
+
expect { resource.content "hello" => "there" }.to raise_error(ArgumentError)
|
45
|
+
expect { resource.content "hi" }.not_to raise_error
|
48
46
|
end
|
49
47
|
|
50
|
-
it "
|
51
|
-
expect {
|
52
|
-
expect {
|
53
|
-
expect {
|
54
|
-
expect {
|
48
|
+
it "only accept false or a number for backup" do
|
49
|
+
expect { resource.backup true }.to raise_error(ArgumentError)
|
50
|
+
expect { resource.backup false }.not_to raise_error
|
51
|
+
expect { resource.backup 10 }.not_to raise_error
|
52
|
+
expect { resource.backup "blues" }.to raise_error(ArgumentError)
|
55
53
|
end
|
56
54
|
|
57
|
-
it "
|
58
|
-
expect {
|
59
|
-
expect {
|
55
|
+
it "accepts a sha256 for checksum" do
|
56
|
+
expect { resource.checksum "0fd012fdc96e96f8f7cf2046522a54aed0ce470224513e45da6bc1a17a4924aa" }.not_to raise_error
|
57
|
+
expect { resource.checksum "monkey!" }.to raise_error(ArgumentError)
|
60
58
|
end
|
61
59
|
|
62
|
-
it "
|
63
|
-
expect {
|
64
|
-
expect {
|
65
|
-
expect {
|
66
|
-
expect {
|
60
|
+
it "accepts create, delete or touch for action" do
|
61
|
+
expect { resource.action :create }.not_to raise_error
|
62
|
+
expect { resource.action :delete }.not_to raise_error
|
63
|
+
expect { resource.action :touch }.not_to raise_error
|
64
|
+
expect { resource.action :blues }.to raise_error(ArgumentError)
|
67
65
|
end
|
68
66
|
|
69
|
-
it "
|
70
|
-
expect {
|
71
|
-
expect {
|
72
|
-
expect {
|
73
|
-
expect {
|
74
|
-
expect {
|
67
|
+
it "accepts a block, symbol, or string for verify" do
|
68
|
+
expect { resource.verify {} }.not_to raise_error
|
69
|
+
expect { resource.verify "" }.not_to raise_error
|
70
|
+
expect { resource.verify :json }.not_to raise_error
|
71
|
+
expect { resource.verify true }.to raise_error(ArgumentError)
|
72
|
+
expect { resource.verify false }.to raise_error(ArgumentError)
|
75
73
|
end
|
76
74
|
|
77
|
-
it "
|
78
|
-
|
79
|
-
|
80
|
-
|
75
|
+
it "accepts multiple verify statements" do
|
76
|
+
resource.verify "foo"
|
77
|
+
resource.verify "bar"
|
78
|
+
resource.verify.length == 2
|
81
79
|
end
|
82
80
|
|
83
|
-
it "
|
84
|
-
expect(
|
81
|
+
it "uses the object name as the path by default" do
|
82
|
+
expect(resource.path).to eql("fakey_fakerton")
|
85
83
|
end
|
86
84
|
|
87
|
-
it "
|
88
|
-
expect {
|
89
|
-
expect(
|
90
|
-
expect {
|
85
|
+
it "accepts a string as the path" do
|
86
|
+
expect { resource.path "/tmp" }.not_to raise_error
|
87
|
+
expect(resource.path).to eql("/tmp")
|
88
|
+
expect { resource.path Hash.new }.to raise_error(ArgumentError)
|
91
89
|
end
|
92
90
|
|
93
91
|
describe "when it has a path, owner, group, mode, and checksum" do
|
94
92
|
before do
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
93
|
+
resource.path("/tmp/foo.txt")
|
94
|
+
resource.owner("root")
|
95
|
+
resource.group("wheel")
|
96
|
+
resource.mode("0644")
|
97
|
+
resource.checksum("1" * 64)
|
100
98
|
end
|
101
99
|
|
102
100
|
context "on unix", :unix_only do
|
103
101
|
it "describes its state" do
|
104
|
-
state =
|
102
|
+
state = resource.state_for_resource_reporter
|
105
103
|
expect(state[:owner]).to eq("root")
|
106
104
|
expect(state[:group]).to eq("wheel")
|
107
105
|
expect(state[:mode]).to eq("0644")
|
@@ -110,21 +108,20 @@ describe Chef::Resource::File do
|
|
110
108
|
end
|
111
109
|
|
112
110
|
it "returns the file path as its identity" do
|
113
|
-
expect(
|
111
|
+
expect(resource.identity).to eq("/tmp/foo.txt")
|
114
112
|
end
|
115
113
|
|
116
114
|
end
|
117
115
|
|
118
116
|
describe "when access controls are set on windows", :windows_only => true do
|
119
117
|
before do
|
120
|
-
|
121
|
-
|
118
|
+
resource.rights :read, "Everyone"
|
119
|
+
resource.rights :full_control, "DOMAIN\User"
|
122
120
|
end
|
123
121
|
it "describes its state including windows ACL attributes" do
|
124
|
-
state =
|
122
|
+
state = resource.state_for_resource_reporter
|
125
123
|
expect(state[:rights]).to eq([ { :permissions => :read, :principals => "Everyone" },
|
126
124
|
{ :permissions => :full_control, :principals => "DOMAIN\User" } ])
|
127
125
|
end
|
128
126
|
end
|
129
|
-
|
130
127
|
end
|
@@ -30,22 +30,22 @@ describe Chef::Resource::FreebsdPackage do
|
|
30
30
|
end
|
31
31
|
|
32
32
|
describe "Initialization" do
|
33
|
-
it "
|
33
|
+
it "returns a Chef::Resource::FreebsdPackage" do
|
34
34
|
expect(@resource).to be_a_kind_of(Chef::Resource::FreebsdPackage)
|
35
35
|
end
|
36
36
|
|
37
|
-
it "
|
37
|
+
it "sets the resource_name to :freebsd_package" do
|
38
38
|
expect(@resource.resource_name).to eql(:freebsd_package)
|
39
39
|
end
|
40
40
|
|
41
|
-
it "
|
41
|
+
it "does not set the provider" do
|
42
42
|
expect(@resource.provider).to be_nil
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
46
|
describe "Assigning provider after creation" do
|
47
47
|
describe "if ports specified as source" do
|
48
|
-
it "
|
48
|
+
it "is Freebsd::Port" do
|
49
49
|
@resource.source("ports")
|
50
50
|
@resource.after_created
|
51
51
|
expect(@resource.provider).to eq(Chef::Provider::Package::Freebsd::Port)
|
@@ -53,7 +53,7 @@ describe Chef::Resource::FreebsdPackage do
|
|
53
53
|
end
|
54
54
|
|
55
55
|
describe "if freebsd_version is greater than or equal to 1000017" do
|
56
|
-
it "
|
56
|
+
it "is Freebsd::Pkgng" do
|
57
57
|
[1000017, 1000018, 1000500, 1001001, 1100000].each do |freebsd_version|
|
58
58
|
@node.automatic_attrs[:os_version] = freebsd_version
|
59
59
|
@resource.after_created
|
@@ -63,7 +63,7 @@ describe Chef::Resource::FreebsdPackage do
|
|
63
63
|
end
|
64
64
|
|
65
65
|
describe "if pkgng enabled" do
|
66
|
-
it "
|
66
|
+
it "is Freebsd::Pkgng" do
|
67
67
|
pkg_enabled = OpenStruct.new(:stdout => "yes\n")
|
68
68
|
allow(@resource).to receive(:shell_out!).with("make", "-V", "WITH_PKGNG", :env => nil).and_return(pkg_enabled)
|
69
69
|
@resource.after_created
|
@@ -72,7 +72,7 @@ describe Chef::Resource::FreebsdPackage do
|
|
72
72
|
end
|
73
73
|
|
74
74
|
describe "if freebsd_version is less than 1000017 and pkgng not enabled" do
|
75
|
-
it "
|
75
|
+
it "is Freebsd::Pkg" do
|
76
76
|
pkg_enabled = OpenStruct.new(:stdout => "\n")
|
77
77
|
allow(@resource).to receive(:shell_out!).with("make", "-V", "WITH_PKGNG", :env => nil).and_return(pkg_enabled)
|
78
78
|
|