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.
Files changed (180) hide show
  1. checksums.yaml +4 -4
  2. data/lib/chef/application.rb +8 -1
  3. data/lib/chef/application/apply.rb +4 -0
  4. data/lib/chef/application/client.rb +7 -7
  5. data/lib/chef/application/solo.rb +21 -13
  6. data/lib/chef/chef_fs/chef_fs_data_store.rb +60 -6
  7. data/lib/chef/chef_fs/config.rb +78 -4
  8. data/lib/chef/chef_fs/data_handler/acl_data_handler.rb +2 -2
  9. data/lib/chef/chef_fs/data_handler/client_data_handler.rb +1 -1
  10. data/lib/chef/chef_fs/data_handler/container_data_handler.rb +1 -1
  11. data/lib/chef/chef_fs/data_handler/cookbook_data_handler.rb +1 -1
  12. data/lib/chef/chef_fs/data_handler/data_bag_item_data_handler.rb +1 -1
  13. data/lib/chef/chef_fs/data_handler/data_handler_base.rb +76 -2
  14. data/lib/chef/chef_fs/data_handler/environment_data_handler.rb +1 -1
  15. data/lib/chef/chef_fs/data_handler/group_data_handler.rb +1 -1
  16. data/lib/chef/chef_fs/data_handler/node_data_handler.rb +1 -1
  17. data/lib/chef/chef_fs/data_handler/organization_data_handler.rb +30 -0
  18. data/lib/chef/chef_fs/data_handler/organization_invites_data_handler.rb +17 -0
  19. data/lib/chef/chef_fs/data_handler/organization_members_data_handler.rb +17 -0
  20. data/lib/chef/chef_fs/data_handler/role_data_handler.rb +1 -1
  21. data/lib/chef/chef_fs/data_handler/user_data_handler.rb +2 -1
  22. data/lib/chef/chef_fs/file_system.rb +0 -1
  23. data/lib/chef/chef_fs/file_system/acl_entry.rb +1 -1
  24. data/lib/chef/chef_fs/file_system/chef_repository_file_system_cookbook_dir.rb +1 -1
  25. data/lib/chef/chef_fs/file_system/chef_repository_file_system_entry.rb +5 -1
  26. data/lib/chef/chef_fs/file_system/chef_repository_file_system_root_dir.rb +73 -13
  27. data/lib/chef/chef_fs/file_system/chef_server_root_dir.rb +44 -5
  28. data/lib/chef/chef_fs/file_system/cookbook_dir.rb +1 -1
  29. data/lib/chef/chef_fs/file_system/cookbooks_dir.rb +3 -3
  30. data/lib/chef/chef_fs/file_system/org_entry.rb +34 -0
  31. data/lib/chef/chef_fs/file_system/organization_invites_entry.rb +58 -0
  32. data/lib/chef/chef_fs/file_system/organization_members_entry.rb +57 -0
  33. data/lib/chef/chef_fs/file_system/rest_list_entry.rb +13 -4
  34. data/lib/chef/chef_fs/knife.rb +1 -1
  35. data/lib/chef/client.rb +8 -2
  36. data/lib/chef/config.rb +75 -57
  37. data/lib/chef/config_fetcher.rb +6 -21
  38. data/lib/chef/dsl/data_query.rb +48 -3
  39. data/lib/chef/dsl/platform_introspection.rb +42 -0
  40. data/lib/chef/dsl/reboot_pending.rb +6 -3
  41. data/lib/chef/encrypted_data_bag_item.rb +1 -1
  42. data/lib/chef/encrypted_data_bag_item/encryptor.rb +12 -0
  43. data/lib/chef/exceptions.rb +2 -0
  44. data/lib/chef/http/basic_client.rb +14 -0
  45. data/lib/chef/http/json_output.rb +7 -2
  46. data/lib/chef/knife.rb +36 -121
  47. data/lib/chef/knife/bootstrap.rb +68 -54
  48. data/lib/chef/knife/bootstrap/archlinux-gems.erb +6 -1
  49. data/lib/chef/knife/bootstrap/chef-aix.erb +5 -0
  50. data/lib/chef/knife/bootstrap/chef-full.erb +5 -1
  51. data/lib/chef/knife/core/bootstrap_context.rb +70 -29
  52. data/lib/chef/knife/search.rb +56 -12
  53. data/lib/chef/knife/serve.rb +1 -1
  54. data/lib/chef/local_mode.rb +10 -4
  55. data/lib/chef/mixin/deep_merge.rb +6 -3
  56. data/lib/chef/mixin/shell_out.rb +33 -17
  57. data/lib/chef/null_logger.rb +72 -0
  58. data/lib/chef/platform.rb +2 -1
  59. data/lib/chef/platform/provider_mapping.rb +1 -1
  60. data/lib/chef/platform/rebooter.rb +54 -0
  61. data/lib/chef/provider/ifconfig.rb +15 -16
  62. data/lib/chef/provider/link.rb +1 -1
  63. data/lib/chef/provider/mount/mount.rb +1 -1
  64. data/lib/chef/provider/mount/solaris.rb +102 -64
  65. data/lib/chef/provider/package/aix.rb +4 -12
  66. data/lib/chef/provider/package/ips.rb +8 -12
  67. data/lib/chef/provider/package/macports.rb +4 -12
  68. data/lib/chef/provider/package/pacman.rb +2 -6
  69. data/lib/chef/provider/package/portage.rb +2 -6
  70. data/lib/chef/provider/package/rpm.rb +4 -12
  71. data/lib/chef/provider/package/solaris.rb +4 -12
  72. data/lib/chef/provider/reboot.rb +69 -0
  73. data/lib/chef/provider/service/debian.rb +10 -10
  74. data/lib/chef/provider/service/freebsd.rb +89 -73
  75. data/lib/chef/provider/service/gentoo.rb +2 -2
  76. data/lib/chef/provider/service/init.rb +6 -4
  77. data/lib/chef/provider/service/insserv.rb +3 -3
  78. data/lib/chef/provider/service/macosx.rb +2 -2
  79. data/lib/chef/provider/service/simple.rb +6 -4
  80. data/lib/chef/provider/service/solaris.rb +1 -1
  81. data/lib/chef/provider/service/systemd.rb +9 -9
  82. data/lib/chef/provider/service/upstart.rb +6 -6
  83. data/lib/chef/provider/subversion.rb +6 -6
  84. data/lib/chef/provider/user/dscl.rb +32 -28
  85. data/lib/chef/provider/user/windows.rb +6 -6
  86. data/lib/chef/provider/whyrun_safe_ruby_block.rb +1 -1
  87. data/lib/chef/providers.rb +1 -0
  88. data/lib/chef/recipe.rb +0 -1
  89. data/lib/chef/resource.rb +3 -5
  90. data/lib/chef/resource/mount.rb +9 -0
  91. data/lib/chef/resource/reboot.rb +48 -0
  92. data/lib/chef/resources.rb +1 -0
  93. data/lib/chef/run_context.rb +25 -0
  94. data/lib/chef/search/query.rb +122 -14
  95. data/lib/chef/util/path_helper.rb +54 -6
  96. data/lib/chef/util/windows/net_user.rb +4 -1
  97. data/lib/chef/version.rb +1 -1
  98. data/lib/chef/win32/api/file.rb +1 -5
  99. data/lib/chef/win32/api/net.rb +1 -0
  100. data/lib/chef/workstation_config_loader.rb +177 -0
  101. data/spec/functional/http/simple_spec.rb +57 -1
  102. data/spec/functional/mixin/shell_out_spec.rb +2 -2
  103. data/spec/functional/provider/whyrun_safe_ruby_block_spec.rb +51 -0
  104. data/spec/functional/rebooter_spec.rb +105 -0
  105. data/spec/functional/resource/deploy_revision_spec.rb +0 -4
  106. data/spec/functional/resource/file_spec.rb +26 -3
  107. data/spec/functional/resource/group_spec.rb +5 -3
  108. data/spec/functional/resource/link_spec.rb +16 -16
  109. data/spec/functional/resource/reboot_spec.rb +103 -0
  110. data/spec/integration/client/client_spec.rb +4 -8
  111. data/spec/integration/client/ipv6_spec.rb +1 -1
  112. data/spec/integration/knife/cookbook_api_ipv6_spec.rb +3 -2
  113. data/spec/integration/knife/delete_spec.rb +39 -0
  114. data/spec/integration/knife/deps_spec.rb +30 -20
  115. data/spec/integration/knife/download_spec.rb +77 -1
  116. data/spec/integration/knife/list_spec.rb +221 -0
  117. data/spec/integration/knife/raw_spec.rb +1 -1
  118. data/spec/integration/knife/show_spec.rb +2 -2
  119. data/spec/integration/knife/upload_spec.rb +154 -1
  120. data/spec/support/pedant/run_pedant.rb +0 -1
  121. data/spec/support/shared/functional/http.rb +8 -1
  122. data/spec/support/shared/integration/integration_helper.rb +11 -19
  123. data/spec/support/shared/unit/platform_introspector.rb +22 -0
  124. data/spec/unit/application/apply.rb +11 -1
  125. data/spec/unit/application/solo_spec.rb +19 -3
  126. data/spec/unit/chef_fs/config_spec.rb +58 -0
  127. data/spec/unit/config_fetcher_spec.rb +1 -3
  128. data/spec/unit/config_spec.rb +247 -220
  129. data/spec/unit/dsl/data_query_spec.rb +165 -23
  130. data/spec/unit/dsl/reboot_pending_spec.rb +1 -7
  131. data/spec/unit/encrypted_data_bag_item_spec.rb +1 -1
  132. data/spec/unit/knife/bootstrap_spec.rb +354 -182
  133. data/spec/unit/knife/core/bootstrap_context_spec.rb +67 -30
  134. data/spec/unit/knife_spec.rb +3 -30
  135. data/spec/unit/mixin/deep_merge_spec.rb +14 -0
  136. data/spec/unit/mixin/shell_out_spec.rb +134 -64
  137. data/spec/unit/provider/ifconfig/debian_spec.rb +19 -9
  138. data/spec/unit/provider/ifconfig/redhat_spec.rb +16 -14
  139. data/spec/unit/provider/ifconfig_spec.rb +3 -3
  140. data/spec/unit/provider/link_spec.rb +5 -5
  141. data/spec/unit/provider/mount/mount_spec.rb +10 -1
  142. data/spec/unit/provider/mount/solaris_spec.rb +185 -11
  143. data/spec/unit/provider/package/aix_spec.rb +5 -17
  144. data/spec/unit/provider/package/ips_spec.rb +8 -21
  145. data/spec/unit/provider/package/macports_spec.rb +12 -12
  146. data/spec/unit/provider/package/pacman_spec.rb +4 -12
  147. data/spec/unit/provider/package/portage_spec.rb +5 -15
  148. data/spec/unit/provider/package/rpm_spec.rb +7 -22
  149. data/spec/unit/provider/package/solaris_spec.rb +5 -16
  150. data/spec/unit/provider/service/arch_service_spec.rb +8 -14
  151. data/spec/unit/provider/service/debian_service_spec.rb +1 -1
  152. data/spec/unit/provider/service/freebsd_service_spec.rb +457 -225
  153. data/spec/unit/provider/service/gentoo_service_spec.rb +2 -2
  154. data/spec/unit/provider/service/init_service_spec.rb +10 -10
  155. data/spec/unit/provider/service/insserv_service_spec.rb +3 -4
  156. data/spec/unit/provider/service/invokercd_service_spec.rb +8 -9
  157. data/spec/unit/provider/service/macosx_spec.rb +5 -5
  158. data/spec/unit/provider/service/simple_service_spec.rb +4 -6
  159. data/spec/unit/provider/service/solaris_smf_service_spec.rb +1 -3
  160. data/spec/unit/provider/service/systemd_service_spec.rb +20 -20
  161. data/spec/unit/provider/service/upstart_service_spec.rb +15 -17
  162. data/spec/unit/provider/subversion_spec.rb +5 -6
  163. data/spec/unit/provider/user/dscl_spec.rb +2 -1
  164. data/spec/unit/provider/user/windows_spec.rb +7 -0
  165. data/spec/unit/provider/whyrun_safe_ruby_block_spec.rb +2 -2
  166. data/spec/unit/resource/mount_spec.rb +9 -0
  167. data/spec/unit/resource_spec.rb +0 -4
  168. data/spec/unit/rest_spec.rb +1 -1
  169. data/spec/unit/run_context_spec.rb +15 -0
  170. data/spec/unit/search/query_spec.rb +196 -40
  171. data/spec/unit/util/path_helper_spec.rb +111 -28
  172. data/spec/unit/workstation_config_loader_spec.rb +283 -0
  173. metadata +36 -20
  174. data/lib/chef/knife/bootstrap/centos5-gems.erb +0 -62
  175. data/lib/chef/knife/bootstrap/fedora13-gems.erb +0 -44
  176. data/lib/chef/knife/bootstrap/ubuntu10.04-apt.erb +0 -53
  177. data/lib/chef/knife/bootstrap/ubuntu10.04-gems.erb +0 -48
  178. data/lib/chef/knife/bootstrap/ubuntu12.04-gems.erb +0 -46
  179. data/spec/support/shared/integration/chef_zero_support.rb +0 -130
  180. 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(:run_command).with({:command => "/sbin/rc-update add chef default"})
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(:run_command).with({:command => "/sbin/rc-update del chef default"})
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(:shell_out!).with("/opt/chef-server/service/erchef start")
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(:shell_out!).with("/etc/init.d/chef startyousillysally")
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(:shell_out!).with("/etc/init.d/#{@new_resource.service_name} start")
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(:shell_out!).with("/etc/init.d/chef itoldyoutostop")
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(:shell_out!).with("/etc/init.d/#{@new_resource.service_name} stop")
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(:shell_out!).with("/etc/init.d/#{@new_resource.service_name} restart")
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(:shell_out!).with("/etc/init.d/#{@new_resource.service_name} restartinafire")
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(:shell_out!).with("/etc/init.d/chef reload")
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(:shell_out!).with("/etc/init.d/chef lollerpants")
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(:run_command).with({:command=>"/sbin/insserv -r -f #{@new_resource.service_name}"})
64
- @provider.should_receive(:run_command).with({:command=>"/sbin/insserv -d -f #{@new_resource.service_name}"})
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(:run_command).with({:command=>"/sbin/insserv -r -f #{@new_resource.service_name}"})
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(:shell_out!).with("/usr/sbin/invoke-rc.d chef startyousillysally")
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(:shell_out!).with("/usr/sbin/invoke-rc.d #{@new_resource.service_name} start")
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(:shell_out!).with("/usr/sbin/invoke-rc.d chef itoldyoutostop")
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(:shell_out!).with("/usr/sbin/invoke-rc.d #{@new_resource.service_name} stop")
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(:shell_out!).with("/usr/sbin/invoke-rc.d #{@new_resource.service_name} restart")
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(:shell_out!).with("/usr/sbin/invoke-rc.d #{@new_resource.service_name} restartinafire")
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(:shell_out!).with("/usr/sbin/invoke-rc.d chef reload")
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(:shell_out!).with("/usr/sbin/invoke-rc.d chef lollerpants")
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(:shell_out!).with("cowsay dirty")
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(:shell_out!).
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(:shell_out!).with("kill -9 123")
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(:shell_out!).
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(:shell_out!).with("reload that thing")
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(:shell_out!).with("#{@new_resource.start_command}")
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(:shell_out!).with("/etc/init.d/themadness stop")
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(:shell_out!).with("/etc/init.d/foo restart")
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(:shell_out!).with("kill -9 1")
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(:shell_out!).with("/usr/sbin/svcadm refresh chef").and_return(@status)
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(:shell_out_with_systems_locale).and_return(@shell_out_success)
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(:shell_out_with_systems_locale).with("/bin/chefhasmonkeypants status").and_return(@shell_out_success)
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(:shell_out_with_systems_locale).and_return(@shell_out_failure)
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(:shell_out_with_systems_locale).and_return(@shell_out_failure)
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(:shell_out!).with("/sbin/rsyslog startyousillysally")
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(:shell_out!).with("/sbin/rsyslog restartyousillysally")
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(:shell_out!).with("/sbin/rsyslog reloadyousillysally")
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(:shell_out!).with("/sbin/rsyslog stopyousillysally")
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(:shell_out_with_systems_locale).with("/bin/systemctl enable #{@new_resource.service_name}").and_return(@shell_out_success)
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(:shell_out_with_systems_locale).with("/bin/systemctl disable #{@new_resource.service_name}").and_return(@shell_out_success)
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(:shell_out_with_systems_locale).with('/bin/systemctl is-active rsyslog.service --quiet').and_return(@shell_out_success)
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(:shell_out_with_systems_locale).with('/bin/systemctl is-active rsyslog.service --quiet').and_return(@shell_out_failure)
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(:shell_out_with_systems_locale).with('/bin/systemctl is-enabled rsyslog.service --quiet').and_return(@shell_out_success)
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(:shell_out_with_systems_locale).with('/bin/systemctl is-enabled rsyslog.service --quiet').and_return(@shell_out_failure)
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