lib/aerosol/launch_template.rb in aerosol-1.9.1 vs lib/aerosol/launch_template.rb in aerosol-1.9.2
- old
+ new
@@ -1,11 +1,12 @@
class Aerosol::LaunchTemplate
include Aerosol::AWSModel
include Dockly::Util::Logger::Mixin
logger_prefix '[aerosol launch_template]'
- aws_attribute :launch_template_name, :image_id, :instance_type, :security_groups, :user_data,
+ aws_attribute :launch_template_name, :launch_template_id, :latest_version_number,
+ :image_id, :instance_type, :security_groups, :user_data,
:iam_instance_profile, :kernel_id, :key_name, :spot_price, :created_time,
:network_interfaces, :block_device_mappings, :ebs_optimized
dsl_attribute :meta_data
primary_key :launch_template_name
@@ -19,19 +20,10 @@
else
@launch_template_name || default_identifier
end
end
- def exists?
- info "launch_template: needed?: #{launch_template_name}: " +
- "checking for launch template: #{launch_template_name}"
- exists = super
- info "launch template: needed?: #{launch_template_name}: " +
- "#{exists ? 'found' : 'did not find'} launch template: #{launch_template_name}"
- exists
- end
-
def security_group(group)
security_groups << group
end
def create!
@@ -46,10 +38,11 @@
monitoring: {
enabled: true
},
}.merge(create_options)
)
+
info self.inspect
end
def destroy!
info self.to_s
@@ -58,11 +51,11 @@
end
def all_instances
Aerosol::Instance.all.select { |instance|
!instance.launch_template.nil? &&
- (instance.launch_template == launch_template_name)
+ (instance.launch_template.launch_template_name == launch_template_name)
}.each(&:description)
end
def self.request_all_for_token(next_token)
options = next_token.nil? ? {} : { next_token: next_token }
@@ -76,16 +69,17 @@
begin
new_lts = request_all_for_token(next_token)
lts.concat(new_lts.launch_templates)
next_token = new_lts.next_token
end until next_token.nil?
-
lts
end
def to_s
%{Aerosol::LaunchTemplate { \
"launch_template_name" => "#{launch_template_name}", \
+"launch_template_id" => "#{launch_template_id}", \
+"latest_version_number" => "#{latest_version_number}", \
"image_id" => "#{image_id}", \
"instance_type" => "#{instance_type}", \
"security_group_ids" => #{security_groups.to_s}, \
"user_data" => "#{user_data}", \
"iam_instance_profile" => "#{iam_instance_profile}", \