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
@@ -21,53 +21,49 @@ require "spec_helper"
|
|
21
21
|
|
22
22
|
describe Chef::Resource::Log do
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
@resource = Chef::Resource::Log.new(@log_str)
|
27
|
-
end
|
24
|
+
let(:log_str) { "this is my string to log" }
|
25
|
+
let(:resource) { Chef::Resource::Log.new(log_str) }
|
28
26
|
|
29
|
-
it "
|
30
|
-
expect(
|
31
|
-
expect(
|
27
|
+
it "creates a new Chef::Resource::Log" do
|
28
|
+
expect(resource).to be_a_kind_of(Chef::Resource)
|
29
|
+
expect(resource).to be_a_kind_of(Chef::Resource::Log)
|
32
30
|
end
|
33
31
|
|
34
32
|
it "supports the :write actions" do
|
35
|
-
expect(
|
33
|
+
expect(resource.allowed_actions).to include(:write)
|
36
34
|
end
|
37
35
|
|
38
|
-
it "
|
39
|
-
expect(
|
36
|
+
it "has a name of log" do
|
37
|
+
expect(resource.resource_name).to eq(:log)
|
40
38
|
end
|
41
39
|
|
42
|
-
it "
|
43
|
-
expect(
|
40
|
+
it "allows you to set a log string" do
|
41
|
+
expect(resource.name).to eq(log_str)
|
44
42
|
end
|
45
43
|
|
46
|
-
it "
|
47
|
-
expect(
|
44
|
+
it "sets the message to the first argument to new" do
|
45
|
+
expect(resource.message).to eq(log_str)
|
48
46
|
end
|
49
47
|
|
50
|
-
it "
|
51
|
-
|
52
|
-
expect(
|
48
|
+
it "accepts a string for the log message" do
|
49
|
+
resource.message "this is different"
|
50
|
+
expect(resource.message).to eq("this is different")
|
53
51
|
end
|
54
52
|
|
55
|
-
it "
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
expect {
|
53
|
+
it "accepts a vaild level option" do
|
54
|
+
resource.level :debug
|
55
|
+
resource.level :info
|
56
|
+
resource.level :warn
|
57
|
+
resource.level :error
|
58
|
+
resource.level :fatal
|
59
|
+
expect { resource.level :unsupported }.to raise_error(ArgumentError)
|
62
60
|
end
|
63
61
|
|
64
62
|
describe "when the identity is defined" do
|
65
|
-
|
66
|
-
@resource = Chef::Resource::Log.new("ery day I'm loggin-in")
|
67
|
-
end
|
63
|
+
let(:resource) { Chef::Resource::Log.new("ery day I'm loggin-in") }
|
68
64
|
|
69
65
|
it "returns the log string as its identity" do
|
70
|
-
expect(
|
66
|
+
expect(resource.identity).to eq("ery day I'm loggin-in")
|
71
67
|
end
|
72
68
|
end
|
73
69
|
end
|
@@ -21,86 +21,84 @@ require "spec_helper"
|
|
21
21
|
|
22
22
|
describe Chef::Resource::Mdadm do
|
23
23
|
|
24
|
-
|
25
|
-
@resource = Chef::Resource::Mdadm.new("fakey_fakerton")
|
26
|
-
end
|
24
|
+
let(:resource) { Chef::Resource::Mdadm.new("fakey_fakerton") }
|
27
25
|
|
28
|
-
it "
|
29
|
-
expect(
|
30
|
-
expect(
|
26
|
+
it "creates a new Chef::Resource::Mdadm" do
|
27
|
+
expect(resource).to be_a_kind_of(Chef::Resource)
|
28
|
+
expect(resource).to be_a_kind_of(Chef::Resource::Mdadm)
|
31
29
|
end
|
32
30
|
|
33
|
-
it "
|
34
|
-
expect(
|
31
|
+
it "has a resource name of :mdadm" do
|
32
|
+
expect(resource.resource_name).to eql(:mdadm)
|
35
33
|
end
|
36
34
|
|
37
|
-
it "
|
38
|
-
expect(
|
35
|
+
it "has a default action of create" do
|
36
|
+
expect(resource.action).to eql([:create])
|
39
37
|
end
|
40
38
|
|
41
|
-
it "
|
42
|
-
expect {
|
43
|
-
expect {
|
44
|
-
expect {
|
39
|
+
it "accepts create, assemble, stop as actions" do
|
40
|
+
expect { resource.action :create }.not_to raise_error
|
41
|
+
expect { resource.action :assemble }.not_to raise_error
|
42
|
+
expect { resource.action :stop }.not_to raise_error
|
45
43
|
end
|
46
44
|
|
47
|
-
it "
|
48
|
-
|
49
|
-
expect(
|
45
|
+
it "allows you to set the raid_device attribute" do
|
46
|
+
resource.raid_device "/dev/md3"
|
47
|
+
expect(resource.raid_device).to eql("/dev/md3")
|
50
48
|
end
|
51
49
|
|
52
|
-
it "
|
53
|
-
|
54
|
-
expect(
|
50
|
+
it "allows you to set the chunk attribute" do
|
51
|
+
resource.chunk 256
|
52
|
+
expect(resource.chunk).to eql(256)
|
55
53
|
end
|
56
54
|
|
57
|
-
it "
|
58
|
-
|
59
|
-
expect(
|
55
|
+
it "allows you to set the level attribute" do
|
56
|
+
resource.level 1
|
57
|
+
expect(resource.level).to eql(1)
|
60
58
|
end
|
61
59
|
|
62
|
-
it "
|
63
|
-
|
64
|
-
expect(
|
60
|
+
it "allows you to set the metadata attribute" do
|
61
|
+
resource.metadata "1.2"
|
62
|
+
expect(resource.metadata).to eql("1.2")
|
65
63
|
end
|
66
64
|
|
67
|
-
it "
|
68
|
-
|
69
|
-
expect(
|
65
|
+
it "allows you to set the bitmap attribute" do
|
66
|
+
resource.bitmap "internal"
|
67
|
+
expect(resource.bitmap).to eql("internal")
|
70
68
|
end
|
71
69
|
|
72
|
-
it "
|
73
|
-
|
74
|
-
expect(
|
70
|
+
it "allows you to set the layout attribute" do
|
71
|
+
resource.layout "f2"
|
72
|
+
expect(resource.layout).to eql("f2")
|
75
73
|
end
|
76
74
|
|
77
|
-
it "
|
78
|
-
|
79
|
-
expect(
|
75
|
+
it "allows you to set the devices attribute" do
|
76
|
+
resource.devices ["/dev/sda", "/dev/sdb"]
|
77
|
+
expect(resource.devices).to eql(["/dev/sda", "/dev/sdb"])
|
80
78
|
end
|
81
79
|
|
82
|
-
it "
|
83
|
-
|
84
|
-
expect(
|
80
|
+
it "allows you to set the exists attribute" do
|
81
|
+
resource.exists true
|
82
|
+
expect(resource.exists).to eql(true)
|
85
83
|
end
|
86
84
|
|
87
85
|
describe "when it has devices, level, and chunk" do
|
88
86
|
before do
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
87
|
+
resource.raid_device("raider")
|
88
|
+
resource.devices(%w{device1 device2})
|
89
|
+
resource.level(1)
|
90
|
+
resource.chunk(42)
|
93
91
|
end
|
94
92
|
|
95
93
|
it "describes its state" do
|
96
|
-
state =
|
94
|
+
state = resource.state_for_resource_reporter
|
97
95
|
expect(state[:devices]).to eql(%w{device1 device2})
|
98
96
|
expect(state[:level]).to eq(1)
|
99
97
|
expect(state[:chunk]).to eq(42)
|
100
98
|
end
|
101
99
|
|
102
100
|
it "returns the raid device as its identity" do
|
103
|
-
expect(
|
101
|
+
expect(resource.identity).to eq("raider")
|
104
102
|
end
|
105
103
|
end
|
106
104
|
|
@@ -20,189 +20,187 @@
|
|
20
20
|
require "spec_helper"
|
21
21
|
|
22
22
|
describe Chef::Resource::Mount do
|
23
|
-
|
24
|
-
@resource = Chef::Resource::Mount.new("filesystem")
|
25
|
-
end
|
23
|
+
let(:resource) { Chef::Resource::Mount.new("filesystem") }
|
26
24
|
|
27
|
-
it "
|
28
|
-
expect(
|
29
|
-
expect(
|
25
|
+
it "creates a new Chef::Resource::Mount" do
|
26
|
+
expect(resource).to be_a_kind_of(Chef::Resource)
|
27
|
+
expect(resource).to be_a_kind_of(Chef::Resource::Mount)
|
30
28
|
end
|
31
29
|
|
32
|
-
it "
|
33
|
-
expect(
|
30
|
+
it "has a name" do
|
31
|
+
expect(resource.name).to eql("filesystem")
|
34
32
|
end
|
35
33
|
|
36
|
-
it "
|
37
|
-
expect(
|
34
|
+
it "sets mount_point to the name" do
|
35
|
+
expect(resource.mount_point).to eql("filesystem")
|
38
36
|
end
|
39
37
|
|
40
|
-
it "
|
41
|
-
expect(
|
38
|
+
it "has a default action of mount" do
|
39
|
+
expect(resource.action).to eql([:mount])
|
42
40
|
end
|
43
41
|
|
44
|
-
it "
|
45
|
-
expect {
|
46
|
-
expect {
|
47
|
-
expect {
|
48
|
-
expect {
|
49
|
-
expect {
|
42
|
+
it "accepts mount, umount, unmount and remount as actions" do
|
43
|
+
expect { resource.action :mount }.not_to raise_error
|
44
|
+
expect { resource.action :umount }.not_to raise_error
|
45
|
+
expect { resource.action :unmount }.not_to raise_error
|
46
|
+
expect { resource.action :remount }.not_to raise_error
|
47
|
+
expect { resource.action :brooklyn }.to raise_error(ArgumentError)
|
50
48
|
end
|
51
49
|
|
52
|
-
it "
|
53
|
-
|
54
|
-
expect(
|
50
|
+
it "allows you to set the device attribute" do
|
51
|
+
resource.device "/dev/sdb3"
|
52
|
+
expect(resource.device).to eql("/dev/sdb3")
|
55
53
|
end
|
56
54
|
|
57
|
-
it "
|
58
|
-
expect(
|
55
|
+
it "sets fsck_device to '-' by default" do
|
56
|
+
expect(resource.fsck_device).to eql("-")
|
59
57
|
end
|
60
58
|
|
61
|
-
it "
|
62
|
-
|
63
|
-
expect(
|
59
|
+
it "allows you to set the fsck_device attribute" do
|
60
|
+
resource.fsck_device "/dev/rdsk/sdb3"
|
61
|
+
expect(resource.fsck_device).to eql("/dev/rdsk/sdb3")
|
64
62
|
end
|
65
63
|
|
66
|
-
it "
|
67
|
-
|
68
|
-
expect(
|
64
|
+
it "allows you to set the fstype attribute" do
|
65
|
+
resource.fstype "nfs"
|
66
|
+
expect(resource.fstype).to eql("nfs")
|
69
67
|
end
|
70
68
|
|
71
|
-
it "
|
72
|
-
|
73
|
-
expect(
|
69
|
+
it "allows you to set the dump attribute" do
|
70
|
+
resource.dump 1
|
71
|
+
expect(resource.dump).to eql(1)
|
74
72
|
end
|
75
73
|
|
76
|
-
it "
|
77
|
-
|
78
|
-
expect(
|
74
|
+
it "allows you to set the pass attribute" do
|
75
|
+
resource.pass 1
|
76
|
+
expect(resource.pass).to eql(1)
|
79
77
|
end
|
80
78
|
|
81
|
-
it "
|
82
|
-
expect(
|
79
|
+
it "sets the options attribute to defaults" do
|
80
|
+
expect(resource.options).to eql(["defaults"])
|
83
81
|
end
|
84
82
|
|
85
|
-
it "
|
86
|
-
|
87
|
-
expect(
|
83
|
+
it "allows options to be sent as a string, and convert to array" do
|
84
|
+
resource.options "rw,noexec"
|
85
|
+
expect(resource.options).to be_a_kind_of(Array)
|
88
86
|
end
|
89
87
|
|
90
|
-
it "
|
91
|
-
|
92
|
-
expect(
|
88
|
+
it "allows options attribute as an array" do
|
89
|
+
resource.options %w{ro nosuid}
|
90
|
+
expect(resource.options).to be_a_kind_of(Array)
|
93
91
|
end
|
94
92
|
|
95
|
-
it "
|
96
|
-
|
97
|
-
expect(
|
93
|
+
it "allows options to be sent as a delayed evaluator" do
|
94
|
+
resource.options Chef::DelayedEvaluator.new { %w{rw noexec} }
|
95
|
+
expect(resource.options).to eql(%w{rw noexec})
|
98
96
|
end
|
99
97
|
|
100
|
-
it "
|
101
|
-
|
102
|
-
expect(
|
103
|
-
expect(
|
98
|
+
it "allows options to be sent as a delayed evaluator, and convert to array" do
|
99
|
+
resource.options Chef::DelayedEvaluator.new { "rw,noexec" }
|
100
|
+
expect(resource.options).to be_a_kind_of(Array)
|
101
|
+
expect(resource.options).to eql(%w{rw noexec})
|
104
102
|
end
|
105
103
|
|
106
|
-
it "
|
107
|
-
|
108
|
-
expect(
|
104
|
+
it "accepts true for mounted" do
|
105
|
+
resource.mounted(true)
|
106
|
+
expect(resource.mounted).to eql(true)
|
109
107
|
end
|
110
108
|
|
111
|
-
it "
|
112
|
-
|
113
|
-
expect(
|
109
|
+
it "accepts false for mounted" do
|
110
|
+
resource.mounted(false)
|
111
|
+
expect(resource.mounted).to eql(false)
|
114
112
|
end
|
115
113
|
|
116
|
-
it "
|
117
|
-
expect(
|
114
|
+
it "sets mounted to false by default" do
|
115
|
+
expect(resource.mounted).to eql(false)
|
118
116
|
end
|
119
117
|
|
120
|
-
it "
|
121
|
-
expect {
|
118
|
+
it "does not accept a string for mounted" do
|
119
|
+
expect { resource.mounted("poop") }.to raise_error(ArgumentError)
|
122
120
|
end
|
123
121
|
|
124
|
-
it "
|
125
|
-
|
126
|
-
expect(
|
122
|
+
it "accepts true for enabled" do
|
123
|
+
resource.enabled(true)
|
124
|
+
expect(resource.enabled).to eql(true)
|
127
125
|
end
|
128
126
|
|
129
|
-
it "
|
130
|
-
|
131
|
-
expect(
|
127
|
+
it "accepts false for enabled" do
|
128
|
+
resource.enabled(false)
|
129
|
+
expect(resource.enabled).to eql(false)
|
132
130
|
end
|
133
131
|
|
134
|
-
it "
|
135
|
-
expect(
|
132
|
+
it "sets enabled to false by default" do
|
133
|
+
expect(resource.enabled).to eql(false)
|
136
134
|
end
|
137
135
|
|
138
|
-
it "
|
139
|
-
expect {
|
136
|
+
it "does not accept a string for enabled" do
|
137
|
+
expect { resource.enabled("poop") }.to raise_error(ArgumentError)
|
140
138
|
end
|
141
139
|
|
142
|
-
it "
|
140
|
+
it "defaults all feature support to false" do
|
143
141
|
support_hash = { :remount => false }
|
144
|
-
expect(
|
142
|
+
expect(resource.supports).to eq(support_hash)
|
145
143
|
end
|
146
144
|
|
147
|
-
it "
|
145
|
+
it "allows you to set feature support as an array" do
|
148
146
|
support_array = [ :remount ]
|
149
147
|
support_hash = { :remount => true }
|
150
|
-
|
151
|
-
expect(
|
148
|
+
resource.supports(support_array)
|
149
|
+
expect(resource.supports).to eq(support_hash)
|
152
150
|
end
|
153
151
|
|
154
|
-
it "
|
152
|
+
it "allows you to set feature support as a hash" do
|
155
153
|
support_hash = { :remount => true }
|
156
|
-
|
157
|
-
expect(
|
154
|
+
resource.supports(support_hash)
|
155
|
+
expect(resource.supports).to eq(support_hash)
|
158
156
|
end
|
159
157
|
|
160
|
-
it "
|
161
|
-
|
162
|
-
expect(
|
158
|
+
it "allows you to set username" do
|
159
|
+
resource.username("Administrator")
|
160
|
+
expect(resource.username).to eq("Administrator")
|
163
161
|
end
|
164
162
|
|
165
|
-
it "
|
166
|
-
|
167
|
-
expect(
|
163
|
+
it "allows you to set password" do
|
164
|
+
resource.password("Jetstream123!")
|
165
|
+
expect(resource.password).to eq("Jetstream123!")
|
168
166
|
end
|
169
167
|
|
170
|
-
it "
|
171
|
-
|
172
|
-
expect(
|
168
|
+
it "allows you to set domain" do
|
169
|
+
resource.domain("TEST_DOMAIN")
|
170
|
+
expect(resource.domain).to eq("TEST_DOMAIN")
|
173
171
|
end
|
174
172
|
|
175
173
|
describe "when it has mount point, device type, and fstype" do
|
176
174
|
before do
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
175
|
+
resource.device("charmander")
|
176
|
+
resource.mount_point("123.456")
|
177
|
+
resource.device_type(:device)
|
178
|
+
resource.fstype("ranked")
|
181
179
|
end
|
182
180
|
|
183
181
|
it "describes its state" do
|
184
|
-
state =
|
182
|
+
state = resource.state_for_resource_reporter
|
185
183
|
expect(state[:mount_point]).to eq("123.456")
|
186
184
|
expect(state[:device_type]).to eql(:device)
|
187
185
|
expect(state[:fstype]).to eq("ranked")
|
188
186
|
end
|
189
187
|
|
190
188
|
it "returns the device as its identity" do
|
191
|
-
expect(
|
189
|
+
expect(resource.identity).to eq("charmander")
|
192
190
|
end
|
193
191
|
end
|
194
192
|
|
195
193
|
describe "when it has username, password and domain" do
|
196
194
|
before do
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
195
|
+
resource.mount_point("T:")
|
196
|
+
resource.device("charmander")
|
197
|
+
resource.username("Administrator")
|
198
|
+
resource.password("Jetstream123!")
|
199
|
+
resource.domain("TEST_DOMAIN")
|
202
200
|
end
|
203
201
|
|
204
202
|
it "describes its state" do
|
205
|
-
state =
|
203
|
+
state = resource.state_for_resource_reporter
|
206
204
|
expect(state[:mount_point]).to eq("T:")
|
207
205
|
expect(state[:username]).to eq("Administrator")
|
208
206
|
expect(state[:password]).to eq("*sensitive value suppressed*")
|