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.
- data/CHANGELOG +5 -0
- data/Manifest +44 -2
- data/Rakefile +1 -1
- data/bin/boxgrinder-build +1 -0
- data/boxgrinder-build.gemspec +8 -8
- data/integ/spec/files-spec.rb +2 -1
- data/integ/spec/jeos-spec.rb +2 -1
- data/integ/spec/modular-spec.rb +3 -1
- data/lib/boxgrinder-build/helpers/aws-helper.rb +22 -31
- data/lib/boxgrinder-build/helpers/banner-helper.rb +29 -0
- data/lib/boxgrinder-build/plugins/base-plugin.rb +6 -2
- data/lib/boxgrinder-build/plugins/delivery/ebs/ebs-plugin.rb +26 -21
- data/lib/boxgrinder-build/plugins/delivery/ebs/messages.rb +23 -0
- data/lib/boxgrinder-build/plugins/delivery/s3/messages.rb +22 -0
- data/lib/boxgrinder-build/plugins/delivery/s3/s3-plugin.rb +18 -6
- data/lib/boxgrinder-build/plugins/os/fedora/fedora-plugin.rb +9 -3
- data/lib/boxgrinder-build/plugins/platform/ec2/ec2-plugin.rb +9 -7
- data/lib/boxgrinder-build/plugins/platform/ec2/src/fstab_32bit +0 -2
- data/lib/boxgrinder-build/plugins/platform/ec2/src/fstab_64bit +0 -2
- data/rubygem-boxgrinder-build.spec +64 -48
- data/spec/plugins/delivery/ebs/ebs-plugin-spec.rb +0 -14
- data/spec/plugins/delivery/s3/s3-plugin-spec.rb +31 -40
- data/spec/plugins/platform/ec2/ec2-plugin-spec.rb +1 -0
- data/spec/rcov_helper.rb +1 -0
- metadata +135 -132
@@ -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
|
-
|
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
|
-
|
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',
|
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
|
-
|
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,31 +1,42 @@
|
|
1
|
-
%global
|
2
|
-
|
3
|
-
%global
|
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:
|
7
|
-
Name:
|
8
|
-
Version:
|
9
|
-
Release:
|
10
|
-
Group:
|
11
|
-
License:
|
12
|
-
URL:
|
13
|
-
Source0:
|
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.
|
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.
|
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
|
-
|
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
|
-
#
|
59
|
-
BuildRequires: rubygem(rest-client)
|
69
|
+
# ElasticHosts
|
60
70
|
Requires: rubygem(rest-client)
|
61
71
|
|
62
|
-
|
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 %{
|
100
|
-
rm -rf %{_builddir}%{gemdir}
|
111
|
+
rm -rf %{_builddir}%{gem_dir}
|
101
112
|
|
102
|
-
mkdir -p %{_builddir}%{
|
113
|
+
mkdir -p %{_builddir}%{gem_dir}
|
103
114
|
mkdir -p %{buildroot}/%{_bindir}
|
104
|
-
mkdir -p %{buildroot}/%{
|
115
|
+
mkdir -p %{buildroot}/%{gem_dir}
|
105
116
|
|
106
|
-
/usr/bin/gem install --local --install-dir %{_builddir}%{
|
117
|
+
/usr/bin/gem install --local --install-dir %{_builddir}%{gem_dir} \
|
107
118
|
--force --rdoc %{SOURCE0}
|
108
|
-
mv %{_builddir}%{
|
109
|
-
find %{_builddir}%{
|
110
|
-
rm -rf %{_builddir}/%{
|
111
|
-
cp -r %{_builddir}%{
|
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}/%{
|
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}/%{
|
118
|
-
|
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 %{
|
126
|
-
%{
|
127
|
-
%{
|
128
|
-
%doc %{
|
129
|
-
%doc %{
|
130
|
-
%doc %{
|
131
|
-
%doc %{
|
132
|
-
%
|
133
|
-
%{
|
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
|
-
%
|
138
|
-
%{
|
139
|
-
%{
|
140
|
-
%{
|
141
|
-
%{
|
142
|
-
%{
|
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
|
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.
|
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
|
279
|
-
File.stub
|
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
|
300
|
-
File.stub
|
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
|
318
|
-
File.stub
|
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
|
336
|
-
File.stub
|
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
|
341
|
+
@plugin.stub(:set_default_config_value)
|
351
342
|
|
352
|
-
File.stub
|
353
|
-
File.stub
|
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
|
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
|
412
|
+
@ami.stub(:id).and_return('ami-1234')
|
422
413
|
|
423
414
|
@manifest_key = mock(AWS::S3::S3Object)
|
424
|
-
@manifest_key.stub
|
415
|
+
@manifest_key.stub(:key).and_return('ami/manifest/key')
|
425
416
|
|
426
|
-
@ec2.stub
|
427
|
-
@ec2helper.stub
|
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
|
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
|
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
|
451
|
+
@plugin.stub(:ami_by_manifest_key).and_return(@ami)
|
461
452
|
|
462
453
|
@manifest_key = mock(AWS::S3::S3Object)
|
463
|
-
@ec2helper.stub
|
454
|
+
@ec2helper.stub(:wait_for_image_death)
|
464
455
|
|
465
|
-
@ami.stub
|
466
|
-
@ami.stub
|
456
|
+
@ami.stub(:id)
|
457
|
+
@ami.stub(:location)
|
467
458
|
end
|
468
459
|
|
469
460
|
it "should deregister the AMI" do
|