lib/bosh/stemcell/operating_system.rb in bosh-stemcell-1.2427.0 vs lib/bosh/stemcell/operating_system.rb in bosh-stemcell-1.2446.0

- old
+ new

@@ -1,20 +1,21 @@ module Bosh::Stemcell module OperatingSystem - def self.for(operating_system_name) + def self.for(operating_system_name, operating_system_version = nil) case operating_system_name when 'centos' then Centos.new - when 'ubuntu' then Ubuntu.new + when 'ubuntu' then Ubuntu.new(operating_system_version) else raise ArgumentError.new("invalid operating system: #{operating_system_name}") end end class Base - attr_reader :name + attr_reader :name, :version def initialize(options = {}) @name = options.fetch(:name) + @version = options.fetch(:version, nil) end def ==(other) name == other.name end @@ -25,11 +26,11 @@ super(name: 'centos') end end class Ubuntu < Base - def initialize - super(name: 'ubuntu') + def initialize(version) + super(name: 'ubuntu', version: version) end end end end