ec2launcher 1.0.23 → 1.0.24

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 1.0.24
2
+
3
+ * Fixed typos.
4
+ * Hide additional logging.
5
+
1
6
  ## 1.0.23
2
7
 
3
8
  * Display subnet CIDR block when launching instances into VPCs.
@@ -2,6 +2,9 @@
2
2
  # Copyright (c) 2012 Sean Laurent
3
3
  #
4
4
  require 'ec2launcher/defaults'
5
+ require 'log4r'
6
+
7
+ include Log4r
5
8
 
6
9
  module EC2Launcher
7
10
  # Helper class to build EC2 block device definitions.
@@ -20,6 +23,8 @@ module EC2Launcher
20
23
 
21
24
  @block_device_mappings = {}
22
25
  @block_device_tags = {}
26
+
27
+ @log = Logger['ec2launcher']
23
28
  end
24
29
 
25
30
  # Generates the mappings for ephemeral and ebs volumes.
@@ -147,7 +152,7 @@ module EC2Launcher
147
152
  def clone_volumes(block_device_mappings, application, clone_host = nil)
148
153
  return if clone_host.nil?
149
154
 
150
- puts "Retrieving snapshots..."
155
+ @log.info "Retrieving snapshots..."
151
156
  AWS.start_memoizing
152
157
  base_device_name = "sdf"
153
158
  application.block_devices.each do |block_device|
@@ -183,10 +188,10 @@ module EC2Launcher
183
188
  # @return [Hash<Integer, AWS::EC2::Snapshot>] mapping of RAID device numbers (zero based) to AWS Snapshots.
184
189
  #
185
190
  def get_latest_raid_snapshot_mapping(hostname, purpose, count)
186
- puts "Retrieving list of snapshots ..."
191
+ @log.info "Retrieving list of snapshots ..."
187
192
  result = @ec2.snapshots.tagged("host").tagged_values(hostname).tagged("volumeName").tagged_values("*raid*").tagged("time")
188
193
 
189
- puts "Building list of snapshots to clone (#{purpose}) for '#{hostname}'..."
194
+ @log.info "Building list of snapshots to clone (#{purpose}) for '#{hostname}'..."
190
195
  snapshot_name_regex = /#{purpose} raid.*/
191
196
  host_snapshots = []
192
197
  result.each do |s|
@@ -242,7 +247,7 @@ module EC2Launcher
242
247
  end
243
248
  most_recent_dates.sort!
244
249
 
245
- puts "Most recent snapshot: #{most_recent_dates[0]}"
250
+ @log.info "Most recent snapshot: #{most_recent_dates[0]}"
246
251
 
247
252
  snapshot_mapping = { }
248
253
  AWS.memoize do
@@ -271,7 +276,7 @@ module EC2Launcher
271
276
  # @return [AWS::EC2::Snapshot, nil] matching snapshot or nil if no matching snapshot
272
277
  #
273
278
  def get_latest_snapshot_by_purpose(clone_host, purpose)
274
- puts " Retrieving snapshtos for #{clone_host} [#{purpose}]"
279
+ @log.info "Retrieving snapshtos for #{clone_host} [#{purpose}]"
275
280
  results = @ec2.snapshots.tagged("host").tagged_values(clone_host).tagged("purpose").tagged_values(purpose)
276
281
 
277
282
  snapshot = nil
@@ -2,5 +2,5 @@
2
2
  # Copyright (c) 2012 Sean Laurent
3
3
  #
4
4
  module EC2Launcher
5
- VERSION = "1.0.23"
5
+ VERSION = "1.0.24"
6
6
  end
data/lib/ec2launcher.rb CHANGED
@@ -39,7 +39,7 @@ module EC2Launcher
39
39
  @run_url_script_cache = nil
40
40
  @setup_script_cache = nil
41
41
 
42
- @log = Logger.new 'mylog'
42
+ @log = Logger.new 'ec2launcher'
43
43
  log_output = Outputter.stdout
44
44
  log_output.formatter = PatternFormatter.new :pattern => "%m"
45
45
  @log.outputters = log_output
@@ -330,7 +330,7 @@ module EC2Launcher
330
330
  @log.info "Gems : #{gems.join(', ')}"
331
331
  @log.info "Packages : #{packages.join(', ')}"
332
332
  if subnet
333
- cidr_block = ec2.subnets[subnet].cidr_block
333
+ cidr_block = @ec2.subnets[subnet].cidr_block
334
334
  @log.info "VPC Subnet : #{subnet} (#{cidr_block})"
335
335
  end
336
336
  @log.info ""
@@ -383,10 +383,10 @@ module EC2Launcher
383
383
 
384
384
  public_dns_name = instance.public_dns_name.nil? ? "no public dns" : instance.public_dns_name
385
385
  private_dns_name = instance.private_dns_name.nil? ? "no private dns" : instance.private_dns_name
386
- @log.warn "Launched #{fqdn_names[i]} (#{instance.id}) [#{public_dns_name} / #{private_dns_name} / #{instance.private_ip_address} ]"
386
+ @log.info "Launched #{fqdn_names[i]} (#{instance.id}) [#{public_dns_name} / #{private_dns_name} / #{instance.private_ip_address} ]"
387
387
  end
388
388
 
389
- @log.warn "********************"
389
+ @log.info "********************"
390
390
  fqdn_names.each_index do |i|
391
391
  public_dns_name = instances[i].public_dns_name.nil? ? "n/a" : instances[i].public_dns_name
392
392
  private_dns_name = instances[i].private_dns_name.nil? ? "n/a" : instances[i].private_dns_name
@@ -403,7 +403,7 @@ module EC2Launcher
403
403
  ##############################
404
404
  # COMPLETED
405
405
  ##############################
406
- @log.warn "********************"
406
+ @log.info "********************"
407
407
  end
408
408
 
409
409
  # Attaches an instance to the specified ELB.
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.23
4
+ version: 1.0.24
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: