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
@@ -128,14 +128,14 @@ describe Chef::Provider::Service::Gentoo do
|
|
128
128
|
|
129
129
|
describe Chef::Provider::Service::Gentoo, "enable_service" do
|
130
130
|
it "should call rc-update add *service* default" do
|
131
|
-
@provider.should_receive(:
|
131
|
+
@provider.should_receive(:shell_out!).with("/sbin/rc-update add chef default")
|
132
132
|
@provider.enable_service()
|
133
133
|
end
|
134
134
|
end
|
135
135
|
|
136
136
|
describe Chef::Provider::Service::Gentoo, "disable_service" do
|
137
137
|
it "should call rc-update del *service* default" do
|
138
|
-
@provider.should_receive(:
|
138
|
+
@provider.should_receive(:shell_out!).with("/sbin/rc-update del chef default")
|
139
139
|
@provider.disable_service()
|
140
140
|
end
|
141
141
|
end
|
@@ -100,7 +100,7 @@ PS
|
|
100
100
|
end
|
101
101
|
|
102
102
|
it "should use the init_command if one has been specified" do
|
103
|
-
@provider.should_receive(:
|
103
|
+
@provider.should_receive(:shell_out_with_systems_locale!).with("/opt/chef-server/service/erchef start")
|
104
104
|
@provider.start_service
|
105
105
|
end
|
106
106
|
|
@@ -126,7 +126,6 @@ PS
|
|
126
126
|
|
127
127
|
end
|
128
128
|
|
129
|
-
|
130
129
|
describe "when we have a 'ps' attribute" do
|
131
130
|
it "should shell_out! the node's ps command" do
|
132
131
|
@provider.should_receive(:shell_out!).and_return(@status)
|
@@ -165,12 +164,12 @@ RUNNING_PS
|
|
165
164
|
describe "when starting the service" do
|
166
165
|
it "should call the start command if one is specified" do
|
167
166
|
@new_resource.start_command("/etc/init.d/chef startyousillysally")
|
168
|
-
@provider.should_receive(:
|
167
|
+
@provider.should_receive(:shell_out_with_systems_locale!).with("/etc/init.d/chef startyousillysally")
|
169
168
|
@provider.start_service()
|
170
169
|
end
|
171
170
|
|
172
171
|
it "should call '/etc/init.d/service_name start' if no start command is specified" do
|
173
|
-
@provider.should_receive(:
|
172
|
+
@provider.should_receive(:shell_out_with_systems_locale!).with("/etc/init.d/#{@new_resource.service_name} start")
|
174
173
|
@provider.start_service()
|
175
174
|
end
|
176
175
|
end
|
@@ -178,12 +177,12 @@ RUNNING_PS
|
|
178
177
|
describe Chef::Provider::Service::Init, "stop_service" do
|
179
178
|
it "should call the stop command if one is specified" do
|
180
179
|
@new_resource.stop_command("/etc/init.d/chef itoldyoutostop")
|
181
|
-
@provider.should_receive(:
|
180
|
+
@provider.should_receive(:shell_out_with_systems_locale!).with("/etc/init.d/chef itoldyoutostop")
|
182
181
|
@provider.stop_service()
|
183
182
|
end
|
184
183
|
|
185
184
|
it "should call '/etc/init.d/service_name stop' if no stop command is specified" do
|
186
|
-
@provider.should_receive(:
|
185
|
+
@provider.should_receive(:shell_out_with_systems_locale!).with("/etc/init.d/#{@new_resource.service_name} stop")
|
187
186
|
@provider.stop_service()
|
188
187
|
end
|
189
188
|
end
|
@@ -191,13 +190,13 @@ RUNNING_PS
|
|
191
190
|
describe "when restarting a service" do
|
192
191
|
it "should call 'restart' on the service_name if the resource supports it" do
|
193
192
|
@new_resource.supports({:restart => true})
|
194
|
-
@provider.should_receive(:
|
193
|
+
@provider.should_receive(:shell_out_with_systems_locale!).with("/etc/init.d/#{@new_resource.service_name} restart")
|
195
194
|
@provider.restart_service()
|
196
195
|
end
|
197
196
|
|
198
197
|
it "should call the restart_command if one has been specified" do
|
199
198
|
@new_resource.restart_command("/etc/init.d/chef restartinafire")
|
200
|
-
@provider.should_receive(:
|
199
|
+
@provider.should_receive(:shell_out_with_systems_locale!).with("/etc/init.d/#{@new_resource.service_name} restartinafire")
|
201
200
|
@provider.restart_service()
|
202
201
|
end
|
203
202
|
|
@@ -212,13 +211,13 @@ RUNNING_PS
|
|
212
211
|
describe "when reloading a service" do
|
213
212
|
it "should call 'reload' on the service if it supports it" do
|
214
213
|
@new_resource.supports({:reload => true})
|
215
|
-
@provider.should_receive(:
|
214
|
+
@provider.should_receive(:shell_out_with_systems_locale!).with("/etc/init.d/chef reload")
|
216
215
|
@provider.reload_service()
|
217
216
|
end
|
218
217
|
|
219
218
|
it "should should run the user specified reload command if one is specified and the service doesn't support reload" do
|
220
219
|
@new_resource.reload_command("/etc/init.d/chef lollerpants")
|
221
|
-
@provider.should_receive(:
|
220
|
+
@provider.should_receive(:shell_out_with_systems_locale!).with("/etc/init.d/chef lollerpants")
|
222
221
|
@provider.reload_service()
|
223
222
|
end
|
224
223
|
end
|
@@ -226,6 +225,7 @@ RUNNING_PS
|
|
226
225
|
describe "when a custom command has been specified" do
|
227
226
|
before do
|
228
227
|
@new_resource.start_command("/etc/init.d/chef startyousillysally")
|
228
|
+
@provider.should_receive(:shell_out_with_systems_locale!).with("/etc/init.d/chef startyousillysally")
|
229
229
|
end
|
230
230
|
|
231
231
|
it "should still pass all why run assertions" do
|
@@ -60,17 +60,16 @@ describe Chef::Provider::Service::Insserv do
|
|
60
60
|
|
61
61
|
describe "enable_service" do
|
62
62
|
it "should call insserv and create the default links" do
|
63
|
-
@provider.should_receive(:
|
64
|
-
@provider.should_receive(:
|
63
|
+
@provider.should_receive(:shell_out!).with("/sbin/insserv -r -f #{@new_resource.service_name}")
|
64
|
+
@provider.should_receive(:shell_out!).with("/sbin/insserv -d -f #{@new_resource.service_name}")
|
65
65
|
@provider.enable_service
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
69
|
describe "disable_service" do
|
70
70
|
it "should call insserv and remove the links" do
|
71
|
-
@provider.should_receive(:
|
71
|
+
@provider.should_receive(:shell_out!).with("/sbin/insserv -r -f #{@new_resource.service_name}")
|
72
72
|
@provider.disable_service
|
73
73
|
end
|
74
74
|
end
|
75
75
|
end
|
76
|
-
|
@@ -110,7 +110,6 @@ PS
|
|
110
110
|
|
111
111
|
end
|
112
112
|
|
113
|
-
|
114
113
|
describe "when we have a 'ps' attribute" do
|
115
114
|
it "should shell_out! the node's ps command" do
|
116
115
|
@status = double("Status", :exitstatus => 0, :stdout => @stdout)
|
@@ -152,12 +151,12 @@ RUNNING_PS
|
|
152
151
|
describe "when starting the service" do
|
153
152
|
it "should call the start command if one is specified" do
|
154
153
|
@new_resource.start_command("/usr/sbin/invoke-rc.d chef startyousillysally")
|
155
|
-
@provider.should_receive(:
|
154
|
+
@provider.should_receive(:shell_out_with_systems_locale!).with("/usr/sbin/invoke-rc.d chef startyousillysally")
|
156
155
|
@provider.start_service()
|
157
156
|
end
|
158
157
|
|
159
158
|
it "should call '/usr/sbin/invoke-rc.d service_name start' if no start command is specified" do
|
160
|
-
@provider.should_receive(:
|
159
|
+
@provider.should_receive(:shell_out_with_systems_locale!).with("/usr/sbin/invoke-rc.d #{@new_resource.service_name} start")
|
161
160
|
@provider.start_service()
|
162
161
|
end
|
163
162
|
end
|
@@ -165,12 +164,12 @@ RUNNING_PS
|
|
165
164
|
describe Chef::Provider::Service::Invokercd, "stop_service" do
|
166
165
|
it "should call the stop command if one is specified" do
|
167
166
|
@new_resource.stop_command("/usr/sbin/invoke-rc.d chef itoldyoutostop")
|
168
|
-
@provider.should_receive(:
|
167
|
+
@provider.should_receive(:shell_out_with_systems_locale!).with("/usr/sbin/invoke-rc.d chef itoldyoutostop")
|
169
168
|
@provider.stop_service()
|
170
169
|
end
|
171
170
|
|
172
171
|
it "should call '/usr/sbin/invoke-rc.d service_name stop' if no stop command is specified" do
|
173
|
-
@provider.should_receive(:
|
172
|
+
@provider.should_receive(:shell_out_with_systems_locale!).with("/usr/sbin/invoke-rc.d #{@new_resource.service_name} stop")
|
174
173
|
@provider.stop_service()
|
175
174
|
end
|
176
175
|
end
|
@@ -178,13 +177,13 @@ RUNNING_PS
|
|
178
177
|
describe "when restarting a service" do
|
179
178
|
it "should call 'restart' on the service_name if the resource supports it" do
|
180
179
|
@new_resource.supports({:restart => true})
|
181
|
-
@provider.should_receive(:
|
180
|
+
@provider.should_receive(:shell_out_with_systems_locale!).with("/usr/sbin/invoke-rc.d #{@new_resource.service_name} restart")
|
182
181
|
@provider.restart_service()
|
183
182
|
end
|
184
183
|
|
185
184
|
it "should call the restart_command if one has been specified" do
|
186
185
|
@new_resource.restart_command("/usr/sbin/invoke-rc.d chef restartinafire")
|
187
|
-
@provider.should_receive(:
|
186
|
+
@provider.should_receive(:shell_out_with_systems_locale!).with("/usr/sbin/invoke-rc.d #{@new_resource.service_name} restartinafire")
|
188
187
|
@provider.restart_service()
|
189
188
|
end
|
190
189
|
|
@@ -199,13 +198,13 @@ RUNNING_PS
|
|
199
198
|
describe "when reloading a service" do
|
200
199
|
it "should call 'reload' on the service if it supports it" do
|
201
200
|
@new_resource.supports({:reload => true})
|
202
|
-
@provider.should_receive(:
|
201
|
+
@provider.should_receive(:shell_out_with_systems_locale!).with("/usr/sbin/invoke-rc.d chef reload")
|
203
202
|
@provider.reload_service()
|
204
203
|
end
|
205
204
|
|
206
205
|
it "should should run the user specified reload command if one is specified and the service doesn't support reload" do
|
207
206
|
@new_resource.reload_command("/usr/sbin/invoke-rc.d chef lollerpants")
|
208
|
-
@provider.should_receive(:
|
207
|
+
@provider.should_receive(:shell_out_with_systems_locale!).with("/usr/sbin/invoke-rc.d chef lollerpants")
|
209
208
|
@provider.reload_service()
|
210
209
|
end
|
211
210
|
end
|
@@ -226,7 +226,7 @@ SVC_LIST
|
|
226
226
|
it "calls the start command if one is specified and service is not running" do
|
227
227
|
new_resource.stub(:start_command).and_return("cowsay dirty")
|
228
228
|
|
229
|
-
provider.should_receive(:
|
229
|
+
provider.should_receive(:shell_out_with_systems_locale!).with("cowsay dirty")
|
230
230
|
provider.start_service
|
231
231
|
end
|
232
232
|
|
@@ -238,7 +238,7 @@ SVC_LIST
|
|
238
238
|
end
|
239
239
|
|
240
240
|
it "starts service via launchctl if service found" do
|
241
|
-
provider.should_receive(:
|
241
|
+
provider.should_receive(:shell_out_with_systems_locale!).
|
242
242
|
with("launchctl load -w '/Users/igor/Library/LaunchAgents/io.redis.redis-server.plist'",
|
243
243
|
:group => 1001, :user => 101).
|
244
244
|
and_return(0)
|
@@ -258,7 +258,7 @@ SVC_LIST
|
|
258
258
|
it "calls the stop command if one is specified and service is running" do
|
259
259
|
new_resource.stub(:stop_command).and_return("kill -9 123")
|
260
260
|
|
261
|
-
provider.should_receive(:
|
261
|
+
provider.should_receive(:shell_out_with_systems_locale!).with("kill -9 123")
|
262
262
|
provider.stop_service
|
263
263
|
end
|
264
264
|
|
@@ -270,7 +270,7 @@ SVC_LIST
|
|
270
270
|
end
|
271
271
|
|
272
272
|
it "stops the service via launchctl if service found" do
|
273
|
-
provider.should_receive(:
|
273
|
+
provider.should_receive(:shell_out_with_systems_locale!).
|
274
274
|
with("launchctl unload '/Users/igor/Library/LaunchAgents/io.redis.redis-server.plist'",
|
275
275
|
:group => 1001, :user => 101).
|
276
276
|
and_return(0)
|
@@ -291,7 +291,7 @@ SVC_LIST
|
|
291
291
|
it "issues a command if given" do
|
292
292
|
new_resource.stub(:restart_command).and_return("reload that thing")
|
293
293
|
|
294
|
-
provider.should_receive(:
|
294
|
+
provider.should_receive(:shell_out_with_systems_locale!).with("reload that thing")
|
295
295
|
provider.restart_service
|
296
296
|
end
|
297
297
|
|
@@ -104,12 +104,10 @@ NOMOCKINGSTRINGSPLZ
|
|
104
104
|
@provider.load_current_resource.should eql(@current_resource)
|
105
105
|
end
|
106
106
|
|
107
|
-
|
108
|
-
|
109
107
|
describe "when starting the service" do
|
110
108
|
it "should call the start command if one is specified" do
|
111
109
|
@new_resource.stub(:start_command).and_return("#{@new_resource.start_command}")
|
112
|
-
@provider.should_receive(:
|
110
|
+
@provider.should_receive(:shell_out_with_systems_locale!).with("#{@new_resource.start_command}")
|
113
111
|
@provider.start_service()
|
114
112
|
end
|
115
113
|
|
@@ -123,7 +121,7 @@ NOMOCKINGSTRINGSPLZ
|
|
123
121
|
describe "when stopping a service" do
|
124
122
|
it "should call the stop command if one is specified" do
|
125
123
|
@new_resource.stop_command("/etc/init.d/themadness stop")
|
126
|
-
@provider.should_receive(:
|
124
|
+
@provider.should_receive(:shell_out_with_systems_locale!).with("/etc/init.d/themadness stop")
|
127
125
|
@provider.stop_service()
|
128
126
|
end
|
129
127
|
|
@@ -137,7 +135,7 @@ NOMOCKINGSTRINGSPLZ
|
|
137
135
|
describe Chef::Provider::Service::Simple, "restart_service" do
|
138
136
|
it "should call the restart command if one has been specified" do
|
139
137
|
@new_resource.restart_command("/etc/init.d/foo restart")
|
140
|
-
@provider.should_receive(:
|
138
|
+
@provider.should_receive(:shell_out_with_systems_locale!).with("/etc/init.d/foo restart")
|
141
139
|
@provider.restart_service()
|
142
140
|
end
|
143
141
|
|
@@ -164,7 +162,7 @@ NOMOCKINGSTRINGSPLZ
|
|
164
162
|
|
165
163
|
it "should should run the user specified reload command if one is specified" do
|
166
164
|
@new_resource.reload_command("kill -9 1")
|
167
|
-
@provider.should_receive(:
|
165
|
+
@provider.should_receive(:shell_out_with_systems_locale!).with("kill -9 1")
|
168
166
|
@provider.reload_service()
|
169
167
|
end
|
170
168
|
end
|
@@ -59,7 +59,6 @@ describe Chef::Provider::Service::Solaris do
|
|
59
59
|
@provider.load_current_resource
|
60
60
|
end
|
61
61
|
|
62
|
-
|
63
62
|
it "should return the current resource" do
|
64
63
|
@provider.stub(:shell_out!).with("/bin/svcs -l chef").and_return(@status)
|
65
64
|
@provider.load_current_resource.should eql(@current_resource)
|
@@ -131,7 +130,6 @@ describe Chef::Provider::Service::Solaris do
|
|
131
130
|
end
|
132
131
|
end
|
133
132
|
|
134
|
-
|
135
133
|
describe "when disabling the service" do
|
136
134
|
before(:each) do
|
137
135
|
@provider.current_resource = @current_resource
|
@@ -159,7 +157,7 @@ describe Chef::Provider::Service::Solaris do
|
|
159
157
|
end
|
160
158
|
|
161
159
|
it "should call svcadm refresh chef" do
|
162
|
-
@provider.should_receive(:
|
160
|
+
@provider.should_receive(:shell_out_with_systems_locale!).with("/usr/sbin/svcadm refresh chef").and_return(@status)
|
163
161
|
@provider.reload_service
|
164
162
|
end
|
165
163
|
|
@@ -74,25 +74,25 @@ describe Chef::Provider::Service::Systemd do
|
|
74
74
|
end
|
75
75
|
|
76
76
|
it "should run the services status command if one has been specified" do
|
77
|
-
@provider.stub(:
|
77
|
+
@provider.stub(:shell_out).and_return(@shell_out_success)
|
78
78
|
@current_resource.should_receive(:running).with(true)
|
79
79
|
@provider.load_current_resource
|
80
80
|
end
|
81
81
|
|
82
82
|
it "should run the services status command if one has been specified and properly set status check state" do
|
83
|
-
@provider.stub(:
|
83
|
+
@provider.stub(:shell_out).with("/bin/chefhasmonkeypants status").and_return(@shell_out_success)
|
84
84
|
@provider.load_current_resource
|
85
85
|
@provider.instance_variable_get("@status_check_success").should be_true
|
86
86
|
end
|
87
87
|
|
88
88
|
it "should set running to false if a status command fails" do
|
89
|
-
@provider.stub(:
|
89
|
+
@provider.stub(:shell_out).and_return(@shell_out_failure)
|
90
90
|
@current_resource.should_receive(:running).with(false)
|
91
91
|
@provider.load_current_resource
|
92
92
|
end
|
93
93
|
|
94
94
|
it "should update state to indicate status check failed when a status command fails" do
|
95
|
-
@provider.stub(:
|
95
|
+
@provider.stub(:shell_out).and_return(@shell_out_failure)
|
96
96
|
@provider.load_current_resource
|
97
97
|
@provider.instance_variable_get("@status_check_success").should be_false
|
98
98
|
end
|
@@ -129,31 +129,31 @@ describe Chef::Provider::Service::Systemd do
|
|
129
129
|
|
130
130
|
it "should call the start command if one is specified" do
|
131
131
|
@new_resource.stub(:start_command).and_return("/sbin/rsyslog startyousillysally")
|
132
|
-
@provider.should_receive(:
|
132
|
+
@provider.should_receive(:shell_out_with_systems_locale!).with("/sbin/rsyslog startyousillysally")
|
133
133
|
@provider.start_service
|
134
134
|
end
|
135
135
|
|
136
136
|
it "should call '/bin/systemctl start service_name' if no start command is specified" do
|
137
|
-
@provider.should_receive(:shell_out_with_systems_locale).with("/bin/systemctl start #{@new_resource.service_name}").and_return(@shell_out_success)
|
137
|
+
@provider.should_receive(:shell_out_with_systems_locale!).with("/bin/systemctl start #{@new_resource.service_name}").and_return(@shell_out_success)
|
138
138
|
@provider.start_service
|
139
139
|
end
|
140
140
|
|
141
141
|
it "should not call '/bin/systemctl start service_name' if it is already running" do
|
142
142
|
@current_resource.stub(:running).and_return(true)
|
143
|
-
@provider.should_not_receive(:shell_out_with_systems_locale).with("/bin/systemctl start #{@new_resource.service_name}")
|
143
|
+
@provider.should_not_receive(:shell_out_with_systems_locale!).with("/bin/systemctl start #{@new_resource.service_name}")
|
144
144
|
@provider.start_service
|
145
145
|
end
|
146
146
|
|
147
147
|
it "should call the restart command if one is specified" do
|
148
148
|
@current_resource.stub(:running).and_return(true)
|
149
149
|
@new_resource.stub(:restart_command).and_return("/sbin/rsyslog restartyousillysally")
|
150
|
-
@provider.should_receive(:
|
150
|
+
@provider.should_receive(:shell_out_with_systems_locale!).with("/sbin/rsyslog restartyousillysally")
|
151
151
|
@provider.restart_service
|
152
152
|
end
|
153
153
|
|
154
154
|
it "should call '/bin/systemctl restart service_name' if no restart command is specified" do
|
155
155
|
@current_resource.stub(:running).and_return(true)
|
156
|
-
@provider.should_receive(:shell_out_with_systems_locale).with("/bin/systemctl restart #{@new_resource.service_name}").and_return(@shell_out_success)
|
156
|
+
@provider.should_receive(:shell_out_with_systems_locale!).with("/bin/systemctl restart #{@new_resource.service_name}").and_return(@shell_out_success)
|
157
157
|
@provider.restart_service
|
158
158
|
end
|
159
159
|
|
@@ -162,7 +162,7 @@ describe Chef::Provider::Service::Systemd do
|
|
162
162
|
it "should call the reload command" do
|
163
163
|
@current_resource.stub(:running).and_return(true)
|
164
164
|
@new_resource.stub(:reload_command).and_return("/sbin/rsyslog reloadyousillysally")
|
165
|
-
@provider.should_receive(:
|
165
|
+
@provider.should_receive(:shell_out_with_systems_locale!).with("/sbin/rsyslog reloadyousillysally")
|
166
166
|
@provider.reload_service
|
167
167
|
end
|
168
168
|
end
|
@@ -170,7 +170,7 @@ describe Chef::Provider::Service::Systemd do
|
|
170
170
|
context "when a reload command is not specified" do
|
171
171
|
it "should call '/bin/systemctl reload service_name' if the service is running" do
|
172
172
|
@current_resource.stub(:running).and_return(true)
|
173
|
-
@provider.should_receive(:shell_out_with_systems_locale).with("/bin/systemctl reload #{@new_resource.service_name}").and_return(@shell_out_success)
|
173
|
+
@provider.should_receive(:shell_out_with_systems_locale!).with("/bin/systemctl reload #{@new_resource.service_name}").and_return(@shell_out_success)
|
174
174
|
@provider.reload_service
|
175
175
|
end
|
176
176
|
|
@@ -185,19 +185,19 @@ describe Chef::Provider::Service::Systemd do
|
|
185
185
|
it "should call the stop command if one is specified" do
|
186
186
|
@current_resource.stub(:running).and_return(true)
|
187
187
|
@new_resource.stub(:stop_command).and_return("/sbin/rsyslog stopyousillysally")
|
188
|
-
@provider.should_receive(:
|
188
|
+
@provider.should_receive(:shell_out_with_systems_locale!).with("/sbin/rsyslog stopyousillysally")
|
189
189
|
@provider.stop_service
|
190
190
|
end
|
191
191
|
|
192
192
|
it "should call '/bin/systemctl stop service_name' if no stop command is specified" do
|
193
193
|
@current_resource.stub(:running).and_return(true)
|
194
|
-
@provider.should_receive(:shell_out_with_systems_locale).with("/bin/systemctl stop #{@new_resource.service_name}").and_return(@shell_out_success)
|
194
|
+
@provider.should_receive(:shell_out_with_systems_locale!).with("/bin/systemctl stop #{@new_resource.service_name}").and_return(@shell_out_success)
|
195
195
|
@provider.stop_service
|
196
196
|
end
|
197
197
|
|
198
198
|
it "should not call '/bin/systemctl stop service_name' if it is already stopped" do
|
199
199
|
@current_resource.stub(:running).and_return(false)
|
200
|
-
@provider.should_not_receive(:shell_out_with_systems_locale).with("/bin/systemctl stop #{@new_resource.service_name}")
|
200
|
+
@provider.should_not_receive(:shell_out_with_systems_locale!).with("/bin/systemctl stop #{@new_resource.service_name}")
|
201
201
|
@provider.stop_service
|
202
202
|
end
|
203
203
|
end
|
@@ -210,12 +210,12 @@ describe Chef::Provider::Service::Systemd do
|
|
210
210
|
end
|
211
211
|
|
212
212
|
it "should call '/bin/systemctl enable service_name' to enable the service" do
|
213
|
-
@provider.should_receive(:
|
213
|
+
@provider.should_receive(:shell_out!).with("/bin/systemctl enable #{@new_resource.service_name}").and_return(@shell_out_success)
|
214
214
|
@provider.enable_service
|
215
215
|
end
|
216
216
|
|
217
217
|
it "should call '/bin/systemctl disable service_name' to disable the service" do
|
218
|
-
@provider.should_receive(:
|
218
|
+
@provider.should_receive(:shell_out!).with("/bin/systemctl disable #{@new_resource.service_name}").and_return(@shell_out_success)
|
219
219
|
@provider.disable_service
|
220
220
|
end
|
221
221
|
end
|
@@ -227,12 +227,12 @@ describe Chef::Provider::Service::Systemd do
|
|
227
227
|
end
|
228
228
|
|
229
229
|
it "should return true if '/bin/systemctl is-active service_name' returns 0" do
|
230
|
-
@provider.should_receive(:
|
230
|
+
@provider.should_receive(:shell_out).with('/bin/systemctl is-active rsyslog.service --quiet').and_return(@shell_out_success)
|
231
231
|
@provider.is_active?.should be_true
|
232
232
|
end
|
233
233
|
|
234
234
|
it "should return false if '/bin/systemctl is-active service_name' returns anything except 0" do
|
235
|
-
@provider.should_receive(:
|
235
|
+
@provider.should_receive(:shell_out).with('/bin/systemctl is-active rsyslog.service --quiet').and_return(@shell_out_failure)
|
236
236
|
@provider.is_active?.should be_false
|
237
237
|
end
|
238
238
|
end
|
@@ -244,12 +244,12 @@ describe Chef::Provider::Service::Systemd do
|
|
244
244
|
end
|
245
245
|
|
246
246
|
it "should return true if '/bin/systemctl is-enabled service_name' returns 0" do
|
247
|
-
@provider.should_receive(:
|
247
|
+
@provider.should_receive(:shell_out).with('/bin/systemctl is-enabled rsyslog.service --quiet').and_return(@shell_out_success)
|
248
248
|
@provider.is_enabled?.should be_true
|
249
249
|
end
|
250
250
|
|
251
251
|
it "should return false if '/bin/systemctl is-enabled service_name' returns anything except 0" do
|
252
|
-
@provider.should_receive(:
|
252
|
+
@provider.should_receive(:shell_out).with('/bin/systemctl is-enabled rsyslog.service --quiet').and_return(@shell_out_failure)
|
253
253
|
@provider.is_enabled?.should be_false
|
254
254
|
end
|
255
255
|
end
|