chef 13.6.4 → 13.7.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- 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 +6 -6
- data/acceptance/top-cookbooks/.kitchen.docker.yml +0 -13
- data/acceptance/top-cookbooks/.kitchen.git.yml +0 -11
@@ -99,7 +99,7 @@ describe Chef::Resource::Conditional do
|
|
99
99
|
expect(@conditional.continue?).to be_falsey
|
100
100
|
end
|
101
101
|
|
102
|
-
it "
|
102
|
+
it "logs a warning" do
|
103
103
|
expect(Chef::Log).to receive(:warn).with("Command 'false' timed out")
|
104
104
|
@conditional.continue?
|
105
105
|
end
|
@@ -202,7 +202,7 @@ describe Chef::Resource::Conditional do
|
|
202
202
|
expect(@conditional.continue?).to be_truthy
|
203
203
|
end
|
204
204
|
|
205
|
-
it "
|
205
|
+
it "logs a warning" do
|
206
206
|
expect(Chef::Log).to receive(:warn).with("Command 'false' timed out")
|
207
207
|
@conditional.continue?
|
208
208
|
end
|
@@ -20,51 +20,45 @@
|
|
20
20
|
require "spec_helper"
|
21
21
|
|
22
22
|
describe Chef::Resource::CookbookFile do
|
23
|
-
|
24
|
-
@cookbook_file = Chef::Resource::CookbookFile.new("sourcecode_tarball.tgz")
|
25
|
-
end
|
26
|
-
|
27
|
-
it "uses the name parameter for the source parameter" do
|
28
|
-
expect(@cookbook_file.name).to eq("sourcecode_tarball.tgz")
|
29
|
-
end
|
23
|
+
let(:resource) { Chef::Resource::CookbookFile.new("/foo/bar/sourcecode_tarball.tgz") }
|
30
24
|
|
31
|
-
it "
|
32
|
-
|
33
|
-
expect(@cookbook_file.name).to eq("config_file.conf")
|
25
|
+
it "uses the basepath of the resourc ename for the source property" do
|
26
|
+
expect(resource.source).to eq("sourcecode_tarball.tgz")
|
34
27
|
end
|
35
28
|
|
36
|
-
it "
|
37
|
-
|
29
|
+
it "source property accepts Strings" do
|
30
|
+
resource.name("config_file.conf")
|
31
|
+
expect(resource.source).to eq("config_file.conf")
|
38
32
|
end
|
39
33
|
|
40
|
-
it "
|
41
|
-
|
42
|
-
expect(@cookbook_file.cookbook).to eq("munin")
|
34
|
+
it "cookbook property defaults to nil (current cookbook will be used)" do
|
35
|
+
expect(resource.cookbook).to be_nil
|
43
36
|
end
|
44
37
|
|
45
|
-
it "
|
46
|
-
|
38
|
+
it "has a cookbook property that accepts Strings" do
|
39
|
+
resource.cookbook("munin")
|
40
|
+
expect(resource.cookbook).to eq("munin")
|
47
41
|
end
|
48
42
|
|
49
43
|
describe "when it has a backup number, group, mode, owner, source, checksum, and cookbook on nix or path, rights, deny_rights, checksum on windows" do
|
50
44
|
before do
|
51
45
|
if Chef::Platform.windows?
|
52
|
-
|
53
|
-
|
54
|
-
|
46
|
+
resource.path("C:/temp/origin/file.txt")
|
47
|
+
resource.rights(:read, "Everyone")
|
48
|
+
resource.deny_rights(:full_control, "Clumsy_Sam")
|
55
49
|
else
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
50
|
+
resource.path("/tmp/origin/file.txt")
|
51
|
+
resource.group("wheel")
|
52
|
+
resource.mode("0664")
|
53
|
+
resource.owner("root")
|
54
|
+
resource.source("/tmp/foo.txt")
|
55
|
+
resource.cookbook("/tmp/cookbooks/cooked.rb")
|
62
56
|
end
|
63
|
-
|
57
|
+
resource.checksum("1" * 64)
|
64
58
|
end
|
65
59
|
|
66
60
|
it "describes the state" do
|
67
|
-
state =
|
61
|
+
state = resource.state_for_resource_reporter
|
68
62
|
if Chef::Platform.windows?
|
69
63
|
puts state
|
70
64
|
expect(state[:rights]).to eq([{ :permissions => :read, :principals => "Everyone" }])
|
@@ -79,9 +73,9 @@ describe Chef::Resource::CookbookFile do
|
|
79
73
|
|
80
74
|
it "returns the path as its identity" do
|
81
75
|
if Chef::Platform.windows?
|
82
|
-
expect(
|
76
|
+
expect(resource.identity).to eq("C:/temp/origin/file.txt")
|
83
77
|
else
|
84
|
-
expect(
|
78
|
+
expect(resource.identity).to eq("/tmp/origin/file.txt")
|
85
79
|
end
|
86
80
|
end
|
87
81
|
end
|
@@ -20,157 +20,154 @@
|
|
20
20
|
require "spec_helper"
|
21
21
|
|
22
22
|
describe Chef::Resource::Cron do
|
23
|
+
let(:resource) { Chef::Resource::Cron.new("cronify") }
|
23
24
|
|
24
|
-
|
25
|
-
|
25
|
+
it "creates a new Chef::Resource::Cron" do
|
26
|
+
expect(resource).to be_a_kind_of(Chef::Resource)
|
27
|
+
expect(resource).to be_a_kind_of(Chef::Resource::Cron)
|
26
28
|
end
|
27
29
|
|
28
|
-
it "
|
29
|
-
expect(
|
30
|
-
expect(@resource).to be_a_kind_of(Chef::Resource::Cron)
|
30
|
+
it "has a name property" do
|
31
|
+
expect(resource.name).to eql("cronify")
|
31
32
|
end
|
32
33
|
|
33
|
-
it "
|
34
|
-
expect(
|
34
|
+
it "has a default action of [:create]" do
|
35
|
+
expect(resource.action).to eql([:create])
|
35
36
|
end
|
36
37
|
|
37
|
-
it "
|
38
|
-
expect
|
38
|
+
it "accepts create or delete for action" do
|
39
|
+
expect { resource.action :create }.not_to raise_error
|
40
|
+
expect { resource.action :delete }.not_to raise_error
|
41
|
+
expect { resource.action :lolcat }.to raise_error(ArgumentError)
|
39
42
|
end
|
40
43
|
|
41
|
-
it "
|
42
|
-
|
43
|
-
expect
|
44
|
-
expect { @resource.action :lolcat }.to raise_error(ArgumentError)
|
44
|
+
it "allows you to set a command" do
|
45
|
+
resource.command "/bin/true"
|
46
|
+
expect(resource.command).to eql("/bin/true")
|
45
47
|
end
|
46
48
|
|
47
|
-
it "
|
48
|
-
|
49
|
-
expect(
|
49
|
+
it "allows you to set a user" do
|
50
|
+
resource.user "daemon"
|
51
|
+
expect(resource.user).to eql("daemon")
|
50
52
|
end
|
51
53
|
|
52
|
-
it "
|
53
|
-
|
54
|
-
expect(
|
54
|
+
it "allows you to specify the minute" do
|
55
|
+
resource.minute "30"
|
56
|
+
expect(resource.minute).to eql("30")
|
55
57
|
end
|
56
58
|
|
57
|
-
it "
|
58
|
-
|
59
|
-
expect(
|
59
|
+
it "allows you to specify the hour" do
|
60
|
+
resource.hour "6"
|
61
|
+
expect(resource.hour).to eql("6")
|
60
62
|
end
|
61
63
|
|
62
|
-
it "
|
63
|
-
|
64
|
-
expect(
|
64
|
+
it "allows you to specify the day" do
|
65
|
+
resource.day "10"
|
66
|
+
expect(resource.day).to eql("10")
|
65
67
|
end
|
66
68
|
|
67
|
-
it "
|
68
|
-
|
69
|
-
expect(
|
69
|
+
it "allows you to specify the month" do
|
70
|
+
resource.month "10"
|
71
|
+
expect(resource.month).to eql("10")
|
70
72
|
end
|
71
73
|
|
72
|
-
it "
|
73
|
-
|
74
|
-
expect(
|
74
|
+
it "allows you to specify the weekday" do
|
75
|
+
resource.weekday "2"
|
76
|
+
expect(resource.weekday).to eql("2")
|
75
77
|
end
|
76
78
|
|
77
|
-
it "
|
78
|
-
|
79
|
-
expect(
|
79
|
+
it "allows you to specify the mailto variable" do
|
80
|
+
resource.mailto "test@example.com"
|
81
|
+
expect(resource.mailto).to eql("test@example.com")
|
80
82
|
end
|
81
83
|
|
82
|
-
it "
|
83
|
-
|
84
|
-
expect(
|
84
|
+
it "allows you to specify the path" do
|
85
|
+
resource.path "/usr/bin:/usr/sbin"
|
86
|
+
expect(resource.path).to eql("/usr/bin:/usr/sbin")
|
85
87
|
end
|
86
88
|
|
87
|
-
it "
|
88
|
-
|
89
|
-
expect(
|
89
|
+
it "allows you to specify the home directory" do
|
90
|
+
resource.home "/root"
|
91
|
+
expect(resource.home).to eql("/root")
|
90
92
|
end
|
91
93
|
|
92
|
-
it "
|
93
|
-
|
94
|
-
expect(
|
94
|
+
it "allows you to specify the shell to run the command with" do
|
95
|
+
resource.shell "/bin/zsh"
|
96
|
+
expect(resource.shell).to eql("/bin/zsh")
|
95
97
|
end
|
96
98
|
|
97
|
-
it "
|
98
|
-
@resource.shell "/bin/zsh"
|
99
|
-
expect(@resource.shell).to eql("/bin/zsh")
|
100
|
-
end
|
101
|
-
|
102
|
-
it "should allow you to specify environment variables hash" do
|
99
|
+
it "allows you to specify environment variables hash" do
|
103
100
|
env = { "TEST" => "LOL" }
|
104
|
-
|
105
|
-
expect(
|
101
|
+
resource.environment env
|
102
|
+
expect(resource.environment).to eql(env)
|
106
103
|
end
|
107
104
|
|
108
|
-
it "
|
105
|
+
it "allows * for all time and date values" do
|
109
106
|
%w{minute hour day month weekday}.each do |x|
|
110
|
-
expect(
|
107
|
+
expect(resource.send(x, "*")).to eql("*")
|
111
108
|
end
|
112
109
|
end
|
113
110
|
|
114
|
-
it "
|
111
|
+
it "allows ranges for all time and date values" do
|
115
112
|
%w{minute hour day month weekday}.each do |x|
|
116
|
-
expect(
|
113
|
+
expect(resource.send(x, "1-2,5")).to eql("1-2,5")
|
117
114
|
end
|
118
115
|
end
|
119
116
|
|
120
|
-
it "
|
117
|
+
it "has a default value of * for all time and date values" do
|
121
118
|
%w{minute hour day month weekday}.each do |x|
|
122
|
-
expect(
|
119
|
+
expect(resource.send(x)).to eql("*")
|
123
120
|
end
|
124
121
|
end
|
125
122
|
|
126
|
-
it "
|
127
|
-
expect(
|
123
|
+
it "has a default value of root for the user" do
|
124
|
+
expect(resource.user).to eql("root")
|
128
125
|
end
|
129
126
|
|
130
|
-
it "
|
131
|
-
expect {
|
127
|
+
it "rejects any minute over 59" do
|
128
|
+
expect { resource.minute "60" }.to raise_error(RangeError)
|
132
129
|
end
|
133
130
|
|
134
|
-
it "
|
135
|
-
expect {
|
131
|
+
it "rejects any hour over 23" do
|
132
|
+
expect { resource.hour "24" }.to raise_error(RangeError)
|
136
133
|
end
|
137
134
|
|
138
|
-
it "
|
139
|
-
expect {
|
135
|
+
it "rejects any day over 31" do
|
136
|
+
expect { resource.day "32" }.to raise_error(RangeError)
|
140
137
|
end
|
141
138
|
|
142
|
-
it "
|
143
|
-
expect {
|
139
|
+
it "rejects any month over 12" do
|
140
|
+
expect { resource.month "13" }.to raise_error(RangeError)
|
144
141
|
end
|
145
142
|
|
146
143
|
describe "weekday" do
|
147
|
-
it "
|
148
|
-
expect {
|
144
|
+
it "rejects any weekday over 7" do
|
145
|
+
expect { resource.weekday "8" }.to raise_error(RangeError)
|
149
146
|
end
|
150
|
-
it "
|
151
|
-
expect {
|
147
|
+
it "rejects any symbols which don't represent day of week" do
|
148
|
+
expect { resource.weekday :foo }.to raise_error(RangeError)
|
152
149
|
end
|
153
150
|
end
|
154
151
|
|
155
|
-
it "
|
152
|
+
it "converts integer schedule values to a string" do
|
156
153
|
%w{minute hour day month weekday}.each do |x|
|
157
|
-
expect(
|
154
|
+
expect(resource.send(x, 5)).to eql("5")
|
158
155
|
end
|
159
156
|
end
|
160
157
|
|
161
158
|
describe "when it has a time (minute, hour, day, month, weeekend) and user" do
|
162
159
|
before do
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
160
|
+
resource.command("tackle")
|
161
|
+
resource.minute("1")
|
162
|
+
resource.hour("2")
|
163
|
+
resource.day("3")
|
164
|
+
resource.month("4")
|
165
|
+
resource.weekday("5")
|
166
|
+
resource.user("root")
|
170
167
|
end
|
171
168
|
|
172
169
|
it "describes the state" do
|
173
|
-
state =
|
170
|
+
state = resource.state_for_resource_reporter
|
174
171
|
expect(state[:minute]).to eq("1")
|
175
172
|
expect(state[:hour]).to eq("2")
|
176
173
|
expect(state[:day]).to eq("3")
|
@@ -180,7 +177,7 @@ describe Chef::Resource::Cron do
|
|
180
177
|
end
|
181
178
|
|
182
179
|
it "returns the command as its identity" do
|
183
|
-
expect(
|
180
|
+
expect(resource.identity).to eq("tackle")
|
184
181
|
end
|
185
182
|
end
|
186
183
|
end
|
@@ -20,21 +20,19 @@ require "spec_helper"
|
|
20
20
|
|
21
21
|
describe Chef::Resource::Csh do
|
22
22
|
|
23
|
-
|
24
|
-
@resource = Chef::Resource::Csh.new("fakey_fakerton")
|
25
|
-
end
|
23
|
+
let(:resource) { Chef::Resource::Csh.new("fakey_fakerton") }
|
26
24
|
|
27
|
-
it "
|
28
|
-
expect(
|
29
|
-
expect(
|
25
|
+
it "creates a new Chef::Resource::Csh" do
|
26
|
+
expect(resource).to be_a_kind_of(Chef::Resource)
|
27
|
+
expect(resource).to be_a_kind_of(Chef::Resource::Csh)
|
30
28
|
end
|
31
29
|
|
32
|
-
it "
|
33
|
-
expect(
|
30
|
+
it "has a resource name of :csh" do
|
31
|
+
expect(resource.resource_name).to eql(:csh)
|
34
32
|
end
|
35
33
|
|
36
|
-
it "
|
37
|
-
expect(
|
34
|
+
it "has an interpreter of csh" do
|
35
|
+
expect(resource.interpreter).to eql("csh")
|
38
36
|
end
|
39
37
|
|
40
38
|
end
|
@@ -20,63 +20,60 @@
|
|
20
20
|
require "spec_helper"
|
21
21
|
|
22
22
|
describe Chef::Resource::Directory do
|
23
|
+
let(:resource) { Chef::Resource::Directory.new("fakey_fakerton") }
|
23
24
|
|
24
|
-
|
25
|
-
|
25
|
+
it "creates a new Chef::Resource::Directory" do
|
26
|
+
expect(resource).to be_a_kind_of(Chef::Resource)
|
27
|
+
expect(resource).to be_a_kind_of(Chef::Resource::Directory)
|
26
28
|
end
|
27
29
|
|
28
|
-
it "
|
29
|
-
expect(
|
30
|
-
expect(@resource).to be_a_kind_of(Chef::Resource::Directory)
|
30
|
+
it "has a name" do
|
31
|
+
expect(resource.name).to eql("fakey_fakerton")
|
31
32
|
end
|
32
33
|
|
33
|
-
it "
|
34
|
-
expect(
|
34
|
+
it "has a default action of 'create'" do
|
35
|
+
expect(resource.action).to eql([:create])
|
35
36
|
end
|
36
37
|
|
37
|
-
it "
|
38
|
-
expect
|
38
|
+
it "accepts create or delete for action" do
|
39
|
+
expect { resource.action :create }.not_to raise_error
|
40
|
+
expect { resource.action :delete }.not_to raise_error
|
41
|
+
expect { resource.action :blues }.to raise_error(ArgumentError)
|
39
42
|
end
|
40
43
|
|
41
|
-
it "
|
42
|
-
expect
|
43
|
-
expect { @resource.action :delete }.not_to raise_error
|
44
|
-
expect { @resource.action :blues }.to raise_error(ArgumentError)
|
44
|
+
it "uses the object name as the path by default" do
|
45
|
+
expect(resource.path).to eql("fakey_fakerton")
|
45
46
|
end
|
46
47
|
|
47
|
-
it "
|
48
|
-
expect
|
48
|
+
it "accepts a string as the path" do
|
49
|
+
expect { resource.path "/tmp" }.not_to raise_error
|
50
|
+
expect(resource.path).to eql("/tmp")
|
51
|
+
expect { resource.path Hash.new }.to raise_error(ArgumentError)
|
49
52
|
end
|
50
53
|
|
51
|
-
it "
|
52
|
-
expect {
|
53
|
-
expect
|
54
|
-
expect {
|
55
|
-
end
|
56
|
-
|
57
|
-
it "should allow you to have specify whether the action is recursive with true/false" do
|
58
|
-
expect { @resource.recursive true }.not_to raise_error
|
59
|
-
expect { @resource.recursive false }.not_to raise_error
|
60
|
-
expect { @resource.recursive "monkey" }.to raise_error(ArgumentError)
|
54
|
+
it "allows you to have specify whether the action is recursive with true/false" do
|
55
|
+
expect { resource.recursive true }.not_to raise_error
|
56
|
+
expect { resource.recursive false }.not_to raise_error
|
57
|
+
expect { resource.recursive "monkey" }.to raise_error(ArgumentError)
|
61
58
|
end
|
62
59
|
|
63
60
|
describe "when it has group, mode, and owner" do
|
64
61
|
before do
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
62
|
+
resource.path("/tmp/foo/bar/")
|
63
|
+
resource.group("wheel")
|
64
|
+
resource.mode("0664")
|
65
|
+
resource.owner("root")
|
69
66
|
end
|
70
67
|
|
71
68
|
it "describes its state" do
|
72
|
-
state =
|
69
|
+
state = resource.state_for_resource_reporter
|
73
70
|
expect(state[:group]).to eq("wheel")
|
74
71
|
expect(state[:mode]).to eq("0664")
|
75
72
|
expect(state[:owner]).to eq("root")
|
76
73
|
end
|
77
74
|
|
78
75
|
it "returns the directory path as its identity" do
|
79
|
-
expect(
|
76
|
+
expect(resource.identity).to eq("/tmp/foo/bar/")
|
80
77
|
end
|
81
78
|
end
|
82
79
|
end
|