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.2690.4.0 lib/bosh/stemcell/definition.rb
bosh-stemcell-1.2732.0 lib/bosh/stemcell/definition.rb
bosh-stemcell-1.2719.0 lib/bosh/stemcell/definition.rb
bosh-stemcell-1.2717.0 lib/bosh/stemcell/definition.rb
bosh-stemcell-1.2710.0 lib/bosh/stemcell/definition.rb
bosh-stemcell-1.2707.0 lib/bosh/stemcell/definition.rb
bosh-stemcell-1.2682.1.0 lib/bosh/stemcell/definition.rb
bosh-stemcell-1.2697.0 lib/bosh/stemcell/definition.rb
bosh-stemcell-1.2693.0 lib/bosh/stemcell/definition.rb
bosh-stemcell-1.2690.0 lib/bosh/stemcell/definition.rb
bosh-stemcell-1.2686.0 lib/bosh/stemcell/definition.rb
bosh-stemcell-1.2685.0 lib/bosh/stemcell/definition.rb
bosh-stemcell-1.2682.0 lib/bosh/stemcell/definition.rb
bosh-stemcell-1.2681.0 lib/bosh/stemcell/definition.rb
bosh-stemcell-1.2671.0 lib/bosh/stemcell/definition.rb
bosh-stemcell-1.2669.0 lib/bosh/stemcell/definition.rb
bosh-stemcell-1.2657.0 lib/bosh/stemcell/definition.rb
bosh-stemcell-1.2652.0 lib/bosh/stemcell/definition.rb
bosh-stemcell-1.2641.0 lib/bosh/stemcell/definition.rb
bosh-stemcell-1.2640.0 lib/bosh/stemcell/definition.rb