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.
- 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
@@ -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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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(:
|
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
|