ec2launcher 1.3.7 → 1.3.8
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 +4 -0
- data/bin/ec2launcher +1 -1
- data/lib/ec2launcher/terminator.rb +14 -9
- data/lib/ec2launcher/version.rb +1 -1
- metadata +2 -3
data/CHANGELOG.md
CHANGED
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
|
31
|
-
terminator.terminate(opt_parser.hostname, opt_parser.options)
|
31
|
+
terminator.terminate(opt_parser.hostname, opt_parser.options.access_key, opt_parser.options.secret_key)
|
32
32
|
elsif opt_parser.command == "launch"
|
33
33
|
launcher = EC2Launcher::Launcher.new
|
34
34
|
launcher.launch(opt_parser.options)
|
@@ -19,9 +19,7 @@ module EC2Launcher
|
|
19
19
|
log_output = Outputter.stdout
|
20
20
|
log_output.formatter = PatternFormatter.new :pattern => "%m"
|
21
21
|
@log.outputters = log_output
|
22
|
-
end
|
23
22
|
|
24
|
-
def terminate(server_name, options)
|
25
23
|
##############################
|
26
24
|
# Load configuration data
|
27
25
|
##############################
|
@@ -38,25 +36,32 @@ module EC2Launcher
|
|
38
36
|
exit 2
|
39
37
|
end
|
40
38
|
@environment = @environments[options.environ]
|
41
|
-
|
39
|
+
end
|
40
|
+
|
41
|
+
# Terminates a given server instance.
|
42
|
+
#
|
43
|
+
# @param[String] server_name Name of the server instance
|
44
|
+
# @param[String] access_key Amazon IAM access key
|
45
|
+
# @param[String] secret Amazon IAM secret key
|
46
|
+
def terminate(server_name, access_key, secret)
|
42
47
|
##############################
|
43
48
|
# Initialize AWS and create EC2 connection
|
44
49
|
##############################
|
45
|
-
initialize_aws(
|
46
|
-
|
50
|
+
initialize_aws(access_key, secret)
|
51
|
+
ec2 = AWS::EC2.new
|
47
52
|
|
48
53
|
##############################
|
49
54
|
# Create Route53 connection
|
50
55
|
##############################
|
51
56
|
aws_route53 = AWS::Route53.new if @environment.route53_zone_id
|
52
|
-
|
57
|
+
route53 = EC2Launcher::Route53.new(aws_route53, @environment.route53_zone_id, @log)
|
53
58
|
|
54
59
|
##############################
|
55
60
|
# Find instance
|
56
61
|
##############################
|
57
62
|
instance = nil
|
58
63
|
AWS.memoize do
|
59
|
-
instances =
|
64
|
+
instances = ec2.instances.filter("tag:Name", server_name)
|
60
65
|
instances.each do |i|
|
61
66
|
unless i.status == :shutting_down || i.status == :terminated
|
62
67
|
instance = i
|
@@ -72,9 +77,9 @@ module EC2Launcher
|
|
72
77
|
instance.terminate
|
73
78
|
end
|
74
79
|
|
75
|
-
if
|
80
|
+
if route53
|
76
81
|
@log.info("Deleting A record from Route53: #{server_name} => #{private_ip_address}")
|
77
|
-
|
82
|
+
route53.delete_record_by_name(server_name, 'A')
|
78
83
|
end
|
79
84
|
|
80
85
|
@log.info("Deleting node/client from Chef: #{server_name}")
|
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.3.
|
4
|
+
version: 1.3.8
|
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: 2012-10-
|
12
|
+
date: 2012-10-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: aws-sdk
|
@@ -111,4 +111,3 @@ signing_key:
|
|
111
111
|
specification_version: 3
|
112
112
|
summary: Tool to launch EC2 instances.
|
113
113
|
test_files: []
|
114
|
-
has_rdoc:
|