ec2launcher 1.0.24 → 1.0.25
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +4 -0
- data/lib/ec2launcher/version.rb +1 -1
- data/lib/ec2launcher.rb +0 -1
- data/startup-scripts/setup_instance.rb +15 -6
- metadata +1 -1
data/CHANGELOG.md
CHANGED
data/lib/ec2launcher/version.rb
CHANGED
data/lib/ec2launcher.rb
CHANGED
@@ -873,7 +873,6 @@ module EC2Launcher
|
|
873
873
|
commands = @options.commands.collect {|cmd| substitute_command_variables(cmd) }
|
874
874
|
user_data += "\n" + commands.join("\n")
|
875
875
|
end
|
876
|
-
@options.commands.each {|extra_cmd| user_data += "\n#{extra_cmd}" }
|
877
876
|
|
878
877
|
# Post commands
|
879
878
|
unless @environment.postcommands.nil? || @environment.postcommands.empty?
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'rubygems'
|
4
4
|
|
5
|
+
require 'open3'
|
5
6
|
require 'optparse'
|
6
7
|
require 'ostruct'
|
7
8
|
|
@@ -352,21 +353,29 @@ end
|
|
352
353
|
|
353
354
|
##############################
|
354
355
|
# Launch Chef
|
355
|
-
|
356
|
-
|
357
|
-
|
356
|
+
def run_chef_client(chef_path)
|
357
|
+
result = 0
|
358
|
+
Open3.popen3(chef_path) do |stdin, stdout, stderr, wait_thr|
|
359
|
+
stdout.each do |line|
|
360
|
+
puts line
|
361
|
+
end
|
362
|
+
result = wait_thr.value
|
358
363
|
end
|
364
|
+
result
|
359
365
|
end
|
360
366
|
|
367
|
+
result = run_chef_client(chef_path)
|
368
|
+
run_chef_client(chef_path) unless result == 0
|
369
|
+
|
361
370
|
##############################
|
362
371
|
# EMAIL NOTIFICATION
|
363
372
|
##############################
|
364
|
-
if instance_data["
|
373
|
+
if instance_data["email_notifications"]
|
365
374
|
# Email notification through SES
|
366
375
|
puts "Email notification through SES..."
|
367
376
|
AWS.config({
|
368
|
-
:access_key_id => instance_data["
|
369
|
-
:secret_access_key => instance_data["
|
377
|
+
:access_key_id => instance_data["email_notifications"]["ses_access_key"],
|
378
|
+
:secret_access_key => instance_data["email_notifications"]["ses_secret_key"]
|
370
379
|
})
|
371
380
|
ses = AWS::SimpleEmailService.new
|
372
381
|
ses.send_email(
|