ec2launcher 1.6.0 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +5 -0
- data/bin/ec2launcher +1 -1
- data/lib/ec2launcher/init_options.rb +4 -0
- data/lib/ec2launcher/terminator.rb +14 -6
- data/lib/ec2launcher/version.rb +1 -1
- metadata +2 -2
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
## 1.6.1
|
2
|
+
|
3
|
+
* Added option to force termination of an instance, even if the environment tag is missing.
|
4
|
+
* Added block device configuration option to set block read-ahead values when setting up an EBS volume.
|
5
|
+
|
1
6
|
## 1.6.0
|
2
7
|
|
3
8
|
* Added option to set block device read-ahead value.
|
data/bin/ec2launcher
CHANGED
@@ -28,7 +28,7 @@ if opt_parser.command == "init"
|
|
28
28
|
puts "Successfully created #{opt_parser.location}"
|
29
29
|
elsif opt_parser.command =~ /^term/
|
30
30
|
terminator = EC2Launcher::Terminator.new(opt_parser.options.directory)
|
31
|
-
terminator.terminate(opt_parser.hostname, opt_parser.options.access_key, opt_parser.options.secret_key, opt_parser.options.snapshot_removal)
|
31
|
+
terminator.terminate(opt_parser.hostname, opt_parser.options.access_key, opt_parser.options.secret_key, opt_parser.options.snapshot_removal, opt_parser.options.force)
|
32
32
|
elsif opt_parser.command == "launch"
|
33
33
|
launcher = EC2Launcher::Launcher.new
|
34
34
|
launcher.launch(opt_parser.options)
|
@@ -154,6 +154,9 @@ EOH
|
|
154
154
|
opts.on("--[no-]snapshot-removal", "Remove EBS snapshots. Defaults to TRUE.") do |removal|
|
155
155
|
@options.snapshot_removal = removal
|
156
156
|
end
|
157
|
+
opts.on("-f", "--[no-]force", "Force termination even if missing environment. Defaults to FALSE.") do |force|
|
158
|
+
@options.force = true
|
159
|
+
end
|
157
160
|
|
158
161
|
opts.separator ""
|
159
162
|
opts.separator "Miscellaneous:"
|
@@ -195,6 +198,7 @@ EOH
|
|
195
198
|
@options.volume_size = nil
|
196
199
|
|
197
200
|
@options.snapshot_removal = true
|
201
|
+
@options.force = false
|
198
202
|
|
199
203
|
@options.verbosity = :normal
|
200
204
|
|
@@ -35,7 +35,8 @@ module EC2Launcher
|
|
35
35
|
# @param[String] access_key Amazon IAM access key
|
36
36
|
# @param[String] secret Amazon IAM secret key
|
37
37
|
# @param[Boolean] snapshot_removal Remove EBS snapshots for EBS volumes attached to the instance.
|
38
|
-
|
38
|
+
# @param[Boolean] force Force instance termination even if environment is not found.
|
39
|
+
def terminate(server_name, access_key, secret, snapshot_removal = true, force = false)
|
39
40
|
##############################
|
40
41
|
# Initialize AWS and create EC2 connection
|
41
42
|
##############################
|
@@ -59,24 +60,31 @@ module EC2Launcher
|
|
59
60
|
if instance
|
60
61
|
environment_name = nil
|
61
62
|
AWS.memoize do
|
62
|
-
environment_name = instance.tags["environment"].strip
|
63
|
+
environment_name = instance.tags["environment"].strip if instance.tags["environment"]
|
63
64
|
end
|
64
65
|
|
65
66
|
##############################
|
66
67
|
# ENVIRONMENT
|
67
68
|
##############################
|
68
|
-
|
69
|
+
if environment_name.nil? && ! force
|
70
|
+
@log.fatal "No environment tag found for host. Use the --force option to override and terminate."
|
71
|
+
exit 3
|
72
|
+
end
|
73
|
+
|
74
|
+
if (! @environments.has_key?(environment_name)) && (! force)
|
69
75
|
@log.fatal "Environment not found: '#{environment_name}'"
|
70
76
|
exit 2
|
71
77
|
end
|
72
|
-
@environment = @environments[environment_name]
|
78
|
+
@environment = @environments[environment_name] if environment_name
|
73
79
|
|
74
80
|
##############################
|
75
81
|
# Create Route53 connection
|
76
82
|
##############################
|
77
83
|
aws_route53 = nil
|
78
|
-
|
79
|
-
|
84
|
+
if @environment && @environment.route53_zone_id
|
85
|
+
aws_route53 = AWS::Route53.new
|
86
|
+
route53 = EC2Launcher::Route53.new(aws_route53, @environment.route53_zone_id, @log)
|
87
|
+
end
|
80
88
|
|
81
89
|
##############################
|
82
90
|
# EBS Volumes
|
data/lib/ec2launcher/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ec2launcher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-01-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: aws-sdk
|