chef 12.0.0.alpha.1-x86-mingw32 → 12.0.0.alpha.2-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/chef/application.rb +8 -1
- data/lib/chef/application/apply.rb +4 -0
- data/lib/chef/application/client.rb +7 -7
- data/lib/chef/application/solo.rb +21 -13
- data/lib/chef/chef_fs/chef_fs_data_store.rb +60 -6
- data/lib/chef/chef_fs/config.rb +78 -4
- data/lib/chef/chef_fs/data_handler/acl_data_handler.rb +2 -2
- data/lib/chef/chef_fs/data_handler/client_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/container_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/cookbook_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/data_bag_item_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/data_handler_base.rb +76 -2
- data/lib/chef/chef_fs/data_handler/environment_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/group_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/node_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/organization_data_handler.rb +30 -0
- data/lib/chef/chef_fs/data_handler/organization_invites_data_handler.rb +17 -0
- data/lib/chef/chef_fs/data_handler/organization_members_data_handler.rb +17 -0
- data/lib/chef/chef_fs/data_handler/role_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/user_data_handler.rb +2 -1
- data/lib/chef/chef_fs/file_system.rb +0 -1
- data/lib/chef/chef_fs/file_system/acl_entry.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_repository_file_system_cookbook_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_repository_file_system_entry.rb +5 -1
- data/lib/chef/chef_fs/file_system/chef_repository_file_system_root_dir.rb +73 -13
- data/lib/chef/chef_fs/file_system/chef_server_root_dir.rb +44 -5
- data/lib/chef/chef_fs/file_system/cookbook_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/cookbooks_dir.rb +3 -3
- data/lib/chef/chef_fs/file_system/org_entry.rb +34 -0
- data/lib/chef/chef_fs/file_system/organization_invites_entry.rb +58 -0
- data/lib/chef/chef_fs/file_system/organization_members_entry.rb +57 -0
- data/lib/chef/chef_fs/file_system/rest_list_entry.rb +13 -4
- data/lib/chef/chef_fs/knife.rb +1 -1
- data/lib/chef/client.rb +8 -2
- data/lib/chef/config.rb +75 -57
- data/lib/chef/config_fetcher.rb +6 -21
- data/lib/chef/dsl/data_query.rb +48 -3
- data/lib/chef/dsl/platform_introspection.rb +42 -0
- data/lib/chef/dsl/reboot_pending.rb +6 -3
- data/lib/chef/encrypted_data_bag_item.rb +1 -1
- data/lib/chef/encrypted_data_bag_item/encryptor.rb +12 -0
- data/lib/chef/exceptions.rb +2 -0
- data/lib/chef/http/basic_client.rb +14 -0
- data/lib/chef/http/json_output.rb +7 -2
- data/lib/chef/knife.rb +36 -121
- data/lib/chef/knife/bootstrap.rb +68 -54
- data/lib/chef/knife/bootstrap/archlinux-gems.erb +6 -1
- data/lib/chef/knife/bootstrap/chef-aix.erb +5 -0
- data/lib/chef/knife/bootstrap/chef-full.erb +5 -1
- data/lib/chef/knife/core/bootstrap_context.rb +70 -29
- data/lib/chef/knife/search.rb +56 -12
- data/lib/chef/knife/serve.rb +1 -1
- data/lib/chef/local_mode.rb +10 -4
- data/lib/chef/mixin/deep_merge.rb +6 -3
- data/lib/chef/mixin/shell_out.rb +33 -17
- data/lib/chef/null_logger.rb +72 -0
- data/lib/chef/platform.rb +2 -1
- data/lib/chef/platform/provider_mapping.rb +1 -1
- data/lib/chef/platform/rebooter.rb +54 -0
- data/lib/chef/provider/ifconfig.rb +15 -16
- data/lib/chef/provider/link.rb +1 -1
- data/lib/chef/provider/mount/mount.rb +1 -1
- data/lib/chef/provider/mount/solaris.rb +102 -64
- data/lib/chef/provider/package/aix.rb +4 -12
- data/lib/chef/provider/package/ips.rb +8 -12
- data/lib/chef/provider/package/macports.rb +4 -12
- data/lib/chef/provider/package/pacman.rb +2 -6
- data/lib/chef/provider/package/portage.rb +2 -6
- data/lib/chef/provider/package/rpm.rb +4 -12
- data/lib/chef/provider/package/solaris.rb +4 -12
- data/lib/chef/provider/reboot.rb +69 -0
- data/lib/chef/provider/service/debian.rb +10 -10
- data/lib/chef/provider/service/freebsd.rb +89 -73
- data/lib/chef/provider/service/gentoo.rb +2 -2
- data/lib/chef/provider/service/init.rb +6 -4
- data/lib/chef/provider/service/insserv.rb +3 -3
- data/lib/chef/provider/service/macosx.rb +2 -2
- data/lib/chef/provider/service/simple.rb +6 -4
- data/lib/chef/provider/service/solaris.rb +1 -1
- data/lib/chef/provider/service/systemd.rb +9 -9
- data/lib/chef/provider/service/upstart.rb +6 -6
- data/lib/chef/provider/subversion.rb +6 -6
- data/lib/chef/provider/user/dscl.rb +32 -28
- data/lib/chef/provider/user/windows.rb +6 -6
- data/lib/chef/provider/whyrun_safe_ruby_block.rb +1 -1
- data/lib/chef/providers.rb +1 -0
- data/lib/chef/recipe.rb +0 -1
- data/lib/chef/resource.rb +3 -5
- data/lib/chef/resource/mount.rb +9 -0
- data/lib/chef/resource/reboot.rb +48 -0
- data/lib/chef/resources.rb +1 -0
- data/lib/chef/run_context.rb +25 -0
- data/lib/chef/search/query.rb +122 -14
- data/lib/chef/util/path_helper.rb +54 -6
- data/lib/chef/util/windows/net_user.rb +4 -1
- data/lib/chef/version.rb +1 -1
- data/lib/chef/win32/api/file.rb +1 -5
- data/lib/chef/win32/api/net.rb +1 -0
- data/lib/chef/workstation_config_loader.rb +177 -0
- data/spec/functional/http/simple_spec.rb +57 -1
- data/spec/functional/mixin/shell_out_spec.rb +2 -2
- data/spec/functional/provider/whyrun_safe_ruby_block_spec.rb +51 -0
- data/spec/functional/rebooter_spec.rb +105 -0
- data/spec/functional/resource/deploy_revision_spec.rb +0 -4
- data/spec/functional/resource/file_spec.rb +26 -3
- data/spec/functional/resource/group_spec.rb +5 -3
- data/spec/functional/resource/link_spec.rb +16 -16
- data/spec/functional/resource/reboot_spec.rb +103 -0
- data/spec/integration/client/client_spec.rb +4 -8
- data/spec/integration/client/ipv6_spec.rb +1 -1
- data/spec/integration/knife/cookbook_api_ipv6_spec.rb +3 -2
- data/spec/integration/knife/delete_spec.rb +39 -0
- data/spec/integration/knife/deps_spec.rb +30 -20
- data/spec/integration/knife/download_spec.rb +77 -1
- data/spec/integration/knife/list_spec.rb +221 -0
- data/spec/integration/knife/raw_spec.rb +1 -1
- data/spec/integration/knife/show_spec.rb +2 -2
- data/spec/integration/knife/upload_spec.rb +154 -1
- data/spec/support/pedant/run_pedant.rb +0 -1
- data/spec/support/shared/functional/http.rb +8 -1
- data/spec/support/shared/integration/integration_helper.rb +11 -19
- data/spec/support/shared/unit/platform_introspector.rb +22 -0
- data/spec/unit/application/apply.rb +11 -1
- data/spec/unit/application/solo_spec.rb +19 -3
- data/spec/unit/chef_fs/config_spec.rb +58 -0
- data/spec/unit/config_fetcher_spec.rb +1 -3
- data/spec/unit/config_spec.rb +247 -220
- data/spec/unit/dsl/data_query_spec.rb +165 -23
- data/spec/unit/dsl/reboot_pending_spec.rb +1 -7
- data/spec/unit/encrypted_data_bag_item_spec.rb +1 -1
- data/spec/unit/knife/bootstrap_spec.rb +354 -182
- data/spec/unit/knife/core/bootstrap_context_spec.rb +67 -30
- data/spec/unit/knife_spec.rb +3 -30
- data/spec/unit/mixin/deep_merge_spec.rb +14 -0
- data/spec/unit/mixin/shell_out_spec.rb +134 -64
- data/spec/unit/provider/ifconfig/debian_spec.rb +19 -9
- data/spec/unit/provider/ifconfig/redhat_spec.rb +16 -14
- data/spec/unit/provider/ifconfig_spec.rb +3 -3
- data/spec/unit/provider/link_spec.rb +5 -5
- data/spec/unit/provider/mount/mount_spec.rb +10 -1
- data/spec/unit/provider/mount/solaris_spec.rb +185 -11
- data/spec/unit/provider/package/aix_spec.rb +5 -17
- data/spec/unit/provider/package/ips_spec.rb +8 -21
- data/spec/unit/provider/package/macports_spec.rb +12 -12
- data/spec/unit/provider/package/pacman_spec.rb +4 -12
- data/spec/unit/provider/package/portage_spec.rb +5 -15
- data/spec/unit/provider/package/rpm_spec.rb +7 -22
- data/spec/unit/provider/package/solaris_spec.rb +5 -16
- data/spec/unit/provider/service/arch_service_spec.rb +8 -14
- data/spec/unit/provider/service/debian_service_spec.rb +1 -1
- data/spec/unit/provider/service/freebsd_service_spec.rb +457 -225
- data/spec/unit/provider/service/gentoo_service_spec.rb +2 -2
- data/spec/unit/provider/service/init_service_spec.rb +10 -10
- data/spec/unit/provider/service/insserv_service_spec.rb +3 -4
- data/spec/unit/provider/service/invokercd_service_spec.rb +8 -9
- data/spec/unit/provider/service/macosx_spec.rb +5 -5
- data/spec/unit/provider/service/simple_service_spec.rb +4 -6
- data/spec/unit/provider/service/solaris_smf_service_spec.rb +1 -3
- data/spec/unit/provider/service/systemd_service_spec.rb +20 -20
- data/spec/unit/provider/service/upstart_service_spec.rb +15 -17
- data/spec/unit/provider/subversion_spec.rb +5 -6
- data/spec/unit/provider/user/dscl_spec.rb +2 -1
- data/spec/unit/provider/user/windows_spec.rb +7 -0
- data/spec/unit/provider/whyrun_safe_ruby_block_spec.rb +2 -2
- data/spec/unit/resource/mount_spec.rb +9 -0
- data/spec/unit/resource_spec.rb +0 -4
- data/spec/unit/rest_spec.rb +1 -1
- data/spec/unit/run_context_spec.rb +15 -0
- data/spec/unit/search/query_spec.rb +196 -40
- data/spec/unit/util/path_helper_spec.rb +111 -28
- data/spec/unit/workstation_config_loader_spec.rb +283 -0
- metadata +36 -20
- data/lib/chef/knife/bootstrap/centos5-gems.erb +0 -62
- data/lib/chef/knife/bootstrap/fedora13-gems.erb +0 -44
- data/lib/chef/knife/bootstrap/ubuntu10.04-apt.erb +0 -53
- data/lib/chef/knife/bootstrap/ubuntu10.04-gems.erb +0 -48
- data/lib/chef/knife/bootstrap/ubuntu12.04-gems.erb +0 -46
- data/spec/support/shared/integration/chef_zero_support.rb +0 -130
- data/spec/unit/knife/config_file_selection_spec.rb +0 -135
@@ -37,22 +37,26 @@ describe Chef::Provider::Ifconfig::Redhat do
|
|
37
37
|
status = double("Status", :exitstatus => 0)
|
38
38
|
@provider.instance_variable_set("@status", status)
|
39
39
|
@provider.current_resource = @current_resource
|
40
|
-
|
40
|
+
|
41
|
+
config_filename = "/etc/sysconfig/network-scripts/ifcfg-#{@new_resource.device}"
|
42
|
+
@config = double("chef-resource-file")
|
43
|
+
@provider.should_receive(:resource_for_config).with(config_filename).and_return(@config)
|
44
|
+
end
|
41
45
|
|
42
46
|
describe "generate_config for action_add" do
|
43
47
|
|
44
|
-
|
48
|
+
it "should write network-script for centos" do
|
45
49
|
@provider.stub(:load_current_resource)
|
46
50
|
@provider.stub(:run_command)
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
+
@config.should_receive(:content) do |arg|
|
52
|
+
arg.should match(/^\s*DEVICE=eth0\s*$/)
|
53
|
+
arg.should match(/^\s*IPADDR=10\.0\.0\.1\s*$/)
|
54
|
+
arg.should match(/^\s*NETMASK=255\.255\.254\.0\s*$/)
|
55
|
+
end
|
56
|
+
@config.should_receive(:run_action).with(:create)
|
57
|
+
@config.should_receive(:updated?).and_return(true)
|
51
58
|
@provider.run_action(:add)
|
52
|
-
|
53
|
-
config_file.string.should match(/^\s*IPADDR=10\.0\.0\.1\s*$/)
|
54
|
-
config_file.string.should match(/^\s*NETMASK=255\.255\.254\.0\s*$/)
|
55
|
-
end
|
59
|
+
end
|
56
60
|
end
|
57
61
|
|
58
62
|
describe "delete_config for action_delete" do
|
@@ -61,10 +65,8 @@ describe Chef::Provider::Ifconfig::Redhat do
|
|
61
65
|
@current_resource.device @new_resource.device
|
62
66
|
@provider.stub(:load_current_resource)
|
63
67
|
@provider.stub(:run_command)
|
64
|
-
|
65
|
-
|
66
|
-
FileUtils.should_receive(:rm_f).with(config_filename, :verbose => false)
|
67
|
-
|
68
|
+
@config.should_receive(:run_action).with(:delete)
|
69
|
+
@config.should_receive(:updated?).and_return(true)
|
68
70
|
@provider.run_action(:delete)
|
69
71
|
end
|
70
72
|
end
|
@@ -72,7 +72,7 @@ describe Chef::Provider::Ifconfig do
|
|
72
72
|
@provider.stub(:load_current_resource)
|
73
73
|
@provider.should_not_receive(:run_command)
|
74
74
|
@current_resource.inet_addr "10.0.0.1"
|
75
|
-
@provider.
|
75
|
+
@provider.should_receive(:generate_config)
|
76
76
|
|
77
77
|
@provider.run_action(:add)
|
78
78
|
@new_resource.should_not be_updated
|
@@ -123,7 +123,7 @@ describe Chef::Provider::Ifconfig do
|
|
123
123
|
it "should not delete interface if it does not exist" do
|
124
124
|
@provider.stub(:load_current_resource)
|
125
125
|
@provider.should_not_receive(:run_command)
|
126
|
-
@provider.
|
126
|
+
@provider.should_receive(:delete_config)
|
127
127
|
|
128
128
|
@provider.run_action(:delete)
|
129
129
|
@new_resource.should_not be_updated
|
@@ -171,7 +171,7 @@ describe Chef::Provider::Ifconfig do
|
|
171
171
|
@provider.stub(:load_current_resource)
|
172
172
|
# This is so that nothing actually runs
|
173
173
|
@provider.should_not_receive(:run_command)
|
174
|
-
@provider.
|
174
|
+
@provider.should_receive(:delete_config)
|
175
175
|
|
176
176
|
@provider.run_action(:delete)
|
177
177
|
@new_resource.should_not be_updated
|
@@ -38,8 +38,8 @@ describe Chef::Resource::Link, :not_supported_on_win2k3 do
|
|
38
38
|
result
|
39
39
|
end
|
40
40
|
|
41
|
-
def
|
42
|
-
Chef::
|
41
|
+
def paths_eql?(path1, path2)
|
42
|
+
Chef::Util::PathHelper.paths_eql?(path1, path2)
|
43
43
|
end
|
44
44
|
|
45
45
|
describe "when the target is a symlink" do
|
@@ -68,7 +68,7 @@ describe Chef::Resource::Link, :not_supported_on_win2k3 do
|
|
68
68
|
provider.current_resource.link_type.should == :symbolic
|
69
69
|
end
|
70
70
|
it "should update the source of the existing link with the links target" do
|
71
|
-
provider.current_resource.to
|
71
|
+
paths_eql?(provider.current_resource.to, "#{CHEF_SPEC_DATA}/fofile").should be_true
|
72
72
|
end
|
73
73
|
it "should set the owner" do
|
74
74
|
provider.current_resource.owner.should == 501
|
@@ -110,7 +110,7 @@ describe Chef::Resource::Link, :not_supported_on_win2k3 do
|
|
110
110
|
provider.current_resource.link_type.should == :symbolic
|
111
111
|
end
|
112
112
|
it "should update the source of the existing link to the link's target" do
|
113
|
-
provider.current_resource.to
|
113
|
+
paths_eql?(provider.current_resource.to, "#{CHEF_SPEC_DATA}/fofile").should be_true
|
114
114
|
end
|
115
115
|
it "should not set the owner" do
|
116
116
|
provider.current_resource.owner.should be_nil
|
@@ -221,7 +221,7 @@ describe Chef::Resource::Link, :not_supported_on_win2k3 do
|
|
221
221
|
provider.current_resource.link_type.should == :hard
|
222
222
|
end
|
223
223
|
it "should update the source of the existing link to the link's target" do
|
224
|
-
provider.current_resource.to
|
224
|
+
paths_eql?(provider.current_resource.to, "#{CHEF_SPEC_DATA}/fofile").should be_true
|
225
225
|
end
|
226
226
|
it "should not set the owner" do
|
227
227
|
provider.current_resource.owner.should == nil
|
@@ -347,7 +347,16 @@ describe Chef::Provider::Mount::Mount do
|
|
347
347
|
it "should use mount -o remount if remount is supported" do
|
348
348
|
@new_resource.supports({:remount => true})
|
349
349
|
@current_resource.mounted(true)
|
350
|
-
@provider.should_receive(:shell_out!).with("mount -o remount #{@new_resource.mount_point}")
|
350
|
+
@provider.should_receive(:shell_out!).with("mount -o remount,defaults #{@new_resource.mount_point}")
|
351
|
+
@provider.remount_fs
|
352
|
+
end
|
353
|
+
|
354
|
+
it "should use mount -o remount with new mount options if remount is supported" do
|
355
|
+
@new_resource.supports({:remount => true})
|
356
|
+
options = "rw,noexec,noauto"
|
357
|
+
@new_resource.options(%w{rw noexec noauto})
|
358
|
+
@current_resource.mounted(true)
|
359
|
+
@provider.should_receive(:shell_out!).with("mount -o remount,rw,noexec,noauto #{@new_resource.mount_point}")
|
351
360
|
@provider.remount_fs
|
352
361
|
end
|
353
362
|
|
@@ -21,6 +21,7 @@ require 'ostruct'
|
|
21
21
|
|
22
22
|
# Do not run these tests on windows because some path handling
|
23
23
|
# code is not implemented to handle windows paths.
|
24
|
+
|
24
25
|
describe Chef::Provider::Mount::Solaris, :unix_only do
|
25
26
|
let(:node) { Chef::Node.new }
|
26
27
|
|
@@ -34,6 +35,8 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
|
|
34
35
|
|
35
36
|
let(:device) { "/dev/dsk/c0t2d0s7" }
|
36
37
|
|
38
|
+
let(:fsck_device) { "/dev/rdsk/c0t2d0s7" }
|
39
|
+
|
37
40
|
let(:mountpoint) { "/mnt/foo" }
|
38
41
|
|
39
42
|
let(:options) { nil }
|
@@ -42,9 +45,9 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
|
|
42
45
|
new_resource = Chef::Resource::Mount.new(mountpoint)
|
43
46
|
new_resource.device device
|
44
47
|
new_resource.device_type device_type
|
48
|
+
new_resource.fsck_device fsck_device
|
45
49
|
new_resource.fstype fstype
|
46
50
|
new_resource.options options
|
47
|
-
|
48
51
|
new_resource.supports :remount => false
|
49
52
|
new_resource
|
50
53
|
}
|
@@ -123,9 +126,10 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
|
|
123
126
|
expect { provider.run_action(:remount) }.to raise_error(Chef::Exceptions::Mount)
|
124
127
|
end
|
125
128
|
|
126
|
-
%w{tmpfs nfs ctfs proc mntfs objfs sharefs fd smbfs}.each do |ft|
|
129
|
+
%w{tmpfs nfs ctfs proc mntfs objfs sharefs fd smbfs vxfs}.each do |ft|
|
127
130
|
context "when the device has a fstype of #{ft}" do
|
128
131
|
let(:fstype) { ft }
|
132
|
+
let(:fsck_device) { "-" }
|
129
133
|
let(:device) { "something_that_is_not_a_file" }
|
130
134
|
|
131
135
|
before do
|
@@ -145,7 +149,7 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
|
|
145
149
|
end
|
146
150
|
|
147
151
|
describe "#load_current_resource" do
|
148
|
-
context "when loading a normal UFS filesystem" do
|
152
|
+
context "when loading a normal UFS filesystem with mount at boot" do
|
149
153
|
|
150
154
|
before do
|
151
155
|
provider.load_current_resource
|
@@ -167,6 +171,10 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
|
|
167
171
|
provider.current_resource.device.should == device
|
168
172
|
end
|
169
173
|
|
174
|
+
it "should set the fsck_device on the current_resource" do
|
175
|
+
provider.current_resource.fsck_device.should == fsck_device
|
176
|
+
end
|
177
|
+
|
170
178
|
it "should set the device_type on the current_resource" do
|
171
179
|
provider.current_resource.device_type.should == device_type
|
172
180
|
end
|
@@ -184,7 +192,7 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
|
|
184
192
|
end
|
185
193
|
|
186
194
|
it "should set the options field on the current_resource" do
|
187
|
-
expect(provider.current_resource.options).to eql(["-"
|
195
|
+
expect(provider.current_resource.options).to eql(["-"])
|
188
196
|
end
|
189
197
|
|
190
198
|
it "should set the pass field on the current_resource" do
|
@@ -201,6 +209,39 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
|
|
201
209
|
expect { provider.load_current_resource }.to_not raise_error
|
202
210
|
end
|
203
211
|
end
|
212
|
+
end
|
213
|
+
|
214
|
+
describe "#load_current_resource" do
|
215
|
+
context "when loading a normal UFS filesystem with noauto, don't mount at boot" do
|
216
|
+
|
217
|
+
let(:vfstab_file_contents) {
|
218
|
+
<<-EOF.gsub /^\s*/, ''
|
219
|
+
#device device mount FS fsck mount mount
|
220
|
+
#to mount to fsck point type pass at boot options
|
221
|
+
#
|
222
|
+
fd - /dev/fd fd - no -
|
223
|
+
/proc - /proc proc - no -
|
224
|
+
# swap
|
225
|
+
/dev/dsk/c0t0d0s1 - - swap - no -
|
226
|
+
# root
|
227
|
+
/dev/dsk/c0t0d0s0 /dev/rdsk/c0t0d0s0 / ufs 1 no -
|
228
|
+
# tmpfs
|
229
|
+
swap - /tmp tmpfs - yes -
|
230
|
+
# nfs
|
231
|
+
cartman:/share2 - /cartman nfs - yes rw,soft
|
232
|
+
# ufs
|
233
|
+
/dev/dsk/c0t2d0s7 /dev/rdsk/c0t2d0s7 /mnt/foo ufs 2 no -
|
234
|
+
EOF
|
235
|
+
}
|
236
|
+
|
237
|
+
before do
|
238
|
+
provider.load_current_resource
|
239
|
+
end
|
240
|
+
|
241
|
+
it "should set the options field on the current_resource" do
|
242
|
+
expect(provider.current_resource.options).to eql(["-", "noauto"])
|
243
|
+
end
|
244
|
+
end
|
204
245
|
|
205
246
|
context "when the device is an smbfs mount" do
|
206
247
|
let(:mount_output) {
|
@@ -214,6 +255,8 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
|
|
214
255
|
EOF
|
215
256
|
}
|
216
257
|
|
258
|
+
let(:fsck_device) { "-" }
|
259
|
+
|
217
260
|
it "should work at some point in the future" do
|
218
261
|
pending "SMBFS mounts on solaris look like they will need some future code work and more investigation"
|
219
262
|
end
|
@@ -232,6 +275,8 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
|
|
232
275
|
EOF
|
233
276
|
}
|
234
277
|
|
278
|
+
let(:fsck_device) { "-" }
|
279
|
+
|
235
280
|
let(:fstype) { "nfs" }
|
236
281
|
|
237
282
|
let(:device) { "cartman:/share2" }
|
@@ -271,11 +316,15 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
|
|
271
316
|
end
|
272
317
|
|
273
318
|
it "should set the options field on the current_resource" do
|
274
|
-
expect(provider.current_resource.options).to eql(["rw", "soft"
|
319
|
+
expect(provider.current_resource.options).to eql(["rw", "soft"])
|
275
320
|
end
|
276
321
|
|
277
322
|
it "should set the pass field on the current_resource" do
|
278
323
|
# is this correct or should it be nil?
|
324
|
+
#
|
325
|
+
# vfstab man page says.
|
326
|
+
# "A - is used to indicate no entry in a field."
|
327
|
+
# 0 and - could mean different things for some file systems
|
279
328
|
expect(provider.current_resource.pass).to eql(0)
|
280
329
|
end
|
281
330
|
|
@@ -313,7 +362,7 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
|
|
313
362
|
end
|
314
363
|
|
315
364
|
it "should have the correct mount options" do
|
316
|
-
expect(provider.current_resource.options).to eql(["-"
|
365
|
+
expect(provider.current_resource.options).to eql(["-"])
|
317
366
|
end
|
318
367
|
end
|
319
368
|
|
@@ -350,7 +399,7 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
|
|
350
399
|
end
|
351
400
|
|
352
401
|
it "should have the correct mount options" do
|
353
|
-
expect(provider.current_resource.options).to eql(["-"
|
402
|
+
expect(provider.current_resource.options).to eql(["-"])
|
354
403
|
end
|
355
404
|
end
|
356
405
|
|
@@ -515,8 +564,33 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
|
|
515
564
|
end
|
516
565
|
end
|
517
566
|
|
518
|
-
describe "remount_fs" do
|
567
|
+
describe "remount_fs without options and do not mount at boot" do
|
519
568
|
it "should use mount -o remount" do
|
569
|
+
new_resource.options(%w{noauto})
|
570
|
+
provider.should_receive(:shell_out!).with("mount -o remount #{new_resource.mount_point}")
|
571
|
+
provider.remount_fs
|
572
|
+
end
|
573
|
+
end
|
574
|
+
|
575
|
+
describe "remount_fs with options and do not mount at boot" do
|
576
|
+
it "should use mount -o remount,rw" do
|
577
|
+
new_resource.options(%w{rw noauto})
|
578
|
+
provider.should_receive(:shell_out!).with("mount -o remount,rw #{new_resource.mount_point}")
|
579
|
+
provider.remount_fs
|
580
|
+
end
|
581
|
+
end
|
582
|
+
|
583
|
+
describe "remount_fs with options and mount at boot" do
|
584
|
+
it "should use mount -o remount,rw" do
|
585
|
+
new_resource.options(%w{rw})
|
586
|
+
provider.should_receive(:shell_out!).with("mount -o remount,rw #{new_resource.mount_point}")
|
587
|
+
provider.remount_fs
|
588
|
+
end
|
589
|
+
end
|
590
|
+
|
591
|
+
describe "remount_fs without options and mount at boot" do
|
592
|
+
it "should use mount -o remount" do
|
593
|
+
new_resource.options([])
|
520
594
|
provider.should_receive(:shell_out!).with("mount -o remount #{new_resource.mount_point}")
|
521
595
|
provider.remount_fs
|
522
596
|
end
|
@@ -526,7 +600,7 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
|
|
526
600
|
context "in the typical case" do
|
527
601
|
let(:other_mount) { "/dev/dsk/c0t2d0s0 /dev/rdsk/c0t2d0s0 / ufs 2 yes -" }
|
528
602
|
|
529
|
-
let(:this_mount) { "/dev/dsk/c0t2d0s7\t
|
603
|
+
let(:this_mount) { "/dev/dsk/c0t2d0s7\t/dev/rdsk/c0t2d0s7\t/mnt/foo\tufs\t2\tyes\tdefaults\n" }
|
530
604
|
|
531
605
|
let(:vfstab_file_contents) { [other_mount].join("\n") }
|
532
606
|
|
@@ -548,9 +622,9 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
|
|
548
622
|
context "when the mount has options=noauto" do
|
549
623
|
let(:other_mount) { "/dev/dsk/c0t2d0s0 /dev/rdsk/c0t2d0s0 / ufs 2 yes -" }
|
550
624
|
|
551
|
-
let(:this_mount) { "/dev/dsk/c0t2d0s7\t
|
625
|
+
let(:this_mount) { "/dev/dsk/c0t2d0s7\t/dev/rdsk/c0t2d0s7\t/mnt/foo\tufs\t2\tno\t-\n" }
|
552
626
|
|
553
|
-
let(:options) {
|
627
|
+
let(:options) { "noauto" }
|
554
628
|
|
555
629
|
let(:vfstab_file_contents) { [other_mount].join("\n") }
|
556
630
|
|
@@ -568,6 +642,106 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
|
|
568
642
|
IO.read(vfstab_file.path).should match(/^#{Regexp.escape(this_mount)}/)
|
569
643
|
end
|
570
644
|
end
|
645
|
+
|
646
|
+
context "when the new mount has options of noauto and the existing mount has mount at boot yes" do
|
647
|
+
let(:existing_mount) { "/dev/dsk/c0t2d0s7\t/dev/rdsk/c0t2d0s7\t/mnt/foo\tufs\t2\tyes\t-" }
|
648
|
+
|
649
|
+
let(:this_mount) { "/dev/dsk/c0t2d0s7\t/dev/rdsk/c0t2d0s7\t/mnt/foo\tufs\t2\tno\t-\n" }
|
650
|
+
|
651
|
+
let(:options) { "noauto" }
|
652
|
+
|
653
|
+
let(:vfstab_file_contents) { [existing_mount].join("\n") }
|
654
|
+
|
655
|
+
before do
|
656
|
+
provider.stub(:etc_tempfile).and_yield(Tempfile.open("vfstab"))
|
657
|
+
provider.load_current_resource
|
658
|
+
provider.mount_options_unchanged?
|
659
|
+
provider.send(:vfstab_entry)
|
660
|
+
end
|
661
|
+
|
662
|
+
it "should detect a changed entry" do
|
663
|
+
provider.mount_options_unchanged?.should == false
|
664
|
+
end
|
665
|
+
|
666
|
+
it "should change mount at boot to no" do
|
667
|
+
provider.send(:vfstab_entry).should match(/^#{Regexp.escape(this_mount)}/)
|
668
|
+
end
|
669
|
+
end
|
670
|
+
|
671
|
+
context "when the new mount has options of - and the existing mount has mount at boot no" do
|
672
|
+
let(:existing_mount) { "/dev/dsk/c0t2d0s7\t/dev/rdsk/c0t2d0s7\t/mnt/foo\tufs\t2\tno\t-" }
|
673
|
+
|
674
|
+
let(:this_mount) { "/dev/dsk/c0t2d0s7\t/dev/rdsk/c0t2d0s7\t/mnt/foo\tufs\t2\tyes\t-\n" }
|
675
|
+
|
676
|
+
let(:options) { "-" }
|
677
|
+
|
678
|
+
let(:vfstab_file_contents) { [existing_mount].join("\n") }
|
679
|
+
|
680
|
+
before do
|
681
|
+
provider.stub(:etc_tempfile).and_yield(Tempfile.open("vfstab"))
|
682
|
+
provider.load_current_resource
|
683
|
+
provider.mount_options_unchanged?
|
684
|
+
provider.send(:vfstab_entry)
|
685
|
+
end
|
686
|
+
|
687
|
+
it "should detect a changed entry" do
|
688
|
+
provider.mount_options_unchanged?.should == false
|
689
|
+
end
|
690
|
+
|
691
|
+
it "should change mount at boot to yes" do
|
692
|
+
provider.send(:vfstab_entry).should match(/^#{Regexp.escape(this_mount)}/)
|
693
|
+
end
|
694
|
+
end
|
695
|
+
|
696
|
+
context "when the new mount has options of noauto and the existing mount has mount at boot no" do
|
697
|
+
let(:existing_mount) { "/dev/dsk/c0t2d0s7\t/dev/rdsk/c0t2d0s7\t/mnt/foo\tufs\t2\tno\t-" }
|
698
|
+
|
699
|
+
let(:this_mount) { "/dev/dsk/c0t2d0s7\t/dev/rdsk/c0t2d0s7\t/mnt/foo\tufs\t2\tno\t-\n" }
|
700
|
+
|
701
|
+
let(:options) { "-,noauto" }
|
702
|
+
|
703
|
+
let(:vfstab_file_contents) { [existing_mount].join("\n") }
|
704
|
+
|
705
|
+
before do
|
706
|
+
provider.stub(:etc_tempfile).and_yield(Tempfile.open("vfstab"))
|
707
|
+
provider.load_current_resource
|
708
|
+
provider.mount_options_unchanged?
|
709
|
+
provider.send(:vfstab_entry)
|
710
|
+
end
|
711
|
+
|
712
|
+
it "should detect an unchanged entry" do
|
713
|
+
provider.mount_options_unchanged?.should == true
|
714
|
+
end
|
715
|
+
|
716
|
+
it "should not change mount at boot" do
|
717
|
+
provider.send(:vfstab_entry).should match(/^#{Regexp.escape(this_mount)}/)
|
718
|
+
end
|
719
|
+
end
|
720
|
+
|
721
|
+
context "when the new mount has options of - and the existing mount has mount at boot yes" do
|
722
|
+
let(:existing_mount) { "/dev/dsk/c0t2d0s7\t/dev/rdsk/c0t2d0s7\t/mnt/foo\tufs\t2\tyes\t-" }
|
723
|
+
|
724
|
+
let(:this_mount) { "/dev/dsk/c0t2d0s7\t/dev/rdsk/c0t2d0s7\t/mnt/foo\tufs\t2\tyes\t-\n" }
|
725
|
+
|
726
|
+
let(:options) { "-" }
|
727
|
+
|
728
|
+
let(:vfstab_file_contents) { [existing_mount].join("\n") }
|
729
|
+
|
730
|
+
before do
|
731
|
+
provider.stub(:etc_tempfile).and_yield(Tempfile.open("vfstab"))
|
732
|
+
provider.load_current_resource
|
733
|
+
provider.mount_options_unchanged?
|
734
|
+
provider.send(:vfstab_entry)
|
735
|
+
end
|
736
|
+
|
737
|
+
it "should detect an unchanged entry" do
|
738
|
+
provider.mount_options_unchanged?.should == true
|
739
|
+
end
|
740
|
+
|
741
|
+
it "should not change mount at boot" do
|
742
|
+
provider.send(:vfstab_entry).should match(/^#{Regexp.escape(this_mount)}/)
|
743
|
+
end
|
744
|
+
end
|
571
745
|
end
|
572
746
|
|
573
747
|
describe "when disabling the fs" do
|