lib/bosh/stemcell/operating_system.rb in bosh-stemcell-1.2881.0 vs lib/bosh/stemcell/operating_system.rb in bosh-stemcell-1.2889.0
- old
+ new
@@ -1,30 +1,31 @@
module Bosh::Stemcell
module OperatingSystem
+
def self.for(operating_system_name, operating_system_version = nil)
case operating_system_name
- when 'centos' then Centos.new
+ when 'centos' then Centos.new(operating_system_version)
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, :version
def initialize(options = {})
@name = options.fetch(:name)
- @version = options.fetch(:version, nil)
+ @version = options.fetch(:version)
end
def ==(other)
name == other.name
end
end
class Centos < Base
- def initialize
- super(name: 'centos')
+ def initialize(version)
+ super(name: 'centos', version: version)
end
end
class Ubuntu < Base
def initialize(version)