ec2launcher 1.0.28 → 1.0.30

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.30
2
+
3
+ * Fixed bug with EBS volume mount locations.
4
+
1
5
  ## 1.0.28
2
6
 
3
7
  * Fixed problem with pre/post command inheritance.
data/lib/ec2launcher.rb CHANGED
@@ -48,6 +48,8 @@ module EC2Launcher
48
48
  def launch(options)
49
49
  @options = options
50
50
 
51
+ @log.info "ec2launcher v#{EC2Launcher::VERSION}"
52
+
51
53
  @log.level = case @options.verbosity
52
54
  when :quiet then WARN
53
55
  when :verbose then DEBUG
@@ -526,7 +528,7 @@ module EC2Launcher
526
528
  # @return [String] DNS for the instance or "n/a" if undefined.
527
529
  #
528
530
  def get_instance_dns(ec2_instance, public = true)
529
- dns_name = public ? instance.public_dns_name : instance.private_dns_name
531
+ dns_name = public ? ec2_instance.public_dns_name : ec2_instance.private_dns_name
530
532
  dns_name.nil? ? "n/a" : dns_name
531
533
  end
532
534
 
@@ -827,11 +829,7 @@ module EC2Launcher
827
829
  user_data += "\necho '#{setup_json.to_json}' > /tmp/setup.json"
828
830
 
829
831
  # pre-commands, if necessary
830
- puts "Precommands: #{@environment.precommands}"
831
- unless @environment.precommand.nil? || @environment.precommand.empty?
832
- commands = @environment.precommand.collect {|cmd| substitute_command_variables(cmd) }
833
- user_data += "\n" + commands.join("\n")
834
- end
832
+ user_data += build_commands(@environment.precommand)
835
833
 
836
834
  user_data += "\n"
837
835
 
@@ -870,17 +868,26 @@ module EC2Launcher
870
868
  end
871
869
 
872
870
  # Add extra requested commands to the launch sequence
873
- unless @options.commands.nil?
874
- commands = @options.commands.collect {|cmd| substitute_command_variables(cmd) }
875
- user_data += "\n" + commands.join("\n")
876
- end
871
+ user_data += build_commands(@options.commands)
877
872
 
878
873
  # Post commands
879
- unless @environment.postcommand.nil? || @environment.postcommand.empty?
880
- commands = @environment.postcommand.collect {|cmd| substitute_command_variables(cmd) }
881
- user_data += "\n" + commands.join("\n")
882
- end
874
+ user_data += build_commands(@environment.postcommand)
875
+
883
876
  user_data
884
877
  end
878
+
879
+ # Builds a bash script snipp containing a list of commands to execute.
880
+ #
881
+ # @param [Array<String>] commands List of commands to run. Can be nil.
882
+ #
883
+ # @return [String] String containing newline separated bash commands to run or an empty string if no commands.
884
+ def build_commands(commands)
885
+ command_str = ""
886
+ unless commands.nil? || commands.empty?
887
+ processed_commands = commands.collect {|cmd| substitute_command_variables(cmd) }
888
+ command_str = "\n" + processed_commands.join("\n")
889
+ end
890
+ command_str
891
+ end
885
892
  end
886
893
  end
@@ -32,7 +32,7 @@ module EC2Launcher
32
32
  "name" => @name,
33
33
  "count" => @count,
34
34
  "raid_level" => @raid_level,
35
- "mount_point" => @mount_point,
35
+ "mount_point" => @mount,
36
36
  "owner" => @owner,
37
37
  "group" => @group
38
38
  }.to_json(*a)
@@ -2,5 +2,5 @@
2
2
  # Copyright (c) 2012 Sean Laurent
3
3
  #
4
4
  module EC2Launcher
5
- VERSION = "1.0.28"
5
+ VERSION = "1.0.30"
6
6
  end
@@ -226,11 +226,15 @@ def setup_attached_raid_array(system_arch, devices, raid_device = '/dev/md0', ra
226
226
  array_uuid = `mdadm --detail #{raid_device}|grep UUID|awk '// { print $3; }'`.strip
227
227
 
228
228
  # We have to manually update mdadm.conf as well
229
- `echo ARRAY #{raid_device} level=raid#{raid_type.to_s} num-devices=#{devices.count.to_s} meta-data=0.90 UUID=#{array_uuid} |tee -a /etc/mdadm.conf`
229
+ #`echo ARRAY #{raid_device} level=raid#{raid_type.to_s} num-devices=#{devices.count.to_s} meta-data=0.90 UUID=#{array_uuid} |tee -a /etc/mdadm.conf`
230
+ `echo ARRAY #{raid_device} level=raid#{raid_type.to_s} num-devices=#{devices.count.to_s} UUID=#{array_uuid} |tee -a /etc/mdadm.conf`
230
231
  else
231
232
  raid_info = raid_scan_info.split("\n")[-1].split()[1]
232
233
  end
233
- Pathname.new(raid_info).realpath.to_s
234
+ raid_device_real_path = Pathname.new(raid_info).realpath.to_s
235
+ puts "Using raid device: #{raid_info}. Real path: #{raid_device_real_path}"
236
+
237
+ raid_device_real_path
234
238
  end
235
239
 
236
240
  def build_block_devices(count, device = "xvdj", &block)
@@ -308,6 +312,7 @@ unless instance_data["block_devices"].nil?
308
312
  raid_devices << "/dev/#{device_name}"
309
313
  next_device_name = device_name
310
314
  end
315
+ puts "Setting up attached raid array... system_arch = #{system_arch}, raid_devices = #{raid_devices}, device = /dev/md#{(127 - raid_array_count).to_s}"
311
316
  raid_device_name = setup_attached_raid_array(system_arch, raid_devices, "/dev/md#{(127 - raid_array_count).to_s}", block_device_json["raid_level"].to_i, ! options.clone_host.nil?)
312
317
  mount_device(raid_device_name, block_device_json["mount_point"], block_device_json["owner"], block_device_json["group"], default_fs_type)
313
318
  raid_array_count += 1
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.28
4
+ version: 1.0.30
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-08-14 00:00:00.000000000 Z
12
+ date: 2012-08-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aws-sdk