boxgrinder-build 0.10.1 → 0.10.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -19,20 +19,17 @@
19
19
  require 'rubygems'
20
20
  require 'aws-sdk'
21
21
  require 'boxgrinder-build/plugins/base-plugin'
22
+ require 'boxgrinder-build/plugins/delivery/s3/messages'
22
23
  require 'boxgrinder-build/helpers/package-helper'
23
24
  require 'boxgrinder-build/helpers/s3-helper'
24
25
  require 'boxgrinder-build/helpers/ec2-helper'
26
+ require 'boxgrinder-build/helpers/banner-helper'
25
27
 
26
28
  module BoxGrinder
27
29
  class S3Plugin < BasePlugin
28
30
  plugin :type => :delivery, :name => :s3, :full_name => "Amazon Simple Storage Service (Amazon S3)", :types => [:s3, :cloudfront, :ami]
29
31
 
30
32
  def after_init
31
- register_supported_os("fedora", ['13', '14', '15', '16'])
32
- register_supported_os("centos", ['5', '6'])
33
- register_supported_os("rhel", ['5', '6'])
34
- register_supported_os("sl", ['5', '6'])
35
-
36
33
  @ami_build_dir = "#{@dir.base}/ami"
37
34
  @ami_manifest = "#{@ami_build_dir}/#{@appliance_config.name}.ec2.manifest.xml"
38
35
  end
@@ -43,6 +40,11 @@ module BoxGrinder
43
40
  set_default_config_value('ramdisk', false)
44
41
  set_default_config_value('path', '/')
45
42
  set_default_config_value('region', 'us-east-1')
43
+
44
+ set_default_config_value('block_device_mappings', {}) do |k, m, v|
45
+ EC2Helper::block_device_mappings_validator(k, m, v)
46
+ end
47
+
46
48
  validate_plugin_config(['bucket', 'access_key', 'secret_access_key'], 'http://boxgrinder.org/tutorials/boxgrinder-build-plugins/#S3_Delivery_Plugin')
47
49
 
48
50
  subtype(:ami) do
@@ -89,6 +91,8 @@ module BoxGrinder
89
91
  when :cloudfront
90
92
  upload_to_bucket(@previous_deliverables, :public_read)
91
93
  when :ami
94
+ @log.info Banner.message(S3::Messages::EPHEMERAL_MESSAGE)
95
+
92
96
  ami_dir = ami_key(@appliance_config.name, @plugin_config['path'])
93
97
  ami_manifest_key = @s3helper.stub_s3obj(@bucket, "#{ami_dir}/#{@appliance_config.name}.ec2.manifest.xml")
94
98
 
@@ -191,7 +195,15 @@ module BoxGrinder
191
195
  if ami = ami_by_manifest_key(ami_manifest_key)
192
196
  @log.info "Image for #{@appliance_config.name} is already registered under id: #{ami.id} (region: #{@plugin_config['region']})."
193
197
  else
194
- ami = @ec2.images.create(:image_location => "#{@plugin_config['bucket']}/#{ami_manifest_key.key}")
198
+ optmap = { :image_location => "#{@plugin_config['bucket']}/#{ami_manifest_key.key}" }
199
+
200
+ unless @plugin_config['block_device_mappings'].empty?
201
+ optmap.merge!(:block_device_mappings => @plugin_config['block_device_mappings'])
202
+ end
203
+
204
+ @log.debug("Options map: #{optmap.inspect}")
205
+
206
+ ami = @ec2.images.create(optmap)
195
207
  @ec2helper.wait_for_image_state(:available, ami)
196
208
  @log.info "Image for #{@appliance_config.name} successfully registered under id: #{ami.id} (region: #{@plugin_config['region']})."
197
209
  end
@@ -20,11 +20,17 @@ require 'boxgrinder-build/plugins/os/rpm-based/rpm-based-os-plugin'
20
20
 
21
21
  module BoxGrinder
22
22
  class FedoraPlugin < RPMBasedOSPlugin
23
- plugin :type => :os, :name => :fedora, :full_name => "Fedora", :versions => ["13", "14", "15", "16", "rawhide"], :require_root => true
23
+ SUPPORTED_VERSIONS = ["13", "14", "15", "16", "17", "rawhide"]
24
+
25
+ plugin(:type => :os,
26
+ :name => :fedora,
27
+ :full_name => "Fedora",
28
+ :versions => SUPPORTED_VERSIONS,
29
+ :require_root => true)
24
30
 
25
31
  def after_init
26
32
  super
27
- register_supported_os('fedora', ["13", "14", "15", "16", "rawhide"])
33
+ register_supported_os('fedora', SUPPORTED_VERSIONS)
28
34
  set_default_config_value('PAE', true)
29
35
  end
30
36
 
@@ -48,7 +54,7 @@ module BoxGrinder
48
54
  if @appliance_config.os.version >= "15"
49
55
  disable_biosdevname(guestfs)
50
56
  change_runlevel(guestfs)
51
- disable_netfs(guestfs)
57
+ disable_netfs(guestfs) if @appliance_config.os.version < "17"
52
58
  link_mtab(guestfs)
53
59
  end
54
60
  end
@@ -27,7 +27,7 @@ module BoxGrinder
27
27
  def after_init
28
28
  register_deliverable(:disk => "#{@appliance_config.name}.ec2")
29
29
 
30
- register_supported_os('fedora', ['13', '14', '15', '16'])
30
+ register_supported_os('fedora', ['13', '14', '15', '16', '17'])
31
31
  register_supported_os('centos', ['5', '6'])
32
32
  register_supported_os('sl', ['5', '6'])
33
33
  register_supported_os('rhel', ['5', '6'])
@@ -42,6 +42,11 @@ module BoxGrinder
42
42
 
43
43
  @image_helper.customize([@previous_deliverables.disk, @deliverables.disk], :automount => false) do |guestfs, guestfs_helper|
44
44
  @image_helper.sync_filesystem(guestfs, guestfs_helper)
45
+
46
+ # TODO is this really needed?
47
+ @log.debug "Uploading '/etc/resolv.conf'..."
48
+ guestfs.upload("/etc/resolv.conf", "/etc/resolv.conf")
49
+ @log.debug "'/etc/resolv.conf' uploaded."
45
50
 
46
51
  if (@appliance_config.os.name == 'rhel' or @appliance_config.os.name == 'centos') and @appliance_config.os.version == '5'
47
52
  # Remove normal kernel
@@ -52,11 +57,6 @@ module BoxGrinder
52
57
  @linux_helper.recreate_kernel_image(guestfs, ['xenblk', 'xennet'])
53
58
  end
54
59
 
55
- # TODO is this really needed?
56
- @log.debug "Uploading '/etc/resolv.conf'..."
57
- guestfs.upload("/etc/resolv.conf", "/etc/resolv.conf")
58
- @log.debug "'/etc/resolv.conf' uploaded."
59
-
60
60
  create_devices(guestfs)
61
61
 
62
62
  guestfs.mkdir("/data") if @appliance_config.is64bit?
@@ -136,7 +136,9 @@ module BoxGrinder
136
136
  menu_lst << menu_lst_data
137
137
  menu_lst.flush
138
138
 
139
- guestfs.upload(menu_lst.path, "/boot/grub/menu.lst")
139
+ menu_d = '/boot/grub'
140
+ guestfs.mkdir_p(menu_d) if guestfs.exists(menu_d) == 0
141
+ guestfs.upload(menu_lst.path, '/boot/grub/menu.lst')
140
142
 
141
143
  menu_lst.close
142
144
  @log.debug "'/boot/grub/menu.lst' file uploaded."
@@ -1,6 +1,4 @@
1
1
  LABEL=79d3d2d4 / #FILESYSTEM_TYPE# defaults 1 1
2
- /dev/#DISK_DEVICE_PREFIX#da2 /mnt ext3 defaults 1 2
3
- /dev/#DISK_DEVICE_PREFIX#da3 swap swap defaults 0 0
4
2
  none /dev/pts devpts gid=5,mode=620 0 0
5
3
  none /dev/shm tmpfs defaults 0 0
6
4
  none /proc proc defaults 0 0
@@ -1,6 +1,4 @@
1
1
  LABEL=79d3d2d4 / #FILESYSTEM_TYPE# defaults 1 1
2
- /dev/#DISK_DEVICE_PREFIX#db /mnt ext3 defaults 0 0
3
- /dev/#DISK_DEVICE_PREFIX#dc /data ext3 defaults 0 0
4
2
  none /dev/pts devpts gid=5,mode=620 0 0
5
3
  none /dev/shm tmpfs defaults 0 0
6
4
  none /proc proc defaults 0 0
@@ -1,31 +1,42 @@
1
- %global gemdir %(ruby -rubygems -e 'puts Gem::dir' 2>/dev/null)
2
- %global gemname boxgrinder-build
3
- %global geminstdir %{gemdir}/gems/%{gemname}-%{version}
1
+ %global gem_name boxgrinder-build
2
+
3
+ %{!?gem_dir: %global gem_dir %(ruby -rubygems -e 'puts Gem::dir' 2>/dev/null)}
4
+ %{!?gem_instdir: %global gem_instdir %{gem_dir}/gems/%{gem_name}-%{version}}
5
+
6
+ %if 0%{?fedora} >= 17
7
+ %global rubyabi 1.9.1
8
+ %else
4
9
  %global rubyabi 1.8
10
+ %endif
5
11
 
6
- Summary: A tool for creating appliances from simple plain text files
7
- Name: rubygem-%{gemname}
8
- Version: 0.10.1
9
- Release: 1%{?dist}
10
- Group: Development/Languages
11
- License: LGPLv3+
12
- URL: http://boxgrinder.org/
13
- Source0: http://rubygems.org/gems/%{gemname}-%{version}.gem
12
+ Summary: A tool for creating appliances from simple plain text files
13
+ Name: rubygem-%{gem_name}
14
+ Version: 0.10.2
15
+ Release: 1%{?dist}
16
+ Group: Development/Languages
17
+ License: LGPLv3+
18
+ URL: http://boxgrinder.org/
19
+ Source0: http://rubygems.org/gems/%{gem_name}-%{version}.gem
14
20
 
15
21
  Requires: ruby(abi) = %{rubyabi}
16
- Requires: rubygem(boxgrinder-core) >= 0.3.11
22
+ Requires: rubygem(boxgrinder-core) >= 0.3.12
17
23
  Requires: rubygem(boxgrinder-core) < 0.4.0
18
24
  Requires: ruby-libguestfs
19
25
 
20
26
  BuildArch: noarch
21
27
 
28
+ BuildRequires: rubygems-devel
22
29
  BuildRequires: rubygem(rake)
23
- BuildRequires: rubygem(boxgrinder-core) >= 0.3.11
30
+ BuildRequires: rubygem(boxgrinder-core) >= 0.3.12
24
31
  BuildRequires: rubygem(boxgrinder-core) < 0.4.0
25
32
  BuildRequires: rubygem(echoe)
26
33
  BuildRequires: ruby-libguestfs
27
- # Use rspec-core until rspec are migrated to RSpec 2.x
34
+
35
+ %if 0%{?fedora} >= 17
36
+ BuildRequires: rubygem(rspec)
37
+ %else
28
38
  BuildRequires: rubygem(rspec-core)
39
+ %endif
29
40
 
30
41
  # AWS
31
42
  Requires: euca2ools >= 1.3.1-4
@@ -52,14 +63,15 @@ BuildRequires: rubygem(nokogiri)
52
63
  BuildRequires: rubygem(builder)
53
64
 
54
65
  # RPM-BASED
55
- Requires: appliance-tools
66
+ Requires: appliance-tools >= 006.1-1
56
67
  Requires: yum-utils
57
68
 
58
- #Elastichosts
59
- BuildRequires: rubygem(rest-client)
69
+ # ElasticHosts
60
70
  Requires: rubygem(rest-client)
61
71
 
62
- Provides: rubygem(%{gemname}) = %{version}
72
+ BuildRequires: rubygem(rest-client)
73
+
74
+ Provides: rubygem(%{gem_name}) = %{version}
63
75
 
64
76
  Obsoletes: rubygem(boxgrinder-build-ebs-delivery-plugin) < 0.0.4-2
65
77
  Obsoletes: rubygem(boxgrinder-build-s3-delivery-plugin) < 0.0.6-1
@@ -96,53 +108,57 @@ Documentation for %{name}
96
108
  %build
97
109
 
98
110
  %install
99
- rm -rf %{buildroot}
100
- rm -rf %{_builddir}%{gemdir}
111
+ rm -rf %{_builddir}%{gem_dir}
101
112
 
102
- mkdir -p %{_builddir}%{gemdir}
113
+ mkdir -p %{_builddir}%{gem_dir}
103
114
  mkdir -p %{buildroot}/%{_bindir}
104
- mkdir -p %{buildroot}/%{gemdir}
115
+ mkdir -p %{buildroot}/%{gem_dir}
105
116
 
106
- /usr/bin/gem install --local --install-dir %{_builddir}%{gemdir} \
117
+ /usr/bin/gem install --local --install-dir %{_builddir}%{gem_dir} \
107
118
  --force --rdoc %{SOURCE0}
108
- mv %{_builddir}%{gemdir}/bin/* %{buildroot}/%{_bindir}
109
- find %{_builddir}%{geminstdir}/bin -type f | xargs chmod a+x
110
- rm -rf %{_builddir}/%{geminstdir}/integ/packages/*.rpm
111
- cp -r %{_builddir}%{gemdir}/* %{buildroot}/%{gemdir}
119
+ mv %{_builddir}%{gem_dir}/bin/* %{buildroot}/%{_bindir}
120
+ find %{_builddir}%{gem_instdir}/bin -type f | xargs chmod a+x
121
+ rm -rf %{_builddir}/%{gem_instdir}/integ/packages/*.rpm
122
+ cp -r %{_builddir}%{gem_dir}/* %{buildroot}/%{gem_dir}
112
123
 
113
124
  install -d -m 755 %{buildroot}/%{_sysconfdir}/bash_completion.d
114
- mv %{buildroot}/%{geminstdir}/bash_completion %{buildroot}/%{_sysconfdir}/bash_completion.d/%{name}
125
+ mv %{buildroot}/%{gem_instdir}/bash_completion %{buildroot}/%{_sysconfdir}/bash_completion.d/%{name}
126
+
127
+ chmod +x %{buildroot}/%{gem_instdir}/lib/boxgrinder-build/helpers/qemu.wrapper
115
128
 
116
129
  %check
117
- pushd %{_builddir}/%{geminstdir}
118
- rake spec
130
+ pushd %{_builddir}/%{gem_instdir}
131
+ rspec -r spec_helper -r boxgrinder-core -I. -P 'spec/**/*-spec.rb'
119
132
  popd
120
133
 
121
134
  %files
122
- %defattr(-, root, root, -)
123
135
  %{_bindir}/boxgrinder-build
124
136
  %{_sysconfdir}/bash_completion.d/%{name}
125
- %dir %{geminstdir}
126
- %{geminstdir}/bin
127
- %{geminstdir}/lib
128
- %doc %{geminstdir}/CHANGELOG
129
- %doc %{geminstdir}/LICENSE
130
- %doc %{geminstdir}/README.md
131
- %doc %{geminstdir}/Manifest
132
- %attr(755, root, root) %{geminstdir}/lib/boxgrinder-build/helpers/qemu.wrapper
133
- %{gemdir}/cache/%{gemname}-%{version}.gem
134
- %{gemdir}/specifications/%{gemname}-%{version}.gemspec
137
+ %dir %{gem_instdir}
138
+ %{gem_instdir}/bin
139
+ %{gem_libdir}
140
+ %doc %{gem_instdir}/CHANGELOG
141
+ %doc %{gem_instdir}/LICENSE
142
+ %doc %{gem_instdir}/README.md
143
+ %doc %{gem_instdir}/Manifest
144
+ %{gem_cache}
145
+ %{gem_spec}
135
146
 
136
147
  %files doc
137
- %defattr(-, root, root, -)
138
- %{geminstdir}/spec
139
- %{geminstdir}/integ
140
- %{geminstdir}/Rakefile
141
- %{geminstdir}/rubygem-%{gemname}.spec
142
- %{geminstdir}/%{gemname}.gemspec
143
- %{gemdir}/doc/%{gemname}-%{version}
148
+ %{gem_instdir}/spec
149
+ %{gem_instdir}/integ
150
+ %{gem_instdir}/Rakefile
151
+ %{gem_instdir}/rubygem-%{gem_name}.spec
152
+ %{gem_instdir}/%{gem_name}.gemspec
153
+ %{gem_docdir}
144
154
 
145
155
  %changelog
156
+ * Thu May 24 2012 Marc Savy <msavy@redhat.com> - 0.10.2
157
+ - Upstream release: 0.10.2
158
+ - [BGBUILD-347] Add support for Fedora 17. Remove unnecessary OS restrictions
159
+ - [BGBUILD-353] Remove all default attaching (EBS) and mounting (EBS, S3)
160
+ - [BGBUILD-361] Yum runs before having a proper /etc/resolv.conf (EC2 & CentOS 5)
161
+
146
162
  * Wed Feb 29 2012 Marc Savy <msavy@redhat.com> - 0.10.1-1
147
163
  - Upstream release: 0.10.1
148
164
  - [BGBUILD-332] Add support for bash completion
@@ -65,20 +65,6 @@ module BoxGrinder
65
65
  @plugin.instance_variable_set(:@plugin_config, @plugin_config)
66
66
  end
67
67
 
68
- it "should register all operating systems with specific versions" do
69
- prepare_plugin do |plugin|
70
- plugin.instance_variable_set(:@current_availability_zone, 'us-east-1a')
71
- end
72
-
73
- supported_oses = @plugin.instance_variable_get(:@supported_oses)
74
-
75
- supported_oses.size.should == 3
76
- Set.new(supported_oses.keys).should == Set.new(['fedora', 'rhel', 'centos'])
77
- supported_oses['rhel'].should == ['6']
78
- supported_oses['fedora'].should == ['13', '14', '15', '16']
79
- supported_oses['centos'].should == ['5', '6']
80
- end
81
-
82
68
  it "should adjust fstab" do
83
69
  prepare_plugin { |plugin| plugin.stub!(:after_init) }
84
70
 
@@ -71,17 +71,6 @@ module BoxGrinder
71
71
  @dir = @plugin.instance_variable_get(:@dir)
72
72
  end
73
73
 
74
- it "should register all operating systems with specific versions" do
75
- supportes_oses = @plugin.instance_variable_get(:@supported_oses)
76
-
77
- supportes_oses.size.should == 4
78
- Set.new(supportes_oses.keys).should == Set.new(['centos', 'fedora', 'rhel', 'sl'])
79
- supportes_oses['centos'].should == ['5', '6']
80
- supportes_oses['rhel'].should == ['5', '6']
81
- supportes_oses['sl'].should == ['5', '6']
82
- supportes_oses['fedora'].should == ['13', '14', '15', '16']
83
- end
84
-
85
74
  describe ".ami_key" do
86
75
 
87
76
  before(:each) do
@@ -247,17 +236,12 @@ module BoxGrinder
247
236
 
248
237
  describe ".validate" do
249
238
  before(:each) do
250
- @plugin.stub!(:asset_bucket).and_return(nil)
251
- @plugin.stub!(:asset_bucket).and_return(@bucket)
239
+ @plugin.stub(:asset_bucket).and_return(@bucket)
252
240
  end
253
241
 
254
242
  context "bucket is not already in existence" do
255
243
  before(:each) do
256
- @plugin.should_receive(:set_default_config_value).with('overwrite', false)
257
- @plugin.should_receive(:set_default_config_value).with('path', '/')
258
- @plugin.should_receive(:set_default_config_value).with('region', 'us-east-1')
259
- @plugin.should_receive(:set_default_config_value).with('ramdisk', false)
260
- @plugin.should_receive(:set_default_config_value).with('kernel', false)
244
+ @plugin.stub(:set_default_config_value).and_return(true)
261
245
  end
262
246
 
263
247
  it "should validate only basic params" do
@@ -270,13 +254,20 @@ module BoxGrinder
270
254
  it "should validate basic and additional ami params" do
271
255
  @plugin.instance_variable_set(:@type, :ami)
272
256
 
257
+ @plugin.should_receive(:set_default_config_value).with('overwrite', false)
258
+ @plugin.should_receive(:set_default_config_value).with('path', '/')
259
+ @plugin.should_receive(:set_default_config_value).with('block_device_mappings', {})
260
+ @plugin.should_receive(:set_default_config_value).with('region', 'us-east-1')
261
+ @plugin.should_receive(:set_default_config_value).with('ramdisk', false)
262
+ @plugin.should_receive(:set_default_config_value).with('kernel', false)
263
+
273
264
  @plugin.should_receive(:set_default_config_value).with('snapshot', false)
274
265
 
275
266
  @plugin.should_receive(:validate_plugin_config).with(['bucket', 'access_key', 'secret_access_key'], 'http://boxgrinder.org/tutorials/boxgrinder-build-plugins/#S3_Delivery_Plugin')
276
267
  @plugin.should_receive(:validate_plugin_config).with(["cert_file", "key_file", "account_number"], "http://boxgrinder.org/tutorials/boxgrinder-build-plugins/#S3_Delivery_Plugin")
277
268
 
278
- File.stub!(:expand_path)
279
- File.stub!(:exists?)
269
+ File.stub(:expand_path)
270
+ File.stub(:exists?)
280
271
  File.should_receive(:expand_path).with('/path/to/cert/file').and_return('path1')
281
272
  File.should_receive(:exists?).with('path1').and_return(true)
282
273
  File.should_receive(:expand_path).with('/path/to/key/file').and_return('path2')
@@ -296,8 +287,8 @@ module BoxGrinder
296
287
  @plugin.should_receive(:validate_plugin_config).with(['bucket', 'access_key', 'secret_access_key'], 'http://boxgrinder.org/tutorials/boxgrinder-build-plugins/#S3_Delivery_Plugin')
297
288
  @plugin.should_receive(:validate_plugin_config).with(["cert_file", "key_file", "account_number"], "http://boxgrinder.org/tutorials/boxgrinder-build-plugins/#S3_Delivery_Plugin")
298
289
 
299
- File.stub!(:expand_path)
300
- File.stub!(:exists?)
290
+ File.stub(:expand_path)
291
+ File.stub(:exists?)
301
292
  File.should_receive(:expand_path).with('/path/to/cert/file').and_return('path1')
302
293
  File.should_receive(:exists?).with('path1').and_return(true)
303
294
  File.should_receive(:expand_path).with('/path/to/key/file').and_return('path2')
@@ -314,8 +305,8 @@ module BoxGrinder
314
305
  @plugin.should_receive(:validate_plugin_config).with(['bucket', 'access_key', 'secret_access_key'], 'http://boxgrinder.org/tutorials/boxgrinder-build-plugins/#S3_Delivery_Plugin')
315
306
  @plugin.should_receive(:validate_plugin_config).with(["cert_file", "key_file", "account_number"], "http://boxgrinder.org/tutorials/boxgrinder-build-plugins/#S3_Delivery_Plugin")
316
307
 
317
- File.stub!(:expand_path)
318
- File.stub!(:exists?)
308
+ File.stub(:expand_path)
309
+ File.stub(:exists?)
319
310
  File.should_receive(:expand_path).with('/path/to/cert/file').and_return('path1')
320
311
  File.should_receive(:exists?).with('path1').and_return(false)
321
312
 
@@ -332,8 +323,8 @@ module BoxGrinder
332
323
  @plugin.should_receive(:validate_plugin_config).with(['bucket', 'access_key', 'secret_access_key'], 'http://boxgrinder.org/tutorials/boxgrinder-build-plugins/#S3_Delivery_Plugin')
333
324
  @plugin.should_receive(:validate_plugin_config).with(["cert_file", "key_file", "account_number"], "http://boxgrinder.org/tutorials/boxgrinder-build-plugins/#S3_Delivery_Plugin")
334
325
 
335
- File.stub!(:expand_path)
336
- File.stub!(:exists?)
326
+ File.stub(:expand_path)
327
+ File.stub(:exists?)
337
328
  File.should_receive(:expand_path).with('/path/to/cert/file').and_return('path1')
338
329
  File.should_receive(:exists?).with('path1').and_return(true)
339
330
  File.should_receive(:expand_path).with('/path/to/key/file').and_return('path2')
@@ -347,10 +338,10 @@ module BoxGrinder
347
338
 
348
339
  before(:each) do
349
340
  @plugin.instance_variable_set(:@type, :ami)
350
- @plugin.stub!(:set_default_config_value)
341
+ @plugin.stub(:set_default_config_value)
351
342
 
352
- File.stub!(:expand_path)
353
- File.stub!(:exists?)
343
+ File.stub(:expand_path)
344
+ File.stub(:exists?)
354
345
  File.should_receive(:expand_path).with('/path/to/cert/file').and_return('path1')
355
346
  File.should_receive(:exists?).with('path1').and_return(true)
356
347
  File.should_receive(:expand_path).with('/path/to/key/file').and_return('path2')
@@ -379,7 +370,7 @@ module BoxGrinder
379
370
 
380
371
  describe ".bucket" do
381
372
  before(:each) do
382
- @plugin.unstub!(:asset_bucket)
373
+ @plugin.unstub(:asset_bucket)
383
374
  end
384
375
 
385
376
  it "should create the asset bucket by default" do
@@ -418,18 +409,18 @@ module BoxGrinder
418
409
  describe ".register_image" do
419
410
  before(:each) do
420
411
  @ami = mock(AWS::EC2::Image)
421
- @ami.stub!(:id).and_return('ami-1234')
412
+ @ami.stub(:id).and_return('ami-1234')
422
413
 
423
414
  @manifest_key = mock(AWS::S3::S3Object)
424
- @manifest_key.stub!(:key).and_return('ami/manifest/key')
415
+ @manifest_key.stub(:key).and_return('ami/manifest/key')
425
416
 
426
- @ec2.stub!(:images)
427
- @ec2helper.stub!(:wait_for_image_state)
417
+ @ec2.stub(:images)
418
+ @ec2helper.stub(:wait_for_image_state)
428
419
  end
429
420
 
430
421
  context "when the AMI has not been registered" do
431
422
  before(:each) do
432
- @plugin.stub!(:ami_by_manifest_key).and_return(nil)
423
+ @plugin.stub(:ami_by_manifest_key).and_return(nil)
433
424
  end
434
425
 
435
426
  it "should register the AMI" do
@@ -442,7 +433,7 @@ module BoxGrinder
442
433
 
443
434
  context "when the AMI has been registered" do
444
435
  before(:each) do
445
- @plugin.stub!(:ami_by_manifest_key).and_return(@ami)
436
+ @plugin.stub(:ami_by_manifest_key).and_return(@ami)
446
437
  end
447
438
 
448
439
  it "should not register the AMI" do
@@ -457,13 +448,13 @@ module BoxGrinder
457
448
  describe ".deregister_image" do
458
449
  before(:each) do
459
450
  @ami = mock(AWS::EC2::Image)
460
- @plugin.stub!(:ami_by_manifest_key).and_return(@ami)
451
+ @plugin.stub(:ami_by_manifest_key).and_return(@ami)
461
452
 
462
453
  @manifest_key = mock(AWS::S3::S3Object)
463
- @ec2helper.stub!(:wait_for_image_death)
454
+ @ec2helper.stub(:wait_for_image_death)
464
455
 
465
- @ami.stub!(:id)
466
- @ami.stub!(:location)
456
+ @ami.stub(:id)
457
+ @ami.stub(:location)
467
458
  end
468
459
 
469
460
  it "should deregister the AMI" do