Sha256: e29fe67e7d1c9737e2846fbad2de5af316049bd8d1db6276d21a22304edd60a2

Contents?: true

Size: 1.22 KB

Versions: 46

Compression:

Stored size: 1.22 KB

Contents

require 'bosh/stemcell/infrastructure'
require 'bosh/stemcell/operating_system'
require 'bosh/stemcell/agent'

module Bosh::Stemcell
  class Definition
    attr_reader :infrastructure, :operating_system, :agent

    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, 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 &&
        agent == other.agent
    end
  end
end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
bosh-stemcell-1.2624.0 lib/bosh/stemcell/definition.rb
bosh-stemcell-1.2619.0 lib/bosh/stemcell/definition.rb
bosh-stemcell-1.2611.0 lib/bosh/stemcell/definition.rb
bosh-stemcell-1.2606.0 lib/bosh/stemcell/definition.rb
bosh-stemcell-1.2605.0 lib/bosh/stemcell/definition.rb
bosh-stemcell-1.2603.0 lib/bosh/stemcell/definition.rb
bosh-stemcell-1.2597.0 lib/bosh/stemcell/definition.rb
bosh-stemcell-1.2596.0 lib/bosh/stemcell/definition.rb
bosh-stemcell-1.2583.0 lib/bosh/stemcell/definition.rb
bosh-stemcell-1.2579.0 lib/bosh/stemcell/definition.rb
bosh-stemcell-1.2578.0 lib/bosh/stemcell/definition.rb
bosh-stemcell-1.2577.0 lib/bosh/stemcell/definition.rb
bosh-stemcell-1.2576.0 lib/bosh/stemcell/definition.rb
bosh-stemcell-1.2560.0 lib/bosh/stemcell/definition.rb
bosh-stemcell-1.2559.0 lib/bosh/stemcell/definition.rb
bosh-stemcell-1.2549.0 lib/bosh/stemcell/definition.rb
bosh-stemcell-1.2546.0 lib/bosh/stemcell/definition.rb
bosh-stemcell-1.2539.0 lib/bosh/stemcell/definition.rb
bosh-stemcell-1.2537.0 lib/bosh/stemcell/definition.rb
bosh-stemcell-1.2534.0 lib/bosh/stemcell/definition.rb