bosh-stemcell 1.5.0.pre.1117 → 1.5.0.pre.1134
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/bosh/stemcell/archive.rb +7 -1
- data/lib/bosh/stemcell/infrastructure.rb +1 -1
- data/lib/bosh/stemcell/version.rb +1 -1
- data/spec/assets/fake-stemcell-aws.tgz +0 -0
- data/spec/bosh/stemcell/archive_spec.rb +37 -12
- data/spec/bosh/stemcell/builder_options_spec.rb +1 -0
- data/spec/bosh/stemcell/infrastructure_spec.rb +1 -1
- data/spec/stemcells/centos_spec.rb +6 -5
- data/spec/stemcells/ubuntu_spec.rb +1 -0
- metadata +4 -4
@@ -1,5 +1,5 @@
|
|
1
|
-
require 'rake/file_utils_ext'
|
2
1
|
require 'yaml'
|
2
|
+
require 'rake/file_utils_ext'
|
3
3
|
require 'bosh/stemcell/aws/region'
|
4
4
|
|
5
5
|
module Bosh::Stemcell
|
@@ -27,6 +27,12 @@ module Bosh::Stemcell
|
|
27
27
|
cloud_properties.fetch('version')
|
28
28
|
end
|
29
29
|
|
30
|
+
def sha1
|
31
|
+
sha1 = manifest.fetch('sha1')
|
32
|
+
raise 'sha1 must not be nil' unless sha1
|
33
|
+
sha1.to_s
|
34
|
+
end
|
35
|
+
|
30
36
|
def light?
|
31
37
|
infrastructure == 'aws' && ami_id
|
32
38
|
end
|
Binary file
|
@@ -3,31 +3,32 @@ require 'bosh/stemcell/archive'
|
|
3
3
|
|
4
4
|
module Bosh::Stemcell
|
5
5
|
describe Archive do
|
6
|
+
subject { described_class.new(stemcell_path) }
|
6
7
|
let(:stemcell_path) { spec_asset('fake-stemcell-aws.tgz') }
|
7
8
|
|
8
|
-
subject { Archive.new(stemcell_path) }
|
9
|
-
|
10
9
|
describe '#initialize' do
|
11
10
|
it 'errors if path does not exist' do
|
12
|
-
expect {
|
11
|
+
expect {
|
12
|
+
described_class.new('/not/found/stemcell.tgz')
|
13
|
+
}.to raise_error("Cannot find file `/not/found/stemcell.tgz'")
|
13
14
|
end
|
14
15
|
end
|
15
16
|
|
16
17
|
describe '#manifest' do
|
17
18
|
it 'has a manifest' do
|
18
|
-
expect(subject.manifest).to be_a
|
19
|
+
expect(subject.manifest).to be_a(Hash)
|
19
20
|
end
|
20
21
|
end
|
21
22
|
|
22
23
|
describe '#name' do
|
23
24
|
it 'has a name' do
|
24
|
-
expect(subject.name).to eq
|
25
|
+
expect(subject.name).to eq('fake-stemcell')
|
25
26
|
end
|
26
27
|
end
|
27
28
|
|
28
29
|
describe '#infrastructure' do
|
29
30
|
it 'has an infrastructure' do
|
30
|
-
expect(subject.infrastructure).to eq
|
31
|
+
expect(subject.infrastructure).to eq('aws')
|
31
32
|
end
|
32
33
|
end
|
33
34
|
|
@@ -43,6 +44,32 @@ module Bosh::Stemcell
|
|
43
44
|
end
|
44
45
|
end
|
45
46
|
|
47
|
+
describe '#sha1' do
|
48
|
+
context 'when sha1 is just a string (from fake-stemcell-aws.tgz)' do
|
49
|
+
it 'returns a sha1 as a string' do
|
50
|
+
expect(subject.sha1).to eq('fake-stemcell-sha1')
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
context 'when sha1 happens to be a number' do
|
55
|
+
before { subject.manifest['sha1'] = 123 }
|
56
|
+
|
57
|
+
it 'returns a sha1 as a string' do
|
58
|
+
expect(subject.sha1).to eq('123')
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
context 'when the sha1 is nil' do
|
63
|
+
before { subject.manifest['sha1'] = nil }
|
64
|
+
|
65
|
+
it 'raises an error' do
|
66
|
+
expect {
|
67
|
+
subject.sha1
|
68
|
+
}.to raise_error(RuntimeError, 'sha1 must not be nil')
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
46
73
|
describe '#light?' do
|
47
74
|
context 'when infrastructure is "aws"' do
|
48
75
|
context 'when there is not an "ami" key in the "cloud_properties" section of the manifest' do
|
@@ -51,14 +78,12 @@ module Bosh::Stemcell
|
|
51
78
|
|
52
79
|
context 'when there is an "ami" key in the "cloud_properties" section of the manifest' do
|
53
80
|
let(:stemcell_path) { spec_asset('light-fake-stemcell-aws.tgz') }
|
54
|
-
|
55
81
|
it { should be_light }
|
56
82
|
end
|
57
83
|
end
|
58
84
|
|
59
85
|
context 'when infrastructure is anything but "aws"' do
|
60
86
|
let(:stemcell_path) { spec_asset('fake-stemcell-vsphere.tgz') }
|
61
|
-
|
62
87
|
it { should_not be_light }
|
63
88
|
end
|
64
89
|
end
|
@@ -71,26 +96,26 @@ module Bosh::Stemcell
|
|
71
96
|
|
72
97
|
context 'when there is an "ami" key in the "cloud_properties" section of the manifest' do
|
73
98
|
let(:stemcell_path) { spec_asset('light-fake-stemcell-aws.tgz') }
|
74
|
-
|
75
99
|
its(:ami_id) { should eq('ami-FAKE_AMI_KEY') }
|
76
100
|
end
|
77
101
|
end
|
78
102
|
|
79
103
|
context 'when infrastructure is anything but "aws"' do
|
80
104
|
let(:stemcell_path) { spec_asset('fake-stemcell-vsphere.tgz') }
|
81
|
-
|
82
105
|
its(:ami_id) { should be_nil }
|
83
106
|
end
|
84
107
|
end
|
85
108
|
|
86
109
|
describe '#extract' do
|
87
110
|
it 'extracts stemcell' do
|
88
|
-
Rake::FileUtilsExt.should_receive(:sh).with(
|
111
|
+
Rake::FileUtilsExt.should_receive(:sh).with(
|
112
|
+
/tar xzf .*#{stemcell_path} --directory/)
|
89
113
|
subject.extract {}
|
90
114
|
end
|
91
115
|
|
92
116
|
it 'extracts stemcell and excludes files' do
|
93
|
-
Rake::FileUtilsExt.should_receive(:sh).with(
|
117
|
+
Rake::FileUtilsExt.should_receive(:sh).with(
|
118
|
+
/tar xzf .*#{stemcell_path} --directory .* --exclude=image/)
|
94
119
|
subject.extract(exclude: 'image') {}
|
95
120
|
end
|
96
121
|
end
|
@@ -60,7 +60,7 @@ module Bosh::Stemcell
|
|
60
60
|
describe Infrastructure::Vsphere do
|
61
61
|
its(:name) { should eq('vsphere') }
|
62
62
|
its(:hypervisor) { should eq('esxi') }
|
63
|
-
its(:default_disk_size) { should eq(
|
63
|
+
its(:default_disk_size) { should eq(3072) }
|
64
64
|
it { should_not be_light }
|
65
65
|
end
|
66
66
|
end
|
@@ -92,8 +92,8 @@ describe 'CentOs Stemcell' do
|
|
92
92
|
|
93
93
|
context 'installed by system_kernel' do
|
94
94
|
{
|
95
|
-
'kernel' => '2.6.32-358.
|
96
|
-
'kernel-headers' => '2.6.32-358.
|
95
|
+
'kernel' => '2.6.32-358.23.2.el6.x86_64',
|
96
|
+
'kernel-headers' => '2.6.32-358.23.2.el6.x86_64',
|
97
97
|
}.each do |pkg, version|
|
98
98
|
describe package(pkg) do
|
99
99
|
it { should be_installed.with_version(version) }
|
@@ -112,10 +112,11 @@ describe 'CentOs Stemcell' do
|
|
112
112
|
it { should be_file }
|
113
113
|
it { should contain 'default=0' }
|
114
114
|
it { should contain 'timeout=1' }
|
115
|
-
it { should contain 'title CentOS release 6.4 (Final) (2.6.32-358.
|
115
|
+
it { should contain 'title CentOS release 6.4 (Final) (2.6.32-358.23.2.el6.x86_64)' }
|
116
116
|
it { should contain ' root (hd0,0)' }
|
117
|
-
it { should contain ' kernel /boot/vmlinuz-2.6.32-358.
|
118
|
-
it { should contain '
|
117
|
+
it { should contain ' kernel /boot/vmlinuz-2.6.32-358.23.2.el6.x86_64 ro root=UUID=' }
|
118
|
+
it { should contain ' selinux=0' }
|
119
|
+
it { should contain ' initrd /boot/initramfs-2.6.32-358.23.2.el6.x86_64.img' }
|
119
120
|
end
|
120
121
|
|
121
122
|
describe file('/boot/grub/menu.lst') do
|
@@ -126,6 +126,7 @@ describe 'Ubuntu Stemcell' do
|
|
126
126
|
it { should contain 'title Ubuntu 10.04.4 LTS (3.0.0-32-virtual)' }
|
127
127
|
it { should contain ' root (hd0,0)' }
|
128
128
|
it { should contain ' kernel /boot/vmlinuz-3.0.0-32-virtual ro root=UUID=' }
|
129
|
+
it { should contain ' selinux=0' }
|
129
130
|
it { should contain ' initrd /boot/initrd.img-3.0.0-32-virtual' }
|
130
131
|
end
|
131
132
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bosh-stemcell
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.0.pre.
|
4
|
+
version: 1.5.0.pre.1134
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-10-
|
12
|
+
date: 2013-10-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bosh_aws_cpi
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 1.5.0.pre.
|
21
|
+
version: 1.5.0.pre.1134
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 1.5.0.pre.
|
29
|
+
version: 1.5.0.pre.1134
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: rake
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|