lib/bosh/stemcell/stemcell_packager.rb in bosh-stemcell-1.2889.0 vs lib/bosh/stemcell/stemcell_packager.rb in bosh-stemcell-1.2891.0
- old
+ new
@@ -1,15 +1,16 @@
module Bosh
module Stemcell
class StemcellPackager
- def initialize(definition, version, work_path, tarball_path, runner, collection)
- @definition = definition
- @version = version
- @stemcell_build_path = File.join(work_path, 'stemcell')
- @tarball_path = tarball_path
- @runner = runner
- @collection = collection
+ def initialize(options = {})
+ @definition = options.fetch(:definition)
+ @version = options.fetch(:version)
+ @stemcell_build_path = File.join(options.fetch(:work_path), 'stemcell')
+ @tarball_path = options.fetch(:tarball_path)
+ @disk_size = options.fetch(:disk_size)
+ @runner = options.fetch(:runner)
+ @collection = options.fetch(:collection)
end
def package(disk_format)
File.delete(stemcell_image_path) if File.exist?(stemcell_image_path)
@@ -19,11 +20,11 @@
create_tarball(disk_format)
end
private
- attr_reader :definition, :version, :stemcell_build_path, :tarball_path, :runner, :collection
+ attr_reader :definition, :version, :stemcell_build_path, :tarball_path, :disk_size, :runner, :collection
def write_manifest(disk_format)
manifest_filename = File.join(stemcell_build_path, "stemcell.MF")
File.open(manifest_filename, "w") do |f|
f.write(Psych.dump(manifest(disk_format)))
@@ -42,9 +43,10 @@
'cloud_properties' => {
'name' => stemcell_name,
'version' => version.to_s,
'infrastructure' => infrastructure.name,
'hypervisor' => infrastructure.hypervisor,
+ 'disk' => disk_size,
'disk_format' => disk_format,
'container_format' => 'bare',
'os_type' => 'linux',
'os_distro' => definition.operating_system.name,
'architecture' => 'x86_64',