ec2launcher 1.0.24 → 1.0.25

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 CHANGED
@@ -1,3 +1,7 @@
1
+ ## 1.0.25
2
+
3
+ * Fixed duplicate commands.
4
+
1
5
  ## 1.0.24
2
6
 
3
7
  * Fixed typos.
@@ -2,5 +2,5 @@
2
2
  # Copyright (c) 2012 Sean Laurent
3
3
  #
4
4
  module EC2Launcher
5
- VERSION = "1.0.24"
5
+ VERSION = "1.0.25"
6
6
  end
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
- IO.popen(chef_path) do |f|
356
- while ! f.eof
357
- puts f.gets
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["email_notification"]
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["email_notification"]["ses_access_key"],
369
- :secret_access_key => instance_data["email_notification"]["ses_secret_key"]
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(
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.0.24
4
+ version: 1.0.25
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: