boxgrinder-build 0.9.2 → 0.9.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +21 -0
- data/Manifest +92 -0
- data/Rakefile +9 -0
- data/boxgrinder-build.gemspec +4 -4
- data/integ/appliances/_hardware_cpus.appl +13 -0
- data/integ/appliances/_hardware_memory.appl +13 -0
- data/integ/appliances/_hardware_partitions_home.appl +15 -0
- data/integ/appliances/_hardware_partitions_root.appl +15 -0
- data/integ/appliances/_os_password.appl +15 -0
- data/integ/appliances/_packages_groups_base.appl +13 -0
- data/integ/appliances/_packages_groups_core.appl +13 -0
- data/integ/appliances/_packages_squid.appl +13 -0
- data/integ/appliances/_packages_utils.appl +7 -0
- data/integ/appliances/_repos_boxgrinder_permanent_noarch.appl +14 -0
- data/integ/appliances/_repos_testlocal_ephemeral_noarch.appl +17 -0
- data/integ/appliances/_test_base.appl +22 -0
- data/integ/appliances/gnome-fedora.appl +19 -0
- data/integ/appliances/jeos-centos.appl +4 -0
- data/integ/appliances/jeos-fedora.appl +5 -0
- data/integ/appliances/modular.appl +16 -0
- data/integ/packages/ephemeral-repo-test-0.1-1.noarch.rpm +0 -0
- data/integ/packages/local-repo-test.spec +20 -0
- data/integ/spec/jeos-spec.rb +69 -0
- data/integ/spec/modular-spec.rb +71 -0
- data/lib/boxgrinder-build/appliance.rb +48 -48
- data/lib/boxgrinder-build/helpers/guestfs-helper.rb +11 -8
- data/lib/boxgrinder-build/helpers/plugin-helper.rb +1 -0
- data/lib/boxgrinder-build/helpers/qemu.wrapper +1 -1
- data/lib/boxgrinder-build/plugins/base-plugin.rb +55 -14
- data/lib/boxgrinder-build/plugins/delivery/ebs/ebs-plugin.rb +270 -54
- data/lib/boxgrinder-build/plugins/delivery/elastichosts/elastichosts-plugin.rb +3 -4
- data/lib/boxgrinder-build/plugins/delivery/local/local-plugin.rb +20 -16
- data/lib/boxgrinder-build/plugins/delivery/s3/s3-plugin.rb +57 -20
- data/lib/boxgrinder-build/plugins/delivery/sftp/sftp-plugin.rb +6 -4
- data/lib/boxgrinder-build/plugins/os/fedora/fedora-plugin.rb +2 -1
- data/lib/boxgrinder-build/plugins/os/rpm-based/kickstart.rb +2 -32
- data/lib/boxgrinder-build/plugins/os/rpm-based/rpm-based-os-plugin.rb +29 -4
- data/lib/boxgrinder-build/plugins/os/rpm-based/rpm-dependency-validator.rb +15 -46
- data/lib/boxgrinder-build/plugins/os/sl/sl-plugin.rb +56 -0
- data/lib/boxgrinder-build/plugins/platform/ec2/ec2-plugin.rb +1 -0
- data/lib/boxgrinder-build/plugins/platform/ec2/src/rc_local +15 -8
- data/lib/boxgrinder-build/plugins/platform/vmware/vmware-plugin.rb +8 -6
- data/rubygem-boxgrinder-build.spec +23 -3
- data/spec/appliance-spec.rb +114 -73
- data/spec/helpers/guestfs-helper-spec.rb +12 -3
- data/spec/plugins/base-plugin-spec.rb +24 -18
- data/spec/plugins/delivery/ebs/ebs-plugin-spec.rb +206 -67
- data/spec/plugins/delivery/elastichosts/elastichosts-plugin-spec.rb +228 -225
- data/spec/plugins/delivery/local/local-plugin-spec.rb +13 -34
- data/spec/plugins/delivery/s3/s3-plugin-spec.rb +107 -50
- data/spec/plugins/os/centos/centos-plugin-spec.rb +1 -1
- data/spec/plugins/os/fedora/fedora-plugin-spec.rb +14 -8
- data/spec/plugins/os/rhel/rhel-plugin-spec.rb +1 -1
- data/spec/plugins/os/rpm-based/kickstart-spec.rb +0 -44
- data/spec/plugins/os/rpm-based/rpm-based-os-plugin-spec.rb +31 -2
- data/spec/plugins/os/rpm-based/rpm-dependency-validator-spec.rb +20 -7
- data/spec/plugins/os/sl/sl-plugin-spec.rb +44 -0
- data/spec/plugins/platform/ec2/ec2-plugin-spec.rb +1 -1
- data/spec/plugins/platform/virtualbox/virtualbox-plugin-spec.rb +6 -6
- data/spec/plugins/platform/vmware/vmware-plugin-spec.rb +14 -13
- metadata +27 -5
- data/spec/Rakefile +0 -32
@@ -24,11 +24,7 @@ module BoxGrinder
|
|
24
24
|
describe LocalPlugin do
|
25
25
|
|
26
26
|
before(:each) do
|
27
|
-
@config =
|
28
|
-
@config.stub!(:delivery_config).and_return({})
|
29
|
-
plugins = mock('Plugins')
|
30
|
-
plugins.stub!(:[]).with('local').and_return({})
|
31
|
-
@config.stub!(:[]).with(:plugins).and_return(plugins)
|
27
|
+
@config = Config.new('plugins' => {'local' => {'path' => 'a/path'}})
|
32
28
|
|
33
29
|
@appliance_config = mock('ApplianceConfig')
|
34
30
|
|
@@ -40,12 +36,14 @@ module BoxGrinder
|
|
40
36
|
@appliance_config.stub!(:hardware).and_return(OpenCascade.new({:arch => 'x86_64'}))
|
41
37
|
|
42
38
|
@plugin = LocalPlugin.new.init(@config, @appliance_config,
|
43
|
-
:
|
44
|
-
:
|
45
|
-
:
|
39
|
+
{:class => BoxGrinder::LocalPlugin, :type => :delivery, :name => :local, :full_name => "Local file system"},
|
40
|
+
:log => LogHelper.new(:level => :trace, :type => :stdout),
|
41
|
+
:previous_plugin => OpenCascade.new(:deliverables => {:disk => "a_disk.raw", :metadata => 'metadata.xml'})
|
46
42
|
)
|
47
43
|
|
48
|
-
@
|
44
|
+
@plugin.validate
|
45
|
+
|
46
|
+
@plugin_config = @config.plugins['local']
|
49
47
|
@appliance_config = @plugin.instance_variable_get(:@appliance_config)
|
50
48
|
@exec_helper = @plugin.instance_variable_get(:@exec_helper)
|
51
49
|
@log = @plugin.instance_variable_get(:@log)
|
@@ -53,32 +51,19 @@ module BoxGrinder
|
|
53
51
|
end
|
54
52
|
|
55
53
|
describe ".execute" do
|
56
|
-
|
57
54
|
it "should package and deliver the appliance" do
|
58
|
-
@
|
59
|
-
|
60
|
-
'path' => 'a/path',
|
61
|
-
'package' => true
|
62
|
-
})
|
63
|
-
|
55
|
+
@plugin_config.merge!('package' => true)
|
56
|
+
|
64
57
|
FileUtils.should_receive(:mkdir_p).with('a/path')
|
65
58
|
package_helper = mock(PackageHelper)
|
66
|
-
package_helper.should_receive(:package).with('.', "build/path/local-plugin/tmp/appliance-1.0-fedora-13-x86_64-raw.tgz").and_return("deliverable")
|
67
|
-
|
68
59
|
PackageHelper.should_receive(:new).with(@config, @appliance_config, :log => @log, :exec_helper => @exec_helper).and_return(package_helper)
|
69
|
-
|
70
|
-
@exec_helper.should_receive(:execute).with("cp 'build/path/local-plugin/tmp/appliance-1.0-fedora-13-x86_64-raw.tgz' 'a/path'")
|
71
|
-
@plugin.should_receive(:deliverables_exists?).and_return(false)
|
60
|
+
package_helper.should_receive(:package).with('.', "a/path/appliance-1.0-fedora-13-x86_64-raw.tgz").and_return("deliverable")
|
72
61
|
|
73
62
|
@plugin.execute
|
74
63
|
end
|
75
64
|
|
76
65
|
it "should not package, but deliver the appliance" do
|
77
|
-
@
|
78
|
-
'overwrite' => true,
|
79
|
-
'path' => 'a/path',
|
80
|
-
'package' => false
|
81
|
-
})
|
66
|
+
@plugin_config.merge!('package' => false)
|
82
67
|
|
83
68
|
FileUtils.should_receive(:mkdir_p).with('a/path')
|
84
69
|
PackageHelper.should_not_receive(:new)
|
@@ -107,10 +92,7 @@ module BoxGrinder
|
|
107
92
|
|
108
93
|
describe ".deliverables_exists?" do
|
109
94
|
it "should return true for package" do
|
110
|
-
@
|
111
|
-
'path' => 'a/path',
|
112
|
-
'package' => true
|
113
|
-
})
|
95
|
+
@plugin_config.merge!('package' => true)
|
114
96
|
|
115
97
|
File.should_receive(:exists?).with('a/path/appliance-1.0-fedora-13-x86_64-raw.tgz').and_return(true)
|
116
98
|
|
@@ -118,10 +100,7 @@ module BoxGrinder
|
|
118
100
|
end
|
119
101
|
|
120
102
|
it "should return true for non-packaged appliance" do
|
121
|
-
@
|
122
|
-
'path' => 'a/path',
|
123
|
-
'package' => false
|
124
|
-
})
|
103
|
+
@plugin_config.merge!('package' => false)
|
125
104
|
|
126
105
|
File.should_receive(:exists?).with('a/path/a_disk.raw').and_return(true)
|
127
106
|
File.should_receive(:exists?).with('a/path/metadata.xml').and_return(true)
|
@@ -19,20 +19,24 @@
|
|
19
19
|
require 'rubygems'
|
20
20
|
require 'boxgrinder-build/plugins/delivery/s3/s3-plugin'
|
21
21
|
require 'hashery/opencascade'
|
22
|
-
|
23
|
-
# quick fix for old active_support require issue in EPEL 5
|
24
|
-
require 'active_support/basic_object'
|
25
|
-
require 'active_support/duration'
|
22
|
+
require 'boxgrinder-core/models/config'
|
26
23
|
|
27
24
|
module BoxGrinder
|
28
25
|
describe S3Plugin do
|
29
26
|
|
30
27
|
before(:each) do
|
31
|
-
@config =
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
28
|
+
@config = Config.new(
|
29
|
+
'plugins' => {
|
30
|
+
's3' => {
|
31
|
+
'access_key' => 'access_key',
|
32
|
+
'secret_access_key' => 'secret_access_key',
|
33
|
+
'bucket' => 'bucket',
|
34
|
+
'account_number' => '0000-0000-0000',
|
35
|
+
'cert_file' => '/path/to/cert/file',
|
36
|
+
'key_file' => '/path/to/key/file',
|
37
|
+
'path' => '/'
|
38
|
+
}
|
39
|
+
})
|
36
40
|
|
37
41
|
@appliance_config = mock('ApplianceConfig')
|
38
42
|
|
@@ -43,37 +47,23 @@ module BoxGrinder
|
|
43
47
|
@appliance_config.stub!(:os).and_return(OpenCascade.new({:name => 'fedora', :version => '14'}))
|
44
48
|
@appliance_config.stub!(:hardware).and_return(OpenCascade.new({:arch => 'x86_64', :base_arch => 'x86_64'}))
|
45
49
|
|
46
|
-
@plugin = S3Plugin.new.init(@config, @appliance_config,
|
50
|
+
@plugin = S3Plugin.new.init(@config, @appliance_config, {:class => BoxGrinder::S3Plugin, :type => :delivery, :name => :s3, :full_name => "Amazon Simple Storage Service (Amazon S3)", :types => [:s3, :cloudfront, :ami]}, :log => LogHelper.new(:level => :trace, :type => :stdout), :type => :s3)
|
51
|
+
@plugin.validate
|
47
52
|
|
48
|
-
@config = @plugin.instance_variable_get(:@config)
|
49
53
|
@appliance_config = @plugin.instance_variable_get(:@appliance_config)
|
50
54
|
@exec_helper = @plugin.instance_variable_get(:@exec_helper)
|
51
55
|
@log = @plugin.instance_variable_get(:@log)
|
52
56
|
@dir = @plugin.instance_variable_get(:@dir)
|
53
|
-
|
54
|
-
@plugin_config = @plugin.instance_variable_get(:@plugin_config).merge(
|
55
|
-
{
|
56
|
-
'access_key' => 'access_key',
|
57
|
-
'secret_access_key' => 'secret_access_key',
|
58
|
-
'bucket' => 'bucket',
|
59
|
-
'account_number' => '0000-0000-0000',
|
60
|
-
'cert_file' => '/path/to/cert/file',
|
61
|
-
'key_file' => '/path/to/key/file',
|
62
|
-
'path' => '/'
|
63
|
-
}
|
64
|
-
)
|
65
|
-
|
66
|
-
@plugin.instance_variable_set(:@plugin_config, @plugin_config)
|
67
|
-
|
68
57
|
end
|
69
58
|
|
70
59
|
it "should register all operating systems with specific versions" do
|
71
60
|
supportes_oses = @plugin.instance_variable_get(:@supported_oses)
|
72
61
|
|
73
|
-
supportes_oses.size.should ==
|
74
|
-
supportes_oses.keys.sort.should == ['centos', 'fedora', 'rhel']
|
62
|
+
supportes_oses.size.should == 4
|
63
|
+
supportes_oses.keys.sort.should == ['centos', 'fedora', 'rhel', 'sl']
|
75
64
|
supportes_oses['centos'].should == ['5']
|
76
65
|
supportes_oses['rhel'].should == ['5', '6']
|
66
|
+
supportes_oses['sl'].should == ['5', '6']
|
77
67
|
supportes_oses['fedora'].should == ['13', '14', '15']
|
78
68
|
end
|
79
69
|
|
@@ -95,7 +85,8 @@ module BoxGrinder
|
|
95
85
|
end
|
96
86
|
|
97
87
|
it "should generate valid ami_key with snapshot number two" do
|
98
|
-
@
|
88
|
+
@config.plugins['s3'].merge!('snapshot' => true)
|
89
|
+
|
99
90
|
bucket = mock('Bucket')
|
100
91
|
bucket.should_receive(:keys).twice
|
101
92
|
|
@@ -113,8 +104,27 @@ module BoxGrinder
|
|
113
104
|
@plugin.ami_key("name", "/").should == "name/fedora/14/1.0-SNAPSHOT-2/x86_64"
|
114
105
|
end
|
115
106
|
|
116
|
-
it "should
|
117
|
-
@
|
107
|
+
it "should return valid ami_key with snapshot and overwrite enabled" do
|
108
|
+
@config.plugins['s3'].merge!('snapshot' => true, 'overwrite' => true)
|
109
|
+
bucket = mock('Bucket')
|
110
|
+
bucket.should_receive(:keys).twice
|
111
|
+
|
112
|
+
key = mock('Key')
|
113
|
+
key.should_receive(:exists?).and_return(true)
|
114
|
+
|
115
|
+
key1 = mock('Key')
|
116
|
+
key1.should_receive(:exists?).and_return(false)
|
117
|
+
|
118
|
+
bucket.should_receive(:key).with("name/fedora/14/1.0-SNAPSHOT-1/x86_64/").and_return(key)
|
119
|
+
bucket.should_receive(:key).with("name/fedora/14/1.0-SNAPSHOT-2/x86_64/").and_return(key1)
|
120
|
+
|
121
|
+
@plugin.should_receive(:bucket).twice.with(false).and_return(bucket)
|
122
|
+
# Re-use the last key again
|
123
|
+
@plugin.ami_key("name", "/").should == "name/fedora/14/1.0-SNAPSHOT-1/x86_64"
|
124
|
+
end
|
125
|
+
|
126
|
+
it "should generate valid ami_key with snapshot when bucket doesn't exist" do
|
127
|
+
@config.plugins['s3'].merge!('snapshot' => true)
|
118
128
|
@plugin.should_receive(:bucket).with(false).and_raise('ABC')
|
119
129
|
@plugin.ami_key("name", "/").should == "name/fedora/14/1.0-SNAPSHOT-1/x86_64"
|
120
130
|
end
|
@@ -144,7 +154,7 @@ module BoxGrinder
|
|
144
154
|
@plugin.instance_variable_set(:@s3, s3)
|
145
155
|
|
146
156
|
key = mock('Key')
|
147
|
-
key.should_receive(:exists?).and_return(false)
|
157
|
+
key.should_receive(:exists?).twice.and_return(false)
|
148
158
|
key.should_receive(:put).with('abc', 'private', :server => 's3.amazonaws.com')
|
149
159
|
|
150
160
|
bucket = mock('Bucket')
|
@@ -191,7 +201,7 @@ module BoxGrinder
|
|
191
201
|
@plugin.bundle_image(:disk => "a/path/to/disk.ec2")
|
192
202
|
end
|
193
203
|
|
194
|
-
it "should bundle the image for centos 5
|
204
|
+
it "should bundle the image for centos 5 and choose right kernel and ramdisk" do
|
195
205
|
@appliance_config.stub!(:os).and_return(OpenCascade.new({:name => 'centos', :version => '5'}))
|
196
206
|
|
197
207
|
File.should_receive(:exists?).with('build/path/s3-plugin/ami').and_return(false)
|
@@ -210,10 +220,10 @@ module BoxGrinder
|
|
210
220
|
|
211
221
|
describe ".execute" do
|
212
222
|
it "should create AMI" do
|
223
|
+
@plugin.instance_variable_set(:@type, :ami)
|
224
|
+
|
213
225
|
@plugin.instance_variable_set(:@previous_deliverables, {:disk => 'a/disk'})
|
214
226
|
|
215
|
-
@plugin.should_receive(:validate_plugin_config).with(["bucket", "access_key", "secret_access_key"], "http://boxgrinder.org/tutorials/boxgrinder-build-plugins/#S3_Delivery_Plugin")
|
216
|
-
@plugin.should_receive(:validate_plugin_config).with(["cert_file", "key_file", "account_number"], "http://boxgrinder.org/tutorials/boxgrinder-build-plugins/#S3_Delivery_Plugin")
|
217
227
|
@plugin.should_receive(:ami_key).with("appliance", "/").and_return('ami/key')
|
218
228
|
@plugin.should_receive(:s3_object_exists?).with("ami/key/appliance.ec2.manifest.xml").and_return(false)
|
219
229
|
@plugin.should_receive(:bundle_image).with(:disk => 'a/disk')
|
@@ -221,25 +231,24 @@ module BoxGrinder
|
|
221
231
|
@plugin.should_receive(:upload_image)
|
222
232
|
@plugin.should_receive(:register_image)
|
223
233
|
|
224
|
-
@plugin.execute
|
234
|
+
@plugin.execute
|
225
235
|
end
|
226
236
|
|
227
237
|
it "should not upload AMI because it's already there" do
|
228
|
-
@plugin.
|
229
|
-
|
238
|
+
@plugin.instance_variable_set(:@type, :ami)
|
239
|
+
|
230
240
|
@plugin.should_receive(:ami_key).with("appliance", "/").and_return('ami/key')
|
231
241
|
@plugin.should_receive(:s3_object_exists?).with("ami/key/appliance.ec2.manifest.xml").and_return(true)
|
232
242
|
@plugin.should_not_receive(:upload_image)
|
233
243
|
@plugin.should_receive(:register_image)
|
234
244
|
|
235
|
-
@plugin.execute
|
245
|
+
@plugin.execute
|
236
246
|
end
|
237
247
|
|
238
248
|
it "should upload AMI even if it's already there because we want a snapshot" do
|
239
|
-
@
|
249
|
+
@config.plugins['s3'].merge!('snapshot' => true)
|
240
250
|
|
241
|
-
@plugin.
|
242
|
-
@plugin.should_receive(:validate_plugin_config).with(["cert_file", "key_file", "account_number"], "http://boxgrinder.org/tutorials/boxgrinder-build-plugins/#S3_Delivery_Plugin")
|
251
|
+
@plugin.instance_variable_set(:@type, :ami)
|
243
252
|
|
244
253
|
@plugin.should_receive(:ami_key).with("appliance", "/").and_return('ami/key')
|
245
254
|
@plugin.should_receive(:s3_object_exists?).with("ami/key/appliance.ec2.manifest.xml").and_return(true)
|
@@ -248,25 +257,72 @@ module BoxGrinder
|
|
248
257
|
@plugin.should_receive(:upload_image).with("ami/key")
|
249
258
|
@plugin.should_receive(:register_image).with("ami/key/appliance.ec2.manifest.xml")
|
250
259
|
|
251
|
-
@plugin.execute
|
260
|
+
@plugin.execute
|
252
261
|
end
|
253
262
|
|
254
263
|
it "should upload image to s3" do
|
264
|
+
@plugin.instance_variable_set(:@type, :s3)
|
255
265
|
@plugin.instance_variable_set(:@previous_deliverables, :disk => 'a/disk')
|
256
266
|
@plugin.should_receive(:upload_to_bucket).with({:disk => 'a/disk'})
|
257
|
-
@plugin.execute
|
267
|
+
@plugin.execute
|
258
268
|
end
|
259
269
|
|
260
|
-
it "should upload image to
|
270
|
+
it "should upload image to cloudfront" do
|
271
|
+
@plugin.instance_variable_set(:@type, :cloudfront)
|
261
272
|
@plugin.instance_variable_set(:@previous_deliverables, {:disk => 'a/disk'})
|
262
273
|
@plugin.should_receive(:upload_to_bucket).with({:disk => 'a/disk'}, 'public-read')
|
263
|
-
@plugin.execute
|
274
|
+
@plugin.execute
|
275
|
+
end
|
276
|
+
end
|
277
|
+
|
278
|
+
describe ".validate" do
|
279
|
+
|
280
|
+
it "should validate only basic params" do
|
281
|
+
@plugin.should_receive(:set_default_config_value).with('overwrite', false)
|
282
|
+
@plugin.should_receive(:set_default_config_value).with('path', '/')
|
283
|
+
@plugin.should_receive(:set_default_config_value).with('region', 'us-east-1')
|
284
|
+
|
285
|
+
@plugin.should_receive(:validate_plugin_config).with(['bucket', 'access_key', 'secret_access_key'], 'http://boxgrinder.org/tutorials/boxgrinder-build-plugins/#S3_Delivery_Plugin')
|
286
|
+
|
287
|
+
@plugin.validate
|
288
|
+
end
|
289
|
+
|
290
|
+
it "should validate basic and additional ami params" do
|
291
|
+
@plugin.instance_variable_set(:@type, :ami)
|
292
|
+
|
293
|
+
@plugin.should_receive(:set_default_config_value).with('overwrite', false)
|
294
|
+
@plugin.should_receive(:set_default_config_value).with('path', '/')
|
295
|
+
@plugin.should_receive(:set_default_config_value).with('region', 'us-east-1')
|
296
|
+
@plugin.should_receive(:set_default_config_value).with('snapshot', false)
|
297
|
+
|
298
|
+
@plugin.should_receive(:validate_plugin_config).with(['bucket', 'access_key', 'secret_access_key'], 'http://boxgrinder.org/tutorials/boxgrinder-build-plugins/#S3_Delivery_Plugin')
|
299
|
+
@plugin.should_receive(:validate_plugin_config).with(["cert_file", "key_file", "account_number"], "http://boxgrinder.org/tutorials/boxgrinder-build-plugins/#S3_Delivery_Plugin")
|
300
|
+
|
301
|
+
@plugin.validate
|
302
|
+
end
|
303
|
+
|
304
|
+
it "should raise an error if an invalid region is specified" do
|
305
|
+
@plugin.instance_variable_set(:@type, :ami)
|
306
|
+
|
307
|
+
@config.plugins['s3']['region'] = 'bolkonski'
|
308
|
+
|
309
|
+
@plugin.should_receive(:set_default_config_value).with('overwrite', false)
|
310
|
+
@plugin.should_receive(:set_default_config_value).with('path', '/')
|
311
|
+
@plugin.should_receive(:set_default_config_value).with('region', 'us-east-1')
|
312
|
+
@plugin.should_receive(:set_default_config_value).with('snapshot', false)
|
313
|
+
|
314
|
+
@plugin.should_receive(:validate_plugin_config).with(['bucket', 'access_key', 'secret_access_key'], 'http://boxgrinder.org/tutorials/boxgrinder-build-plugins/#S3_Delivery_Plugin')
|
315
|
+
@plugin.should_receive(:validate_plugin_config).with(["cert_file", "key_file", "account_number"], "http://boxgrinder.org/tutorials/boxgrinder-build-plugins/#S3_Delivery_Plugin")
|
316
|
+
|
317
|
+
lambda { @plugin.validate }.should raise_error(PluginValidationError)
|
318
|
+
|
264
319
|
end
|
320
|
+
|
265
321
|
end
|
266
322
|
|
267
323
|
describe ".bucket" do
|
268
324
|
it "should create the bucket" do
|
269
|
-
@
|
325
|
+
@config.plugins['s3'].merge!('region' => 'ap-southeast-1')
|
270
326
|
s3 = mock(Aws::S3)
|
271
327
|
Aws::S3.should_receive(:new).with("access_key", "secret_access_key", :connection_mode => :single, :logger => @log, :server=>"s3-ap-southeast-1.amazonaws.com").and_return(s3)
|
272
328
|
s3.should_receive(:bucket).with("bucket", true, "private", :location => "ap-southeast-1")
|
@@ -274,7 +330,8 @@ module BoxGrinder
|
|
274
330
|
end
|
275
331
|
|
276
332
|
it "should not create the bucket" do
|
277
|
-
@
|
333
|
+
@config.plugins['s3'].merge!('region' => 'ap-southeast-1')
|
334
|
+
|
278
335
|
s3 = mock(Aws::S3)
|
279
336
|
Aws::S3.should_receive(:new).with("access_key", "secret_access_key", :connection_mode => :single, :logger => @log, :server=>"s3-ap-southeast-1.amazonaws.com").and_return(s3)
|
280
337
|
s3.should_receive(:bucket).with("bucket", false, "private", :location => "ap-southeast-1")
|
@@ -290,7 +347,7 @@ module BoxGrinder
|
|
290
347
|
end
|
291
348
|
|
292
349
|
it "should upload image for us-west-1 region" do
|
293
|
-
@
|
350
|
+
@config.plugins['s3'].merge!('region' => 'us-west-1')
|
294
351
|
|
295
352
|
@plugin.should_receive(:bucket)
|
296
353
|
@exec_helper.should_receive(:execute).with("euca-upload-bundle -U http://s3-us-west-1.amazonaws.com -b bucket/ami/key -m build/path/s3-plugin/ami/appliance.ec2.manifest.xml -a access_key -s secret_access_key", :redacted=>["access_key", "secret_access_key"])
|
@@ -320,7 +377,7 @@ module BoxGrinder
|
|
320
377
|
@plugin.register_image("ami/manifest/key")
|
321
378
|
end
|
322
379
|
|
323
|
-
it "should report the region where the ami is
|
380
|
+
it "should report the region where the ami is registered" do
|
324
381
|
@plugin.instance_variable_get(:@plugin_config)['region'] = 'a-region'
|
325
382
|
@plugin.instance_variable_get(:@log).should_receive(:info).with(/a-region/)
|
326
383
|
|
@@ -34,7 +34,7 @@ module BoxGrinder
|
|
34
34
|
@appliance_config.stub!(:path).and_return(OpenCascade.new({:build => 'build/path'}))
|
35
35
|
@appliance_config.stub!(:name).and_return('full')
|
36
36
|
|
37
|
-
@plugin = CentOSPlugin.new.init(@config, @appliance_config,
|
37
|
+
@plugin = CentOSPlugin.new.init(@config, @appliance_config, {:class => BoxGrinder::CentOSPlugin, :type => :os, :name => :centos, :full_name => "CentOS", :versions => ["5"]}, :log => Logger.new('/dev/null'))
|
38
38
|
end
|
39
39
|
|
40
40
|
it "should use basearch instead of arch in repository URLs" do
|
@@ -39,25 +39,31 @@ module BoxGrinder
|
|
39
39
|
@appliance_config.stub!(:hardware).and_return(OpenCascade.new({:arch => 'x86_64'}))
|
40
40
|
@appliance_config.stub!(:is64bit?).and_return(true)
|
41
41
|
|
42
|
-
@plugin = FedoraPlugin.new.init(@config, @appliance_config,
|
42
|
+
@plugin = FedoraPlugin.new.init(@config, @appliance_config, {:class => BoxGrinder::FedoraPlugin, :type => :os, :name => :fedora, :full_name => "Fedora", :versions => ["11", "12", "13", "14", "rawhide"]}, :log => LogHelper.new(:level => :trace, :type => :stdout))
|
43
43
|
|
44
44
|
@config = @plugin.instance_variable_get(:@config)
|
45
45
|
@appliance_config = @plugin.instance_variable_get(:@appliance_config)
|
46
46
|
@exec_helper = @plugin.instance_variable_get(:@exec_helper)
|
47
47
|
@log = @plugin.instance_variable_get(:@log)
|
48
|
-
end
|
49
48
|
|
50
|
-
it "should normalize packages for 32bit for pae enabled system" do
|
51
|
-
packages = ['abc', 'def', 'kernel']
|
52
49
|
|
53
|
-
@
|
50
|
+
@plugin_config = @plugin.instance_variable_get(:@plugin_config).merge(
|
51
|
+
{
|
52
|
+
'access_key' => 'access_key',
|
53
|
+
'secret_access_key' => 'secret_access_key',
|
54
|
+
'bucket' => 'bucket',
|
55
|
+
'account_number' => '0000-0000-0000',
|
56
|
+
'cert_file' => '/path/to/cert/file',
|
57
|
+
'key_file' => '/path/to/key/file'
|
58
|
+
}
|
59
|
+
)
|
54
60
|
|
55
|
-
@plugin.
|
56
|
-
packages.should == ["abc", "def", "@core", "system-config-firewall-base", "dhclient", "kernel-PAE"]
|
61
|
+
@plugin.instance_variable_set(:@plugin_config, @plugin_config)
|
57
62
|
end
|
58
63
|
|
59
64
|
it "should normalize packages for 32bit for pae enabled system" do
|
60
|
-
@appliance_config.stub!(:os).and_return(OpenCascade.new(:name => 'fedora', :version => '13'
|
65
|
+
@appliance_config.stub!(:os).and_return(OpenCascade.new(:name => 'fedora', :version => '13'))
|
66
|
+
@plugin_config.merge!('PAE' => false)
|
61
67
|
|
62
68
|
packages = ['abc', 'def', 'kernel']
|
63
69
|
|
@@ -37,7 +37,7 @@ module BoxGrinder
|
|
37
37
|
@appliance_config.stub!(:release).and_return(0)
|
38
38
|
@appliance_config.stub!(:os).and_return(OpenCascade.new({:name => 'rhel', :version => '6'}))
|
39
39
|
|
40
|
-
@plugin = RHELPlugin.new.init(@config, @appliance_config,
|
40
|
+
@plugin = RHELPlugin.new.init(@config, @appliance_config, {:class => BoxGrinder::RHELPlugin, :type => :os, :name => :rhel, :full_name => "Red Hat Enterprise Linux", :versions => ['5', '6']}, :log => LogHelper.new(:level => :trace, :type => :stdout))
|
41
41
|
|
42
42
|
@config = @plugin.instance_variable_get(:@config)
|
43
43
|
@appliance_config = @plugin.instance_variable_get(:@appliance_config)
|
@@ -66,50 +66,6 @@ module BoxGrinder
|
|
66
66
|
]
|
67
67
|
)
|
68
68
|
|
69
|
-
@appliance_config.should_receive(:default_repos).and_return(true)
|
70
|
-
|
71
|
-
definition = @kickstart.build_definition
|
72
|
-
|
73
|
-
definition['repos'].size.should == 4
|
74
|
-
|
75
|
-
definition['repos'][0].should == "repo --name=fedora-11-base --cost=40 --mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-11&arch=i386"
|
76
|
-
definition['repos'][1].should == "repo --name=fedora-11-updates --cost=41 --mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-f11&arch=i386"
|
77
|
-
definition['repos'][2].should == "repo --name=cirras --cost=42 --baseurl=http://repo.boxgrinder.org/packages/fedora/11/RPMS/i686"
|
78
|
-
definition['repos'][3].should == "repo --name=abc --cost=43 --mirrorlist=http://abc.org/packages/fedora/11/RPMS/i686"
|
79
|
-
|
80
|
-
definition['appliance_config'].packages.size.should == 2
|
81
|
-
definition['appliance_config'].packages.should == ["gcc-c++", "wget"]
|
82
|
-
|
83
|
-
definition['appliance_config'].os.password.should == "boxgrinder"
|
84
|
-
definition['appliance_config'].hardware.partitions.size.should == 2
|
85
|
-
definition['appliance_config'].hardware.partitions['/']['size'].should == 2
|
86
|
-
definition['appliance_config'].hardware.partitions['/home']['size'].should == 3
|
87
|
-
end
|
88
|
-
|
89
|
-
it "should prepare valid definition without default repos" do
|
90
|
-
prepare_kickstart(KICKSTART_FEDORA_REPOS)
|
91
|
-
|
92
|
-
@appliance_config.stub!(:hardware).and_return(
|
93
|
-
OpenCascade.new({
|
94
|
-
:partitions =>
|
95
|
-
{
|
96
|
-
'/' => {'size' => 2},
|
97
|
-
'/home' => {'size' => 3},
|
98
|
-
},
|
99
|
-
:arch => 'i686',
|
100
|
-
:base_arch => 'i386'
|
101
|
-
})
|
102
|
-
)
|
103
|
-
|
104
|
-
@appliance_config.should_receive(:default_repos).and_return(false)
|
105
|
-
|
106
|
-
@appliance_config.should_receive(:repos).and_return(
|
107
|
-
[
|
108
|
-
{'name' => 'cirras', 'baseurl' => "http://repo.boxgrinder.org/packages/fedora/11/RPMS/i686"},
|
109
|
-
{'name' => 'abc', 'baseurl' => 'http://abc', 'mirrorlist' => "http://abc.org/packages/fedora/11/RPMS/i686"},
|
110
|
-
]
|
111
|
-
)
|
112
|
-
|
113
69
|
definition = @kickstart.build_definition
|
114
70
|
|
115
71
|
definition['repos'].size.should == 2
|