Module: Enscalator::Plugins::CoreOS

Defined in:
lib/enscalator/plugins/core_os.rb

Overview

CoreOS appliance

Constant Summary collapse

CHANNELS =

CoreOS Release channels

[:alpha, :beta, :stable].freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.get_channel_version(channel: :stable, tag: nil) ⇒ Hash

Get CoreOS mapping for specific version from specific channel (stable, beta or alpha)

Parameters:

  • channel (Symbol) (defaults to: :stable)

    channel identifier

  • tag (String) (defaults to: nil)

    specific version release tag

Returns:

  • (Hash)

    CoreOS mapping for specific version and channel (if version tag is not given, returns the most latest version number)



16
17
18
19
20
# File 'lib/enscalator/plugins/core_os.rb', line 16

def get_channel_version(channel: :stable, tag: nil)
  fail ArgumentError, "channel can only be one of #{CHANNELS}" unless CHANNELS.include? channel
  base_url = "http://#{channel}.release.core-os.net/amd64-usr"
  fetch_mapping(base_url, tag)
end

.get_specific_version(tag: nil) ⇒ Hash

Get CoreOS mapping for specific version regardless of its release channel

Parameters:

  • tag (String) (defaults to: nil)

    version tag

Returns:

  • (Hash)

    CoreOS mapping for specific version (if version tag is not given, returns the most latest version number)



27
28
29
30
31
32
33
34
# File 'lib/enscalator/plugins/core_os.rb', line 27

def get_specific_version(tag: nil)
  urls = CHANNELS.map { |c| "http://#{c}.release.core-os.net/amd64-usr" }
  mapping = nil
  urls.each do |u|
    mapping ||= fetch_mapping(u, tag)
  end
  mapping
end

Instance Method Details

#core_os_initObject

Initialize CoreOS related configurations



83
84
85
# File 'lib/enscalator/plugins/core_os.rb', line 83

def core_os_init
  mapping 'AWSCoreOSAMI', CoreOS.get_channel_version(channel: :stable)
end