lib/bosh/stemcell/definition.rb in bosh-stemcell-1.2427.0 vs lib/bosh/stemcell/definition.rb in bosh-stemcell-1.2446.0
- old
+ new
@@ -4,21 +4,32 @@
module Bosh::Stemcell
class Definition
attr_reader :infrastructure, :operating_system, :agent
- def self.for(infrastructure_name, operating_system_name, agent_name)
+ def self.for(infrastructure_name, operating_system_name, operating_system_version, agent_name)
new(
Bosh::Stemcell::Infrastructure.for(infrastructure_name),
- Bosh::Stemcell::OperatingSystem.for(operating_system_name),
+ Bosh::Stemcell::OperatingSystem.for(operating_system_name, operating_system_version),
Bosh::Stemcell::Agent.for(agent_name),
)
end
def initialize(infrastructure, operating_system, agent)
@infrastructure = infrastructure
@operating_system = operating_system
@agent = agent
+ end
+
+ def stemcell_name
+ stemcell_name_parts = [
+ infrastructure.name,
+ infrastructure.hypervisor,
+ operating_system.name,
+ ]
+ stemcell_name_parts << operating_system.version if operating_system.version
+ stemcell_name_parts << "#{agent.name}_agent" unless agent.name == 'ruby'
+ stemcell_name_parts.join('-')
end
def ==(other)
infrastructure == other.infrastructure &&
operating_system == other.operating_system &&