lib/bosh/stemcell/builder_options.rb in bosh-stemcell-1.1798.0 vs lib/bosh/stemcell/builder_options.rb in bosh-stemcell-1.1836.0

- old
+ new

@@ -1,25 +1,27 @@ require 'rbconfig' require 'bosh_agent/version' require 'bosh/stemcell/archive_filename' +require 'forwardable' + module Bosh::Stemcell class BuilderOptions - def initialize(env, options) + extend Forwardable + + def initialize(env, definition, version, tarball, disk_size = nil) @environment = env - @infrastructure = options.fetch(:infrastructure) - @operating_system = options.fetch(:operating_system) - @agent_name = options.fetch(:agent_name) + @definition = definition - @stemcell_version = options.fetch(:stemcell_version) - @image_create_disk_size = options.fetch(:disk_size, infrastructure.default_disk_size) - @bosh_micro_release_tgz_path = options.fetch(:tarball) + @stemcell_version = version + @image_create_disk_size = disk_size || infrastructure.default_disk_size + @bosh_micro_release_tgz_path = tarball end def default stemcell_name = "bosh-#{infrastructure.name}-#{infrastructure.hypervisor}-#{operating_system.name}" - stemcell_name += "-#{agent_name}_agent" unless agent_name == 'ruby' + stemcell_name += "-#{agent.name}_agent" unless agent.name == 'ruby' { 'stemcell_name' => stemcell_name, 'stemcell_tgz' => archive_filename.to_s, 'stemcell_image_name' => stemcell_image_name, @@ -36,16 +38,21 @@ }.merge(bosh_micro_options).merge(environment_variables).merge(vsphere_options) end private - attr_reader( - :environment, + def_delegators( + :@definition, :infrastructure, :operating_system, - :agent_name, + :agent, + ) + + attr_reader( + :environment, :stemcell_version, + :definition, :image_create_disk_size, :bosh_micro_release_tgz_path ) def vsphere_options @@ -71,10 +78,10 @@ 'bosh_micro_release_tgz_path' => bosh_micro_release_tgz_path, } end def archive_filename - ArchiveFilename.new(stemcell_version, infrastructure, operating_system, 'bosh-stemcell', false, agent_name) + ArchiveFilename.new(stemcell_version, definition, 'bosh-stemcell', false) end def stemcell_image_name "#{infrastructure.name}-#{infrastructure.hypervisor}-#{operating_system.name}.raw" end