stemcell_builder 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +20 -0
- data/.rvmrc +1 -0
- data/.travis.yml +1 -0
- data/Gemfile +14 -0
- data/LICENSE.txt +22 -0
- data/README.md +123 -0
- data/Rakefile +10 -0
- data/assets/box.ovf.erb +81 -0
- data/assets/stemcell_mf_schema.yaml +30 -0
- data/bin/stemcell_builder +138 -0
- data/lib/stemcell.rb +3 -0
- data/lib/stemcell/builder.rb +445 -0
- data/lib/stemcell/builders/centos.rb +33 -0
- data/lib/stemcell/builders/redhat.rb +34 -0
- data/lib/stemcell/builders/ubuntu.rb +36 -0
- data/lib/stemcell/const.rb +12 -0
- data/lib/stemcell/version.rb +10 -0
- data/spec/spec_helper.rb +10 -0
- data/spec/stemcell_builder/builder_spec.rb +186 -0
- data/spec/stemcell_builder/centos_spec.rb +39 -0
- data/spec/stemcell_builder/redhat_spec.rb +53 -0
- data/spec/stemcell_builder/ubuntu_spec.rb +38 -0
- data/stemcell_builder.gemspec +42 -0
- data/templates/centos/_60-bosh-sysctl.conf +5 -0
- data/templates/centos/_empty_state.yml +9 -0
- data/templates/centos/_monitrc +8 -0
- data/templates/centos/_ntpdate +10 -0
- data/templates/centos/_runonce +46 -0
- data/templates/centos/_sysstat +18 -0
- data/templates/centos/_variables.sh.erb +31 -0
- data/templates/centos/base.sh +23 -0
- data/templates/centos/bosh_agent.sh +39 -0
- data/templates/centos/cleanup.sh +28 -0
- data/templates/centos/definition.rb.erb +37 -0
- data/templates/centos/harden.sh +8 -0
- data/templates/centos/ks.cfg +43 -0
- data/templates/centos/micro.sh +57 -0
- data/templates/centos/monit.sh +21 -0
- data/templates/centos/postinstall.sh +27 -0
- data/templates/centos/ruby.sh +42 -0
- data/templates/centos/setup-bosh.sh +20 -0
- data/templates/centos/sudo.sh +13 -0
- data/templates/centos/timestamp.sh +15 -0
- data/templates/centos/vmware-tools.sh +17 -0
- data/templates/centos/zerodisk.sh +9 -0
- data/templates/noop/erbtest.txt.erb +1 -0
- data/templates/noop/test.txt +1 -0
- data/templates/redhat/_60-bosh-sysctl.conf +5 -0
- data/templates/redhat/_empty_state.yml +9 -0
- data/templates/redhat/_monitrc +8 -0
- data/templates/redhat/_ntpdate +10 -0
- data/templates/redhat/_runonce +46 -0
- data/templates/redhat/_sysstat +18 -0
- data/templates/redhat/_variables.sh.erb +31 -0
- data/templates/redhat/base.sh +41 -0
- data/templates/redhat/bosh_agent.sh +37 -0
- data/templates/redhat/cleanup.sh +30 -0
- data/templates/redhat/definition.rb.erb +38 -0
- data/templates/redhat/harden.sh +8 -0
- data/templates/redhat/ks.cfg +86 -0
- data/templates/redhat/micro.sh +57 -0
- data/templates/redhat/monit.sh +21 -0
- data/templates/redhat/postinstall.sh +27 -0
- data/templates/redhat/rhnreg.sh.erb +15 -0
- data/templates/redhat/ruby.sh +42 -0
- data/templates/redhat/setup-bosh.sh +20 -0
- data/templates/redhat/sudo.sh +13 -0
- data/templates/redhat/timestamp.sh +15 -0
- data/templates/redhat/vmware-tools.sh +17 -0
- data/templates/redhat/zerodisk.sh +9 -0
- data/templates/ubuntu/_60-bosh-sysctl.conf +5 -0
- data/templates/ubuntu/_empty_state.yml +9 -0
- data/templates/ubuntu/_helpers.sh +40 -0
- data/templates/ubuntu/_monitrc +8 -0
- data/templates/ubuntu/_ntpdate +10 -0
- data/templates/ubuntu/_runonce +46 -0
- data/templates/ubuntu/_sysstat +18 -0
- data/templates/ubuntu/_variables.sh.erb +30 -0
- data/templates/ubuntu/apt-upgrade.sh +19 -0
- data/templates/ubuntu/base-stemcell.sh +95 -0
- data/templates/ubuntu/bosh_agent.sh +39 -0
- data/templates/ubuntu/definition.rb.erb +63 -0
- data/templates/ubuntu/harden.sh +9 -0
- data/templates/ubuntu/micro.sh +57 -0
- data/templates/ubuntu/monit.sh +22 -0
- data/templates/ubuntu/network-cleanup.sh +17 -0
- data/templates/ubuntu/postinstall.sh +45 -0
- data/templates/ubuntu/preseed.cfg +87 -0
- data/templates/ubuntu/ruby.sh +54 -0
- data/templates/ubuntu/setup-bosh.sh +14 -0
- data/templates/ubuntu/sudo.sh +14 -0
- data/templates/ubuntu/timestamp.sh +13 -0
- data/templates/ubuntu/vmware-tools.sh +22 -0
- data/templates/ubuntu/zero-disk.sh +10 -0
- metadata +375 -0
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'stemcell/builders/centos'
|
2
|
+
|
3
|
+
module Bosh::Agent::StemCell
|
4
|
+
|
5
|
+
class RedhatBuilder < CentosBuilder
|
6
|
+
|
7
|
+
def type
|
8
|
+
"redhat"
|
9
|
+
end
|
10
|
+
|
11
|
+
def initialize(opts)
|
12
|
+
@rhn_user ||= opts[:rhn_user]
|
13
|
+
@rhn_pass ||= opts[:rhn_pass]
|
14
|
+
super(opts)
|
15
|
+
end
|
16
|
+
|
17
|
+
def sanity_check
|
18
|
+
super()
|
19
|
+
unless @rhn_user
|
20
|
+
@logger.warn "Redhat Network Username is not specified"
|
21
|
+
end
|
22
|
+
unless @rhn_pass
|
23
|
+
@logger.warn "Redhat Network Password is not specified"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def init_default_iso
|
28
|
+
@iso = "http://rhnproxy1.uvm.edu/pub/redhat/rhel6-x86_64/isos/rhel-server-6.3-x86_64-dvd.iso"
|
29
|
+
@iso_md5 = "d717af33dd258945e6304f9955487017"
|
30
|
+
@iso_filename = "rhel-server-6.3-x86_64-dvd.iso"
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'stemcell/builder'
|
2
|
+
|
3
|
+
module Bosh::Agent::StemCell
|
4
|
+
|
5
|
+
# This is concrete Stemcell builder for creating a Ubuntu stemcell
|
6
|
+
# It creates a Ubuntu 11.04. The options passed are merged with
|
7
|
+
# {
|
8
|
+
# :type => 'ubuntu',
|
9
|
+
# :iso => 'http://releases.ubuntu.com/11.04/ubuntu-11.04-server-amd64.iso',
|
10
|
+
# :iso_md5 => '355ca2417522cb4a77e0295bf45c5cd5',
|
11
|
+
# :iso_filename => 'ubuntu-11.04-server-amd64.iso'
|
12
|
+
# }
|
13
|
+
class UbuntuBuilder < BaseBuilder
|
14
|
+
|
15
|
+
def type
|
16
|
+
"ubuntu"
|
17
|
+
end
|
18
|
+
|
19
|
+
def init_default_iso
|
20
|
+
@iso = "http://releases.ubuntu.com/11.04/ubuntu-11.04-server-amd64.iso"
|
21
|
+
@iso_md5 = "355ca2417522cb4a77e0295bf45c5cd5"
|
22
|
+
@iso_filename = "ubuntu-11.04-server-amd64.iso"
|
23
|
+
end
|
24
|
+
|
25
|
+
def pre_shutdown_hook
|
26
|
+
super()
|
27
|
+
download_file("/var/vcap/bosh/stemcell_dpkg_l.out")
|
28
|
+
end
|
29
|
+
|
30
|
+
def stemcell_files
|
31
|
+
File.join(@prefix, "stemcell_dpkg_l.out")
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,186 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'yaml'
|
3
|
+
|
4
|
+
describe Bosh::Agent::StemCell::BaseBuilder do
|
5
|
+
|
6
|
+
include Bosh::Agent::StemCell
|
7
|
+
|
8
|
+
class NoOpBuilder < Bosh::Agent::StemCell::BaseBuilder
|
9
|
+
|
10
|
+
attr_reader :build_vm_run, :package_stemcell_run, :setup_run, :cleanup_run
|
11
|
+
|
12
|
+
def type
|
13
|
+
"noop"
|
14
|
+
end
|
15
|
+
|
16
|
+
def initialize(opts)
|
17
|
+
@counter = 0
|
18
|
+
super(opts)
|
19
|
+
end
|
20
|
+
|
21
|
+
def build_vm
|
22
|
+
@logger.info "Build VM invoked"
|
23
|
+
@counter += 1
|
24
|
+
@build_vm_run = @counter
|
25
|
+
end
|
26
|
+
|
27
|
+
def package_stemcell
|
28
|
+
@logger.info "VM packaged into a stemcell"
|
29
|
+
@counter += 1
|
30
|
+
@package_stemcell_run = @counter
|
31
|
+
end
|
32
|
+
|
33
|
+
def setup
|
34
|
+
@logger.info "Setting up stemcell creation process."
|
35
|
+
@counter += 1
|
36
|
+
@setup_run = @counter
|
37
|
+
end
|
38
|
+
|
39
|
+
def cleanup
|
40
|
+
@logger.info "Perform cleanup"
|
41
|
+
@counter += 1
|
42
|
+
@cleanup_run = @counter
|
43
|
+
end
|
44
|
+
|
45
|
+
def init_default_iso
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
class TestBuilder < Bosh::Agent::StemCell::BaseBuilder
|
51
|
+
def type
|
52
|
+
"noop"
|
53
|
+
end
|
54
|
+
def init_default_iso
|
55
|
+
# Do nothing
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
before(:each) do
|
60
|
+
@prefix_dir = Dir.mktmpdir
|
61
|
+
@agent_file = File.join(@prefix_dir, "bosh_agent-#{Bosh::Agent::VERSION}.gem")
|
62
|
+
FileUtils.touch @agent_file
|
63
|
+
@stemcell = TestBuilder.new({:prefix => @prefix_dir, :agent_src_path => @agent_file, :nogui => true, :log_level=>'WARN'})
|
64
|
+
end
|
65
|
+
|
66
|
+
after(:each) do
|
67
|
+
target = File.expand_path(@stemcell.target)
|
68
|
+
if File.exists?(target)
|
69
|
+
FileUtils.rm_f target
|
70
|
+
FileUtils.rm_f "#{target}.bak"
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
|
75
|
+
it "Should initialize all default ISOs parameters properly" do
|
76
|
+
@stemcell.iso.should be_nil
|
77
|
+
@stemcell.iso_filename.should be_nil
|
78
|
+
@stemcell.iso_md5.should be_nil
|
79
|
+
end
|
80
|
+
|
81
|
+
it "Should initialize all override ISOs properly" do
|
82
|
+
@stemcell = TestBuilder.new({:prefix => @prefix_dir, :agent_src_path => @agent_file, :iso => "http://example.com/example.iso", :iso_md5 => "example-md5", :iso_filename => "example.iso", :log_level=>'WARN'})
|
83
|
+
@stemcell.iso.should eq "http://example.com/example.iso"
|
84
|
+
@stemcell.iso_md5.should eq "example-md5"
|
85
|
+
@stemcell.iso_filename.should eq "example.iso"
|
86
|
+
end
|
87
|
+
|
88
|
+
it "Initializes the stemcell manifest with defaults" do
|
89
|
+
defaults = {
|
90
|
+
"name" => 'bosh-stemcell',
|
91
|
+
"version" => Bosh::Agent::VERSION,
|
92
|
+
"bosh_protocol" => Bosh::Agent::BOSH_PROTOCOL,
|
93
|
+
"sha1" => nil,
|
94
|
+
"cloud_properties" => {
|
95
|
+
"root_device_name" => Bosh::Agent::StemCell::DEFAULT_DEVICE_NAME,
|
96
|
+
"infrastructure" => 'vsphere',
|
97
|
+
"architecture" => 'x86_64'
|
98
|
+
}
|
99
|
+
}
|
100
|
+
|
101
|
+
@stemcell.manifest.should eq(defaults)
|
102
|
+
|
103
|
+
end
|
104
|
+
|
105
|
+
it "Initializes the options with defaults" do
|
106
|
+
|
107
|
+
@stemcell.name.should eq "bosh-stemcell"
|
108
|
+
@stemcell.infrastructure.should eq "vsphere"
|
109
|
+
|
110
|
+
end
|
111
|
+
|
112
|
+
it "Initializes the options with defaults and deep_merges the provided args" do
|
113
|
+
override_stemcell = TestBuilder.new({:prefix => @prefix_dir, :agent_src_path => @agent_file, :log_level=>'WARN'})
|
114
|
+
override_stemcell.name.should eq "bosh-stemcell"
|
115
|
+
override_stemcell.type.should eq "noop"
|
116
|
+
end
|
117
|
+
|
118
|
+
it "Should return an initialized stemcell builder" do
|
119
|
+
expect { Dir.exists? @stemcell.prefix }.to be_true
|
120
|
+
expect { Dir.exists?("/var/tmp/bosh/agent-#{@stemcell.version}")|| Dir.exists?(Pathname.new(@stemcell.target_file).dirname) }.to be_true
|
121
|
+
end
|
122
|
+
|
123
|
+
it "Build VM works properly" do
|
124
|
+
Kernel.should_receive(:system).with("veewee vbox build '#{@stemcell.vm_name}' --force --auto --nogui").and_return(true)
|
125
|
+
Kernel.should_receive(:system).with("vagrant basebox export '#{@stemcell.vm_name}' --force").and_return(true)
|
126
|
+
|
127
|
+
@stemcell.build_vm
|
128
|
+
end
|
129
|
+
|
130
|
+
it "Should have a properly initialized work directory" do
|
131
|
+
expect { Dir.exists @stemcell.prefix }.to be_true
|
132
|
+
expect { Dir.exists @stemcell.prefix }.to be_true
|
133
|
+
end
|
134
|
+
|
135
|
+
it "Compiles all the erb files as a part of the setup" do
|
136
|
+
Dir.chdir(@prefix_dir) do
|
137
|
+
@stemcell.setup
|
138
|
+
filename = File.join(@prefix_dir, "definitions", @stemcell.vm_name, "erbtest.txt")
|
139
|
+
regular_filename = File.join(@prefix_dir, "definitions", @stemcell.vm_name, "test.txt")
|
140
|
+
File.exists?(filename).should eq true
|
141
|
+
File.exists?(regular_filename).should eq true
|
142
|
+
File.read(File.join(@prefix_dir, "definitions", @stemcell.vm_name, "erbtest.txt")).should eq @stemcell.name
|
143
|
+
File.read(File.join(@prefix_dir, "definitions", @stemcell.vm_name, "test.txt")).should eq "## This is a test ##"
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
it "Should invoke the methods in the correct order (setup -> build_vm -> package_vm -> finalize)" do
|
148
|
+
|
149
|
+
@stemcell = NoOpBuilder.new({:prefix => @prefix_dir, :agent_src_path => @agent_file, :log_level=>'WARN'})
|
150
|
+
|
151
|
+
@stemcell.run # all steps completed properly
|
152
|
+
|
153
|
+
@stemcell.setup_run.should eq 1
|
154
|
+
@stemcell.build_vm_run.should eq 2
|
155
|
+
@stemcell.package_stemcell_run.should eq 3
|
156
|
+
@stemcell.cleanup_run.should eq 4
|
157
|
+
end
|
158
|
+
|
159
|
+
it "Packages the stemcell contents correctly" do
|
160
|
+
Dir.chdir(@prefix_dir) do
|
161
|
+
# Create the box file
|
162
|
+
FileUtils.touch "image-disk1.vmdk"
|
163
|
+
FileUtils.touch "image.ovf"
|
164
|
+
FileUtils.touch "Vagrantfile" # Unused
|
165
|
+
system "tar -zcf #{File.join(@prefix_dir, @stemcell.vm_name)}.box image-disk1.vmdk image.ovf Vagrantfile"
|
166
|
+
end
|
167
|
+
|
168
|
+
@stemcell.package_stemcell()
|
169
|
+
target = File.expand_path(@stemcell.target)
|
170
|
+
|
171
|
+
File.exists?(target).should eq true # target is created
|
172
|
+
|
173
|
+
Dir.chdir(Dir.mktmpdir) {
|
174
|
+
system "tar -xzf #{target}"
|
175
|
+
YAML.load_file("stemcell.MF").should eq @stemcell.manifest
|
176
|
+
File.exists?("image").should be_true
|
177
|
+
system "tar -xzf image"
|
178
|
+
ovf_file = File.read("image.ovf")
|
179
|
+
ovf_file.should include "<vssd:VirtualSystemType>vmx-07</vssd:VirtualSystemType>"
|
180
|
+
ovf_file.should include "<File ovf:href=\"image-disk1.vmdk\" ovf:id=\"file1\"/>"
|
181
|
+
ovf_file.should include "<VirtualSystem ovf:id=\"#{@stemcell.vm_name}\">"
|
182
|
+
ovf_file.should include "<vssd:VirtualSystemIdentifier>#{@stemcell.vm_name}</vssd:VirtualSystemIdentifier>"
|
183
|
+
}
|
184
|
+
end
|
185
|
+
|
186
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Bosh::Agent::StemCell::CentosBuilder do
|
4
|
+
|
5
|
+
|
6
|
+
before(:each) do
|
7
|
+
@agent_file = File.join("bosh-agent.gem")
|
8
|
+
FileUtils.touch @agent_file
|
9
|
+
@stemcell = Bosh::Agent::StemCell::CentosBuilder.new({:agent_src_path => @agent_file, :log_level=>'WARN'})
|
10
|
+
end
|
11
|
+
|
12
|
+
after(:each) do
|
13
|
+
FileUtils.rm_f @agent_file
|
14
|
+
end
|
15
|
+
|
16
|
+
it "Should initialize the manifest should properly" do
|
17
|
+
@stemcell.manifest.values_at("cloud_properties").should_not be_nil
|
18
|
+
@stemcell.manifest["cloud_properties"]["root_device_name"].should eq '/dev/sda1'
|
19
|
+
end
|
20
|
+
|
21
|
+
it "Should initialize default iso options properly" do
|
22
|
+
@stemcell.iso.should eq "http://www.mirrorservice.org/sites/mirror.centos.org/6.3/isos/x86_64/CentOS-6.3-x86_64-minimal.iso"
|
23
|
+
@stemcell.iso_md5.should eq "087713752fa88c03a5e8471c661ad1a2"
|
24
|
+
@stemcell.iso_filename.should eq "CentOS-6.3-x86_64-minimal.iso"
|
25
|
+
end
|
26
|
+
|
27
|
+
it "Should initialize override options properly" do
|
28
|
+
@stemcell = Bosh::Agent::StemCell::CentosBuilder.new({:agent_src_path => @agent_file, :iso => "http://example.com/centos.iso", :iso_md5 => "123", :iso_filename => "centos.iso", :log_level=>'WARN'})
|
29
|
+
@stemcell.type.should eq "centos"
|
30
|
+
@stemcell.iso.should eq "http://example.com/centos.iso"
|
31
|
+
@stemcell.iso_md5.should eq "123"
|
32
|
+
@stemcell.iso_filename.should eq "centos.iso"
|
33
|
+
end
|
34
|
+
|
35
|
+
it "Should initialize type properly" do
|
36
|
+
@stemcell.type.should eq "centos"
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Bosh::Agent::StemCell::RedhatBuilder do
|
4
|
+
|
5
|
+
|
6
|
+
before(:each) do
|
7
|
+
@agent_file = File.join("bosh-agent.gem")
|
8
|
+
FileUtils.touch @agent_file
|
9
|
+
@stemcell = Bosh::Agent::StemCell::RedhatBuilder.new({:agent_src_path => @agent_file, :log_level=>'ERROR'})
|
10
|
+
end
|
11
|
+
|
12
|
+
after(:each) do
|
13
|
+
FileUtils.rm_f @agent_file
|
14
|
+
end
|
15
|
+
|
16
|
+
it "Warns about RHN user/password if missing" do
|
17
|
+
logger = Logger.new(STDOUT)
|
18
|
+
logger.should_receive(:warn).with("Redhat Network Username is not specified")
|
19
|
+
logger.should_receive(:warn).with("Redhat Network Password is not specified")
|
20
|
+
@stemcell = Bosh::Agent::StemCell::RedhatBuilder.new({:agent_src_path => @agent_file, :logger => logger, :log_level=>'ERROR'})
|
21
|
+
end
|
22
|
+
|
23
|
+
it "Doesn't warn user if RHN user/password is specified" do
|
24
|
+
Logger.any_instance.should_not_receive(:warn).with("Redhat Network Username is not specified")
|
25
|
+
Logger.any_instance.should_not_receive(:warn).with("Redhat Network Password is not specified")
|
26
|
+
@stemcell = Bosh::Agent::StemCell::RedhatBuilder.new({:agent_src_path => @agent_file, :rhn_user => 'rhn_username', :rhn_pass => 'rhn_password', :log_level=>'ERROR'})
|
27
|
+
end
|
28
|
+
|
29
|
+
it "Should initialize type properly" do
|
30
|
+
@stemcell.type.should eq "redhat"
|
31
|
+
end
|
32
|
+
|
33
|
+
it "Should initialize the manifest should properly" do
|
34
|
+
@stemcell.manifest.values_at("cloud_properties").should_not be_nil
|
35
|
+
@stemcell.manifest["cloud_properties"]["root_device_name"].should eq '/dev/sda1'
|
36
|
+
end
|
37
|
+
|
38
|
+
it "Should initialize default options properly" do
|
39
|
+
@stemcell.type.should eq "redhat"
|
40
|
+
@stemcell.iso.should eq "http://rhnproxy1.uvm.edu/pub/redhat/rhel6-x86_64/isos/rhel-server-6.3-x86_64-dvd.iso"
|
41
|
+
@stemcell.iso_md5.should eq "d717af33dd258945e6304f9955487017"
|
42
|
+
@stemcell.iso_filename.should eq "rhel-server-6.3-x86_64-dvd.iso"
|
43
|
+
end
|
44
|
+
|
45
|
+
it "Should initialize override options properly" do
|
46
|
+
@stemcell = Bosh::Agent::StemCell::RedhatBuilder.new({:agent_src_path => @agent_file, :iso => "http://example.com/rhel.iso", :iso_md5 => "123", :iso_filename => "rhel.iso", :log_level=>'ERROR'})
|
47
|
+
@stemcell.type.should eq "redhat"
|
48
|
+
@stemcell.iso.should eq "http://example.com/rhel.iso"
|
49
|
+
@stemcell.iso_md5.should eq "123"
|
50
|
+
@stemcell.iso_filename.should eq "rhel.iso"
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Bosh::Agent::StemCell::UbuntuBuilder do
|
4
|
+
|
5
|
+
|
6
|
+
before(:each) do
|
7
|
+
@agent_file = File.join("bosh-agent.gem")
|
8
|
+
FileUtils.touch @agent_file
|
9
|
+
@stemcell = Bosh::Agent::StemCell::UbuntuBuilder.new({:agent_src_path => @agent_file, :log_level=>'ERROR'})
|
10
|
+
end
|
11
|
+
|
12
|
+
after(:each) do
|
13
|
+
FileUtils.rm_f @agent_file
|
14
|
+
end
|
15
|
+
|
16
|
+
it "Should initialize type properly" do
|
17
|
+
@stemcell.type.should eq "ubuntu"
|
18
|
+
end
|
19
|
+
|
20
|
+
it "Should initialize the manifest should properly" do
|
21
|
+
@stemcell.manifest.values_at("cloud_properties").should_not be_nil
|
22
|
+
@stemcell.manifest["cloud_properties"]["root_device_name"].should eq '/dev/sda1'
|
23
|
+
end
|
24
|
+
|
25
|
+
it "Should initialize all options properly" do
|
26
|
+
@stemcell.iso.should eq "http://releases.ubuntu.com/11.04/ubuntu-11.04-server-amd64.iso"
|
27
|
+
@stemcell.iso_md5.should eq "355ca2417522cb4a77e0295bf45c5cd5"
|
28
|
+
@stemcell.iso_filename.should eq "ubuntu-11.04-server-amd64.iso"
|
29
|
+
end
|
30
|
+
|
31
|
+
it "Should initialize override options properly" do
|
32
|
+
@stemcell = Bosh::Agent::StemCell::UbuntuBuilder.new({:agent_src_path => @agent_file, :iso => "http://example.com/ubuntu.iso", :iso_md5 => "123", :iso_filename => "ubuntu.iso", :log_level=>'ERROR'})
|
33
|
+
@stemcell.iso.should eq "http://example.com/ubuntu.iso"
|
34
|
+
@stemcell.iso_md5.should eq "123"
|
35
|
+
@stemcell.iso_filename.should eq "ubuntu.iso"
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.unshift(File.join(File.dirname(__FILE__), 'lib'))
|
3
|
+
|
4
|
+
require "stemcell/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "stemcell_builder"
|
8
|
+
gem.version = Bosh::Agent::StemCell::VERSION
|
9
|
+
gem.authors = ["Ankur Chauhan"]
|
10
|
+
gem.email = ["ankur@malloc64.com"]
|
11
|
+
gem.description = "Stemcell builder for Bosh"
|
12
|
+
gem.summary = "A commandline utility for creating stemcells for Bosh [ http://www.github.com/cloudfoundry/bosh ]"
|
13
|
+
gem.homepage = "http://www.github.com/ankurcha/stemcell"
|
14
|
+
gem.license = "MIT"
|
15
|
+
|
16
|
+
gem.files = `git ls-files`.split($/)
|
17
|
+
gem.bindir = "bin"
|
18
|
+
gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
|
19
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
20
|
+
gem.require_paths = ["lib"]
|
21
|
+
|
22
|
+
gem.platform = Gem::Platform::RUBY
|
23
|
+
gem.required_rubygems_version = ">= 1.3.6"
|
24
|
+
gem.rubyforge_project = "stemcell_builder"
|
25
|
+
|
26
|
+
# Dependencies
|
27
|
+
gem.add_dependency "net-scp", "~> 1.0.4"
|
28
|
+
gem.add_dependency "net-ssh", "~> 2.2.0"
|
29
|
+
gem.add_dependency "thor"
|
30
|
+
gem.add_dependency "deep_merge"
|
31
|
+
gem.add_dependency "logger-colors"
|
32
|
+
gem.add_dependency "kwalify"
|
33
|
+
gem.add_dependency "retryable"
|
34
|
+
gem.add_dependency "veewee", "0.3.3"
|
35
|
+
gem.add_dependency "fog", "1.9.0"
|
36
|
+
gem.add_dependency "vagrant", "~> 1.0.7"
|
37
|
+
gem.add_dependency "thor"
|
38
|
+
|
39
|
+
gem.add_development_dependency "bundler"
|
40
|
+
gem.add_development_dependency "rspec"
|
41
|
+
gem.add_development_dependency "rubygems-tasks"
|
42
|
+
end
|