judo 0.5.0 → 0.5.1

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.0
1
+ 0.5.1
data/lib/judo.rb CHANGED
@@ -12,6 +12,7 @@ require 'tempfile'
12
12
  class JudoError < RuntimeError ; end
13
13
  class JudoInvalid < RuntimeError ; end
14
14
 
15
+ require File.dirname(__File__) + '/judo/util'
15
16
  require File.dirname(__FILE__) + '/judo/base'
16
17
  require File.dirname(__FILE__) + '/judo/group'
17
18
  require File.dirname(__FILE__) + '/judo/server'
@@ -137,7 +137,7 @@ module Judo
137
137
  printf " %-24s: %s\n",k, i[k]
138
138
  end
139
139
  end
140
- sub_info("METADATA", server.metadata.keys) do |key|
140
+ sub_info("METADATA", (server.metadata || {}).keys) do |key|
141
141
  printf(" %-24s: %s\n", key, server.metadata[key] )
142
142
  end
143
143
  sub_info("VOLUMES", server.ec2_volumes) do |v|
data/lib/judo/group.rb CHANGED
@@ -54,7 +54,7 @@ module Judo
54
54
  userdata = File.read("#{name}/userdata.erb")
55
55
  tar = tar_file(@version)
56
56
  puts ""
57
- system "tar czvf #{tar} #{name}"
57
+ Util.system_comfirmed "tar czvf #{tar} #{name}"
58
58
  puts "Uploading config to s3..."
59
59
  @base.s3_put(version_config_file(@version), conf.to_json)
60
60
  puts "Uploading userdata.erb to s3..."
data/lib/judo/server.rb CHANGED
@@ -18,7 +18,7 @@ module Judo
18
18
  metadata = options[:metadata]
19
19
  ip = options[:elastic_ip]
20
20
  clone = options[:clone]
21
- instance_type = options[:instance_type]
21
+ instance_type = options[:instance_type] || 'm1.small'
22
22
  version = options[:version] || group.version
23
23
 
24
24
  task("Creating server #{name}") do
@@ -202,7 +202,7 @@ module Judo
202
202
  def clone_snapshots(snapshots)
203
203
  snapshots.each do |device,snap_id|
204
204
  task("Creating EC2 Volume #{device} from #{snap_id}") do
205
- volume_id = @base.ec2.create_volume(snap_id, nil, config["availability_zone"])[:aws_id]
205
+ volume_id = @base.ec2.create_volume(snap_id, nil, ec2_availability_zone)[:aws_id]
206
206
  add_volume(volume_id, device)
207
207
  end
208
208
  end
@@ -216,7 +216,7 @@ module Judo
216
216
  size = volume_config["size"]
217
217
  if not volumes[device]
218
218
  task("Creating EC2 Volume #{device} #{size}") do
219
- volume_id = @base.ec2.create_volume(nil, size, config["availability_zone"])[:aws_id]
219
+ volume_id = @base.ec2.create_volume(nil, size, ec2_availability_zone)[:aws_id]
220
220
  add_volume(volume_id, device)
221
221
  end
222
222
  else
@@ -287,12 +287,16 @@ module Judo
287
287
  task("Destroying server #{name}") { delete }
288
288
  end
289
289
 
290
+ def ec2_instance
291
+ @base.ec2_instances.detect { |e| e[:aws_instance_id] == instance_id } or {}
292
+ end
293
+
290
294
  def ec2_state
291
295
  ec2_instance[:aws_state]
292
296
  end
293
297
 
294
- def ec2_instance
295
- @base.ec2_instances.detect { |e| e[:aws_instance_id] == instance_id } or {}
298
+ def ec2_availability_zone
299
+ ec2_instance[:aws_availability_zone]
296
300
  end
297
301
 
298
302
  def running?
@@ -499,7 +503,7 @@ module Judo
499
503
  def ssh_command(cmd)
500
504
  wait_for_ssh
501
505
  @base.keypair_file do |file|
502
- system "ssh -q -i #{file} #{config["user"]}@#{hostname} '#{cmd}'"
506
+ Util.system_confirmed "ssh -q -i #{file} #{config["user"]}@#{hostname} '#{cmd}'"
503
507
  end
504
508
  end
505
509
 
data/lib/judo/util.rb ADDED
@@ -0,0 +1,8 @@
1
+ module Judo
2
+ module Util
3
+ def self.system_confirmed(cmd)
4
+ system cmd
5
+ raise "Command #{cmd} failed with exit code #{$?.to_i}" unless $?.success?
6
+ end
7
+ end
8
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 5
8
- - 0
9
- version: 0.5.0
8
+ - 1
9
+ version: 0.5.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Orion Henry
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-06-11 00:00:00 -07:00
17
+ date: 2010-06-15 00:00:00 -07:00
18
18
  default_executable: judo
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -79,6 +79,7 @@ files:
79
79
  - lib/judo/patch.rb
80
80
  - lib/judo/server.rb
81
81
  - lib/judo/snapshot.rb
82
+ - lib/judo/util.rb
82
83
  has_rdoc: true
83
84
  homepage: http://github.com/orionz/judo
84
85
  licenses: []