lib/capistrano/asg/rolling/launch_template.rb in capistrano-asg-rolling-0.1.0 vs lib/capistrano/asg/rolling/launch_template.rb in capistrano-asg-rolling-0.2.0
- old
+ new
@@ -5,16 +5,17 @@
module Rolling
# AWS EC2 Launch Template.
class LaunchTemplate
include AWS
- attr_reader :id, :version, :default_version
+ attr_reader :id, :version, :name, :default_version
alias default_version? default_version
- def initialize(id, version, default_version: false)
+ def initialize(id, version, name, default_version: false)
@id = id
@version = version.to_s
+ @name = name
@default_version = default_version
end
def create_version(image_id:, description: nil)
response = aws_ec2_client.create_launch_template_version(
@@ -23,11 +24,11 @@
source_version: version,
version_description: description
)
version = response.launch_template_version
- self.class.new(version.launch_template_id, version.version_number, default_version: version.default_version)
+ self.class.new(version.launch_template_id, version.version_number, version.launch_template_name, default_version: version.default_version)
end
def delete
aws_ec2_client.delete_launch_template_versions(
launch_template_id: id,
@@ -42,10 +43,10 @@
def previous_versions
aws_ec2_client.describe_launch_template_versions(launch_template_id: id)
.launch_template_versions
.sort_by { |v| -v.version_number }
.select { |v| v.version_number < version_number }
- .map { |v| self.class.new(v.launch_template_id, v.version_number, default_version: v.default_version) }
+ .map { |v| self.class.new(v.launch_template_id, v.version_number, v.launch_template_name, default_version: v.default_version) }
end
def version_number
aws_describe_launch_template_version.version_number
end