Class: Bosh::AwsCloud::AKIPicker

Inherits:
Object
  • Object
show all
Defined in:
lib/cloud/aws/aki_picker.rb

Instance Method Summary collapse

Constructor Details

#initialize(region) ⇒ AKIPicker

Returns a new instance of AKIPicker.

Parameters:

  • region (AWS::Core::ServiceInterface)


5
6
7
# File 'lib/cloud/aws/aki_picker.rb', line 5

def initialize(region)
  @region = region
end

Instance Method Details

#pick(architecture, root_device_name) ⇒ String

finds the correct aki for the current region

Parameters:

  • architecture (String)

    instruction architecture to find

  • root_device_name (String)

Returns:

  • (String)

    EC2 image id

Raises:

  • (Bosh::Clouds::CloudError)


13
14
15
16
17
18
19
# File 'lib/cloud/aws/aki_picker.rb', line 13

def pick(architecture, root_device_name)
  candidate = pick_candidate(fetch_akis(architecture), root_device_name)
  raise Bosh::Clouds::CloudError, "unable to find AKI" unless candidate
  logger.info("auto-selected AKI: #{candidate.image_id}")

  candidate.image_id
end