chef 12.0.0.alpha.1 → 12.0.0.alpha.2

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
@@ -59,7 +59,6 @@ describe Chef::Provider::Package::Aix do
59
59
  lambda { @provider.process_resource_requirements }.should raise_error(Chef::Exceptions::Package)
60
60
  end
61
61
 
62
-
63
62
  it "should get the source package version from lslpp if provided" do
64
63
  @stdout = StringIO.new(@bffinfo)
65
64
  @stdin, @stderr = StringIO.new, StringIO.new
@@ -125,9 +124,7 @@ describe Chef::Provider::Package::Aix do
125
124
 
126
125
  describe "install and upgrade" do
127
126
  it "should run installp -aYF -d with the package source to install" do
128
- @provider.should_receive(:run_command_with_systems_locale).with({
129
- :command => "installp -aYF -d /tmp/samba.base samba.base"
130
- })
127
+ @provider.should_receive(:shell_out!).with("installp -aYF -d /tmp/samba.base samba.base")
131
128
  @provider.install_package("samba.base", "3.3.12.0")
132
129
  end
133
130
 
@@ -135,37 +132,28 @@ describe Chef::Provider::Package::Aix do
135
132
  @new_resource = Chef::Resource::Package.new("/tmp/samba.base")
136
133
  @provider = Chef::Provider::Package::Aix.new(@new_resource, @run_context)
137
134
  @new_resource.source.should == "/tmp/samba.base"
138
- @provider.should_receive(:run_command_with_systems_locale).with({
139
- :command => "installp -aYF -d /tmp/samba.base /tmp/samba.base"
140
- })
135
+ @provider.should_receive(:shell_out!).with("installp -aYF -d /tmp/samba.base /tmp/samba.base")
141
136
  @provider.install_package("/tmp/samba.base", "3.3.12.0")
142
137
  end
143
138
 
144
139
  it "should run installp with -eLogfile option." do
145
140
  @new_resource.stub(:options).and_return("-e/tmp/installp.log")
146
- @provider.should_receive(:run_command_with_systems_locale).with({
147
- :command => "installp -aYF -e/tmp/installp.log -d /tmp/samba.base samba.base"
148
- })
141
+ @provider.should_receive(:shell_out!).with("installp -aYF -e/tmp/installp.log -d /tmp/samba.base samba.base")
149
142
  @provider.install_package("samba.base", "3.3.12.0")
150
143
  end
151
144
  end
152
145
 
153
146
  describe "remove" do
154
147
  it "should run installp -u samba.base to remove the package" do
155
- @provider.should_receive(:run_command_with_systems_locale).with({
156
- :command => "installp -u samba.base"
157
- })
148
+ @provider.should_receive(:shell_out!).with("installp -u samba.base")
158
149
  @provider.remove_package("samba.base", "3.3.12.0")
159
150
  end
160
151
 
161
152
  it "should run installp -u -e/tmp/installp.log with options -e/tmp/installp.log" do
162
153
  @new_resource.stub(:options).and_return("-e/tmp/installp.log")
163
- @provider.should_receive(:run_command_with_systems_locale).with({
164
- :command => "installp -u -e/tmp/installp.log samba.base"
165
- })
154
+ @provider.should_receive(:shell_out!).with("installp -u -e/tmp/installp.log samba.base")
166
155
  @provider.remove_package("samba.base", "3.3.12.0")
167
156
  end
168
157
 
169
158
  end
170
159
  end
171
-
@@ -39,7 +39,7 @@ describe Chef::Provider::Package::Ips do
39
39
  pkg: info: no packages matching the following patterns you specified are
40
40
  installed on the system. Try specifying -r to query remotely:
41
41
 
42
- crypto/gnupg
42
+ crypto/gnupg
43
43
  PKG_STATUS
44
44
  return OpenStruct.new(:stdout => stdout,:stdin => stdin,:stderr => stderr,:status => @status,:exitstatus => 1)
45
45
  end
@@ -59,7 +59,7 @@ Packaging Date: April 1, 2012 05:55:52 PM
59
59
  FMRI: pkg://omnios/security/sudo@1.8.4.1,5.11-0.151002:20120401T175552Z
60
60
  PKG_STATUS
61
61
  stdin = StringIO.new
62
- stderr = ''
62
+ stderr = ''
63
63
  return OpenStruct.new(:stdout => stdout,:stdin => stdin,:stderr => stderr,:status => @status,:exitstatus => 0)
64
64
  end
65
65
 
@@ -123,17 +123,12 @@ INSTALLED
123
123
 
124
124
  context "when installing a package" do
125
125
  it "should run pkg install with the package name and version" do
126
- @provider.should_receive(:run_command_with_systems_locale).with({
127
- :command => "pkg install -q crypto/gnupg@2.0.17"
128
- })
126
+ @provider.should_receive(:shell_out).with("pkg install -q crypto/gnupg@2.0.17")
129
127
  @provider.install_package("crypto/gnupg", "2.0.17")
130
128
  end
131
129
 
132
-
133
130
  it "should run pkg install with the package name and version and options if specified" do
134
- @provider.should_receive(:run_command_with_systems_locale).with({
135
- :command => "pkg --no-refresh install -q crypto/gnupg@2.0.17"
136
- })
131
+ @provider.should_receive(:shell_out).with("pkg --no-refresh install -q crypto/gnupg@2.0.17")
137
132
  @new_resource.stub(:options).and_return("--no-refresh")
138
133
  @provider.install_package("crypto/gnupg", "2.0.17")
139
134
  end
@@ -206,9 +201,7 @@ REMOTE
206
201
  end
207
202
 
208
203
  it "should run pkg install with the --accept flag" do
209
- @provider.should_receive(:run_command_with_systems_locale).with({
210
- :command => "pkg install -q --accept crypto/gnupg@2.0.17"
211
- })
204
+ @provider.should_receive(:shell_out).with("pkg install -q --accept crypto/gnupg@2.0.17")
212
205
  @provider.install_package("crypto/gnupg", "2.0.17")
213
206
  end
214
207
  end
@@ -216,25 +209,19 @@ REMOTE
216
209
 
217
210
  context "when upgrading a package" do
218
211
  it "should run pkg install with the package name and version" do
219
- @provider.should_receive(:run_command_with_systems_locale).with({
220
- :command => "pkg install -q crypto/gnupg@2.0.17"
221
- })
212
+ @provider.should_receive(:shell_out).with("pkg install -q crypto/gnupg@2.0.17")
222
213
  @provider.upgrade_package("crypto/gnupg", "2.0.17")
223
214
  end
224
215
  end
225
216
 
226
217
  context "when uninstalling a package" do
227
218
  it "should run pkg uninstall with the package name and version" do
228
- @provider.should_receive(:run_command_with_systems_locale).with({
229
- :command => "pkg uninstall -q crypto/gnupg@2.0.17"
230
- })
219
+ @provider.should_receive(:shell_out!).with("pkg uninstall -q crypto/gnupg@2.0.17")
231
220
  @provider.remove_package("crypto/gnupg", "2.0.17")
232
221
  end
233
222
 
234
223
  it "should run pkg uninstall with the package name and version and options if specified" do
235
- @provider.should_receive(:run_command_with_systems_locale).with({
236
- :command => "pkg --no-refresh uninstall -q crypto/gnupg@2.0.17"
237
- })
224
+ @provider.should_receive(:shell_out!).with("pkg --no-refresh uninstall -q crypto/gnupg@2.0.17")
238
225
  @new_resource.stub(:options).and_return("--no-refresh")
239
226
  @provider.remove_package("crypto/gnupg", "2.0.17")
240
227
  end
@@ -105,7 +105,7 @@ EOF
105
105
  it "should run the port install command with the correct version" do
106
106
  @current_resource.should_receive(:version).and_return("4.1.6")
107
107
  @provider.current_resource = @current_resource
108
- @provider.should_receive(:run_command_with_systems_locale).with(:command => "port install zsh @4.2.7")
108
+ @provider.should_receive(:shell_out!).with("port install zsh @4.2.7")
109
109
 
110
110
  @provider.install_package("zsh", "4.2.7")
111
111
  end
@@ -113,7 +113,7 @@ EOF
113
113
  it "should not do anything if a package already exists with the same version" do
114
114
  @current_resource.should_receive(:version).and_return("4.2.7")
115
115
  @provider.current_resource = @current_resource
116
- @provider.should_not_receive(:run_command_with_systems_locale)
116
+ @provider.should_not_receive(:shell_out!)
117
117
 
118
118
  @provider.install_package("zsh", "4.2.7")
119
119
  end
@@ -122,7 +122,7 @@ EOF
122
122
  @current_resource.should_receive(:version).and_return("4.1.6")
123
123
  @provider.current_resource = @current_resource
124
124
  @new_resource.stub(:options).and_return("-f")
125
- @provider.should_receive(:run_command_with_systems_locale).with(:command => "port -f install zsh @4.2.7")
125
+ @provider.should_receive(:shell_out!).with("port -f install zsh @4.2.7")
126
126
 
127
127
  @provider.install_package("zsh", "4.2.7")
128
128
  end
@@ -130,36 +130,36 @@ EOF
130
130
 
131
131
  describe "purge_package" do
132
132
  it "should run the port uninstall command with the correct version" do
133
- @provider.should_receive(:run_command_with_systems_locale).with(:command => "port uninstall zsh @4.2.7")
133
+ @provider.should_receive(:shell_out!).with("port uninstall zsh @4.2.7")
134
134
  @provider.purge_package("zsh", "4.2.7")
135
135
  end
136
136
 
137
137
  it "should purge the currently active version if no explicit version is passed in" do
138
- @provider.should_receive(:run_command_with_systems_locale).with(:command => "port uninstall zsh")
138
+ @provider.should_receive(:shell_out!).with("port uninstall zsh")
139
139
  @provider.purge_package("zsh", nil)
140
140
  end
141
141
 
142
142
  it "should add options to the port command when specified" do
143
143
  @new_resource.stub(:options).and_return("-f")
144
- @provider.should_receive(:run_command_with_systems_locale).with(:command => "port -f uninstall zsh @4.2.7")
144
+ @provider.should_receive(:shell_out!).with("port -f uninstall zsh @4.2.7")
145
145
  @provider.purge_package("zsh", "4.2.7")
146
146
  end
147
147
  end
148
148
 
149
149
  describe "remove_package" do
150
150
  it "should run the port deactivate command with the correct version" do
151
- @provider.should_receive(:run_command_with_systems_locale).with(:command => "port deactivate zsh @4.2.7")
151
+ @provider.should_receive(:shell_out!).with("port deactivate zsh @4.2.7")
152
152
  @provider.remove_package("zsh", "4.2.7")
153
153
  end
154
154
 
155
155
  it "should remove the currently active version if no explicit version is passed in" do
156
- @provider.should_receive(:run_command_with_systems_locale).with(:command => "port deactivate zsh")
156
+ @provider.should_receive(:shell_out!).with("port deactivate zsh")
157
157
  @provider.remove_package("zsh", nil)
158
158
  end
159
159
 
160
160
  it "should add options to the port command when specified" do
161
161
  @new_resource.stub(:options).and_return("-f")
162
- @provider.should_receive(:run_command_with_systems_locale).with(:command => "port -f deactivate zsh @4.2.7")
162
+ @provider.should_receive(:shell_out!).with("port -f deactivate zsh @4.2.7")
163
163
  @provider.remove_package("zsh", "4.2.7")
164
164
  end
165
165
  end
@@ -169,7 +169,7 @@ EOF
169
169
  @current_resource.should_receive(:version).at_least(:once).and_return("4.1.6")
170
170
  @provider.current_resource = @current_resource
171
171
 
172
- @provider.should_receive(:run_command_with_systems_locale).with(:command => "port upgrade zsh @4.2.7")
172
+ @provider.should_receive(:shell_out!).with("port upgrade zsh @4.2.7")
173
173
 
174
174
  @provider.upgrade_package("zsh", "4.2.7")
175
175
  end
@@ -177,7 +177,7 @@ EOF
177
177
  it "should not run the port upgrade command if the version is already installed" do
178
178
  @current_resource.should_receive(:version).at_least(:once).and_return("4.2.7")
179
179
  @provider.current_resource = @current_resource
180
- @provider.should_not_receive(:run_command_with_systems_locale)
180
+ @provider.should_not_receive(:shell_out!)
181
181
 
182
182
  @provider.upgrade_package("zsh", "4.2.7")
183
183
  end
@@ -195,7 +195,7 @@ EOF
195
195
  @current_resource.should_receive(:version).at_least(:once).and_return("4.1.6")
196
196
  @provider.current_resource = @current_resource
197
197
 
198
- @provider.should_receive(:run_command_with_systems_locale).with(:command => "port -f upgrade zsh @4.2.7")
198
+ @provider.should_receive(:shell_out!).with("port -f upgrade zsh @4.2.7")
199
199
 
200
200
  @provider.upgrade_package("zsh", "4.2.7")
201
201
  end
@@ -155,16 +155,12 @@ PACMAN_CONF
155
155
 
156
156
  describe Chef::Provider::Package::Pacman, "install_package" do
157
157
  it "should run pacman install with the package name and version" do
158
- @provider.should_receive(:run_command_with_systems_locale).with({
159
- :command => "pacman --sync --noconfirm --noprogressbar nano"
160
- })
158
+ @provider.should_receive(:shell_out!).with("pacman --sync --noconfirm --noprogressbar nano")
161
159
  @provider.install_package("nano", "1.0")
162
160
  end
163
161
 
164
162
  it "should run pacman install with the package name and version and options if specified" do
165
- @provider.should_receive(:run_command_with_systems_locale).with({
166
- :command => "pacman --sync --noconfirm --noprogressbar --debug nano"
167
- })
163
+ @provider.should_receive(:shell_out!).with("pacman --sync --noconfirm --noprogressbar --debug nano")
168
164
  @new_resource.stub(:options).and_return("--debug")
169
165
 
170
166
  @provider.install_package("nano", "1.0")
@@ -180,16 +176,12 @@ PACMAN_CONF
180
176
 
181
177
  describe Chef::Provider::Package::Pacman, "remove_package" do
182
178
  it "should run pacman remove with the package name" do
183
- @provider.should_receive(:run_command_with_systems_locale).with({
184
- :command => "pacman --remove --noconfirm --noprogressbar nano"
185
- })
179
+ @provider.should_receive(:shell_out!).with("pacman --remove --noconfirm --noprogressbar nano")
186
180
  @provider.remove_package("nano", "1.0")
187
181
  end
188
182
 
189
183
  it "should run pacman remove with the package name and options if specified" do
190
- @provider.should_receive(:run_command_with_systems_locale).with({
191
- :command => "pacman --remove --noconfirm --noprogressbar --debug nano"
192
- })
184
+ @provider.should_receive(:shell_out!).with("pacman --remove --noconfirm --noprogressbar --debug nano")
193
185
  @new_resource.stub(:options).and_return("--debug")
194
186
 
195
187
  @provider.remove_package("nano", "1.0")
@@ -278,23 +278,17 @@ EOF
278
278
 
279
279
  describe Chef::Provider::Package::Portage, "install_package" do
280
280
  it "should install a normally versioned package using portage" do
281
- @provider.should_receive(:run_command_with_systems_locale).with({
282
- :command => "emerge -g --color n --nospinner --quiet =dev-util/git-1.0.0"
283
- })
281
+ @provider.should_receive(:shell_out!).with("emerge -g --color n --nospinner --quiet =dev-util/git-1.0.0")
284
282
  @provider.install_package("dev-util/git", "1.0.0")
285
283
  end
286
284
 
287
285
  it "should install a tilde versioned package using portage" do
288
- @provider.should_receive(:run_command_with_systems_locale).with({
289
- :command => "emerge -g --color n --nospinner --quiet ~dev-util/git-1.0.0"
290
- })
286
+ @provider.should_receive(:shell_out!).with("emerge -g --color n --nospinner --quiet ~dev-util/git-1.0.0")
291
287
  @provider.install_package("dev-util/git", "~1.0.0")
292
288
  end
293
289
 
294
290
  it "should add options to the emerge command when specified" do
295
- @provider.should_receive(:run_command_with_systems_locale).with({
296
- :command => "emerge -g --color n --nospinner --quiet --oneshot =dev-util/git-1.0.0"
297
- })
291
+ @provider.should_receive(:shell_out!).with("emerge -g --color n --nospinner --quiet --oneshot =dev-util/git-1.0.0")
298
292
  @new_resource.stub(:options).and_return("--oneshot")
299
293
 
300
294
  @provider.install_package("dev-util/git", "1.0.0")
@@ -303,16 +297,12 @@ EOF
303
297
 
304
298
  describe Chef::Provider::Package::Portage, "remove_package" do
305
299
  it "should un-emerge the package with no version specified" do
306
- @provider.should_receive(:run_command_with_systems_locale).with({
307
- :command => "emerge --unmerge --color n --nospinner --quiet dev-util/git"
308
- })
300
+ @provider.should_receive(:shell_out!).with("emerge --unmerge --color n --nospinner --quiet dev-util/git")
309
301
  @provider.remove_package("dev-util/git", nil)
310
302
  end
311
303
 
312
304
  it "should un-emerge the package with a version specified" do
313
- @provider.should_receive(:run_command_with_systems_locale).with({
314
- :command => "emerge --unmerge --color n --nospinner --quiet =dev-util/git-1.0.0"
315
- })
305
+ @provider.should_receive(:shell_out!).with("emerge --unmerge --color n --nospinner --quiet =dev-util/git-1.0.0")
316
306
  @provider.remove_package("dev-util/git", "1.0.0")
317
307
  end
318
308
  end
@@ -102,25 +102,19 @@ describe Chef::Provider::Package::Rpm do
102
102
 
103
103
  describe "when installing or upgrading" do
104
104
  it "should run rpm -i with the package source to install" do
105
- @provider.should_receive(:run_command_with_systems_locale).with({
106
- :command => "rpm -i /tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm"
107
- })
105
+ @provider.should_receive(:shell_out!).with("rpm -i /tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm")
108
106
  @provider.install_package("ImageMagick-c++", "6.5.4.7-7.el6_5")
109
107
  end
110
108
 
111
109
  it "should run rpm -U with the package source to upgrade" do
112
110
  @current_resource.version("21.4-19.el5")
113
- @provider.should_receive(:run_command_with_systems_locale).with({
114
- :command => "rpm -U /tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm"
115
- })
111
+ @provider.should_receive(:shell_out!).with("rpm -U /tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm")
116
112
  @provider.upgrade_package("ImageMagick-c++", "6.5.4.7-7.el6_5")
117
113
  end
118
114
 
119
115
  it "should install package if missing and set to upgrade" do
120
116
  @current_resource.version("ImageMagick-c++")
121
- @provider.should_receive(:run_command_with_systems_locale).with({
122
- :command => "rpm -U /tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm"
123
- })
117
+ @provider.should_receive(:shell_out!).with("rpm -U /tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm")
124
118
  @provider.upgrade_package("ImageMagick-c++", "6.5.4.7-7.el6_5")
125
119
  end
126
120
 
@@ -130,9 +124,7 @@ describe Chef::Provider::Package::Rpm do
130
124
  @new_resource.source.should == "/tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm"
131
125
  @current_resource = Chef::Resource::Package.new("ImageMagick-c++")
132
126
  @provider.current_resource = @current_resource
133
- @provider.should_receive(:run_command_with_systems_locale).with({
134
- :command => "rpm -i /tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm"
135
- })
127
+ @provider.should_receive(:shell_out!).with("rpm -i /tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm")
136
128
  @provider.install_package("/tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm", "6.5.4.7-7.el6_5")
137
129
  end
138
130
 
@@ -143,30 +135,23 @@ describe Chef::Provider::Package::Rpm do
143
135
  @current_resource = Chef::Resource::Package.new("ImageMagick-c++")
144
136
  @current_resource.version("21.4-19.el5")
145
137
  @provider.current_resource = @current_resource
146
- @provider.should_receive(:run_command_with_systems_locale).with({
147
- :command => "rpm -U /tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm"
148
- })
138
+ @provider.should_receive(:shell_out!).with("rpm -U /tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm")
149
139
  @provider.upgrade_package("/tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm", "6.5.4.7-7.el6_5")
150
140
  end
151
141
 
152
142
  it "installs with custom options specified in the resource" do
153
143
  @provider.candidate_version = '11'
154
144
  @new_resource.options("--dbpath /var/lib/rpm")
155
- @provider.should_receive(:run_command_with_systems_locale).with({
156
- :command => "rpm --dbpath /var/lib/rpm -i /tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm"
157
- })
145
+ @provider.should_receive(:shell_out!).with("rpm --dbpath /var/lib/rpm -i /tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm")
158
146
  @provider.install_package(@new_resource.name, @provider.candidate_version)
159
147
  end
160
148
  end
161
149
 
162
150
  describe "when removing the package" do
163
151
  it "should run rpm -e to remove the package" do
164
- @provider.should_receive(:run_command_with_systems_locale).with({
165
- :command => "rpm -e ImageMagick-c++-6.5.4.7-7.el6_5"
166
- })
152
+ @provider.should_receive(:shell_out!).with("rpm -e ImageMagick-c++-6.5.4.7-7.el6_5")
167
153
  @provider.remove_package("ImageMagick-c++", "6.5.4.7-7.el6_5")
168
154
  end
169
155
  end
170
156
  end
171
157
  end
172
-
@@ -69,7 +69,6 @@ PKGINFO
69
69
  lambda { @provider.process_resource_requirements }.should raise_error(Chef::Exceptions::Package)
70
70
  end
71
71
 
72
-
73
72
  it "should get the source package version from pkginfo if provided" do
74
73
  @stdout = StringIO.new(@pkginfo)
75
74
  @stdin, @stderr = StringIO.new, StringIO.new
@@ -136,9 +135,7 @@ PKGINFO
136
135
 
137
136
  describe "install and upgrade" do
138
137
  it "should run pkgadd -n -d with the package source to install" do
139
- @provider.should_receive(:run_command_with_systems_locale).with({
140
- :command => "pkgadd -n -d /tmp/bash.pkg all"
141
- })
138
+ @provider.should_receive(:shell_out!).with("pkgadd -n -d /tmp/bash.pkg all")
142
139
  @provider.install_package("SUNWbash", "11.10.0,REV=2005.01.08.05.16")
143
140
  end
144
141
 
@@ -146,34 +143,26 @@ PKGINFO
146
143
  @new_resource = Chef::Resource::Package.new("/tmp/bash.pkg")
147
144
  @provider = Chef::Provider::Package::Solaris.new(@new_resource, @run_context)
148
145
  @new_resource.source.should == "/tmp/bash.pkg"
149
- @provider.should_receive(:run_command_with_systems_locale).with({
150
- :command => "pkgadd -n -d /tmp/bash.pkg all"
151
- })
146
+ @provider.should_receive(:shell_out!).with("pkgadd -n -d /tmp/bash.pkg all")
152
147
  @provider.install_package("/tmp/bash.pkg", "11.10.0,REV=2005.01.08.05.16")
153
148
  end
154
149
 
155
150
  it "should run pkgadd -n -a /tmp/myadmin -d with the package options -a /tmp/myadmin" do
156
151
  @new_resource.stub(:options).and_return("-a /tmp/myadmin")
157
- @provider.should_receive(:run_command_with_systems_locale).with({
158
- :command => "pkgadd -n -a /tmp/myadmin -d /tmp/bash.pkg all"
159
- })
152
+ @provider.should_receive(:shell_out!).with("pkgadd -n -a /tmp/myadmin -d /tmp/bash.pkg all")
160
153
  @provider.install_package("SUNWbash", "11.10.0,REV=2005.01.08.05.16")
161
154
  end
162
155
  end
163
156
 
164
157
  describe "remove" do
165
158
  it "should run pkgrm -n to remove the package" do
166
- @provider.should_receive(:run_command_with_systems_locale).with({
167
- :command => "pkgrm -n SUNWbash"
168
- })
159
+ @provider.should_receive(:shell_out!).with("pkgrm -n SUNWbash")
169
160
  @provider.remove_package("SUNWbash", "11.10.0,REV=2005.01.08.05.16")
170
161
  end
171
162
 
172
163
  it "should run pkgrm -n -a /tmp/myadmin with options -a /tmp/myadmin" do
173
164
  @new_resource.stub(:options).and_return("-a /tmp/myadmin")
174
- @provider.should_receive(:run_command_with_systems_locale).with({
175
- :command => "pkgrm -n -a /tmp/myadmin SUNWbash"
176
- })
165
+ @provider.should_receive(:shell_out!).with("pkgrm -n -a /tmp/myadmin SUNWbash")
177
166
  @provider.remove_package("SUNWbash", "11.10.0,REV=2005.01.08.05.16")
178
167
  end
179
168
 
@@ -20,7 +20,6 @@
20
20
  require 'spec_helper'
21
21
  require 'ostruct'
22
22
 
23
-
24
23
  # most of this code has been ripped from init_service_spec.rb
25
24
  # and is only slightly modified to match "arch" needs.
26
25
 
@@ -36,7 +35,6 @@ describe Chef::Provider::Service::Arch, "load_current_resource" do
36
35
  @new_resource.pattern("chef")
37
36
  @new_resource.supports({:status => false})
38
37
 
39
-
40
38
  @provider = Chef::Provider::Service::Arch.new(@new_resource, @run_context)
41
39
 
42
40
  ::File.stub(:exists?).with("/etc/rc.conf").and_return(true)
@@ -51,7 +49,6 @@ describe Chef::Provider::Service::Arch, "load_current_resource" do
51
49
  end
52
50
  end
53
51
 
54
-
55
52
  describe "when the service supports status" do
56
53
  before do
57
54
  @new_resource.supports({:status => true})
@@ -82,7 +79,6 @@ describe Chef::Provider::Service::Arch, "load_current_resource" do
82
79
 
83
80
  end
84
81
 
85
-
86
82
  describe "when a status command has been specified" do
87
83
  before do
88
84
  @new_resource.status_command("/etc/rc.d/chefhasmonkeypants status")
@@ -109,7 +105,6 @@ describe Chef::Provider::Service::Arch, "load_current_resource" do
109
105
  lambda { @provider.process_resource_requirements }.should raise_error(Chef::Exceptions::Service)
110
106
  end
111
107
 
112
-
113
108
  it "should fail if file /etc/rc.conf does not exist" do
114
109
  ::File.stub(:exists?).with("/etc/rc.conf").and_return(false)
115
110
  lambda { @provider.load_current_resource }.should raise_error(Chef::Exceptions::Service)
@@ -211,7 +206,6 @@ RUNNING_PS
211
206
  end
212
207
  end
213
208
 
214
-
215
209
  describe Chef::Provider::Service::Arch, "start_service" do
216
210
  # before(:each) do
217
211
  # @new_resource = double("Chef::Resource::Service",
@@ -228,12 +222,12 @@ RUNNING_PS
228
222
 
229
223
  it "should call the start command if one is specified" do
230
224
  @new_resource.stub(:start_command).and_return("/etc/rc.d/chef startyousillysally")
231
- @provider.should_receive(:shell_out!).with("/etc/rc.d/chef startyousillysally")
225
+ @provider.should_receive(:shell_out_with_systems_locale!).with("/etc/rc.d/chef startyousillysally")
232
226
  @provider.start_service()
233
227
  end
234
228
 
235
229
  it "should call '/etc/rc.d/service_name start' if no start command is specified" do
236
- @provider.should_receive(:shell_out!).with("/etc/rc.d/#{@new_resource.service_name} start")
230
+ @provider.should_receive(:shell_out_with_systems_locale!).with("/etc/rc.d/#{@new_resource.service_name} start")
237
231
  @provider.start_service()
238
232
  end
239
233
  end
@@ -254,12 +248,12 @@ RUNNING_PS
254
248
 
255
249
  it "should call the stop command if one is specified" do
256
250
  @new_resource.stub(:stop_command).and_return("/etc/rc.d/chef itoldyoutostop")
257
- @provider.should_receive(:shell_out!).with("/etc/rc.d/chef itoldyoutostop")
251
+ @provider.should_receive(:shell_out_with_systems_locale!).with("/etc/rc.d/chef itoldyoutostop")
258
252
  @provider.stop_service()
259
253
  end
260
254
 
261
255
  it "should call '/etc/rc.d/service_name stop' if no stop command is specified" do
262
- @provider.should_receive(:shell_out!).with("/etc/rc.d/#{@new_resource.service_name} stop")
256
+ @provider.should_receive(:shell_out_with_systems_locale!).with("/etc/rc.d/#{@new_resource.service_name} stop")
263
257
  @provider.stop_service()
264
258
  end
265
259
  end
@@ -281,13 +275,13 @@ RUNNING_PS
281
275
 
282
276
  it "should call 'restart' on the service_name if the resource supports it" do
283
277
  @new_resource.stub(:supports).and_return({:restart => true})
284
- @provider.should_receive(:shell_out!).with("/etc/rc.d/#{@new_resource.service_name} restart")
278
+ @provider.should_receive(:shell_out_with_systems_locale!).with("/etc/rc.d/#{@new_resource.service_name} restart")
285
279
  @provider.restart_service()
286
280
  end
287
281
 
288
282
  it "should call the restart_command if one has been specified" do
289
283
  @new_resource.stub(:restart_command).and_return("/etc/rc.d/chef restartinafire")
290
- @provider.should_receive(:shell_out!).with("/etc/rc.d/#{@new_resource.service_name} restartinafire")
284
+ @provider.should_receive(:shell_out_with_systems_locale!).with("/etc/rc.d/#{@new_resource.service_name} restartinafire")
291
285
  @provider.restart_service()
292
286
  end
293
287
 
@@ -316,13 +310,13 @@ RUNNING_PS
316
310
 
317
311
  it "should call 'reload' on the service if it supports it" do
318
312
  @new_resource.stub(:supports).and_return({:reload => true})
319
- @provider.should_receive(:shell_out!).with("/etc/rc.d/#{@new_resource.service_name} reload")
313
+ @provider.should_receive(:shell_out_with_systems_locale!).with("/etc/rc.d/#{@new_resource.service_name} reload")
320
314
  @provider.reload_service()
321
315
  end
322
316
 
323
317
  it "should should run the user specified reload command if one is specified and the service doesn't support reload" do
324
318
  @new_resource.stub(:reload_command).and_return("/etc/rc.d/chef lollerpants")
325
- @provider.should_receive(:shell_out!).with("/etc/rc.d/#{@new_resource.service_name} lollerpants")
319
+ @provider.should_receive(:shell_out_with_systems_locale!).with("/etc/rc.d/#{@new_resource.service_name} lollerpants")
326
320
  @provider.reload_service()
327
321
  end
328
322
  end