rudy 0.6.6 → 0.6.7

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/CHANGES.txt CHANGED
@@ -7,11 +7,18 @@ RUDY, CHANGES
7
7
  * TODO: Support for product codes
8
8
  * TODO: HTTPS
9
9
 
10
+ #### 0.6.7 (2009-04-22) ###############################
11
+
12
+ * ADDED: rudy-ec2 status can now display EU status
13
+ * FIXED: Fixed bug on instance create. Instance.groups was nil, now it returns
14
+ empty Array.
15
+
10
16
  #### 0.6.6 (2009-04-22) ###############################
11
17
 
12
18
  * ADDED: Better error handling for Rudy::AWS::SDB
13
19
  * FIXED: Ruby 1.9.1 compatability (including requiring aws-s3 >=0.6.1)
14
20
 
21
+
15
22
  #### 0.6.5 (2009-04-20) ###############################
16
23
 
17
24
  * FIXED: Startup and Shutdown routines now check machine group status first
data/README.rdoc CHANGED
@@ -75,12 +75,14 @@ The <tt>-u root</tt> tells Rudy to open a connection as the root user. If you cr
75
75
  == Dependencies:
76
76
 
77
77
  * OpenSSH[http://www.openssh.com/]
78
- * Net::SSH[http://net-ssh.rubyforge.org/]
79
- * Net::SCP[http://net-ssh.rubyforge.org/]
80
- * amazon-ec2[http://github.com/grempe/amazon-ec2]
81
- * Rye[http://github.com/delano/rye]
82
- * Drydock[http://github.com/delano/drydock]
83
- * Caesars[http://github.com/delano/caesars]
78
+ * Ruby 1.8.x, 1.9.x, or JRuby 1.2
79
+ * Net::SSH[http://net-ssh.rubyforge.org/]
80
+ * Net::SCP[http://net-ssh.rubyforge.org/]
81
+ * amazon-ec2[http://github.com/grempe/amazon-ec2]
82
+ * aws-s3[http://github.com/marcel/aws-s3]
83
+ * Rye[http://github.com/delano/rye]
84
+ * Drydock[http://github.com/delano/drydock]
85
+ * Caesars[http://github.com/delano/caesars]
84
86
 
85
87
 
86
88
  == Common Errors
@@ -105,6 +107,7 @@ Although Rudy has been well tested and is currently being used in production in
105
107
 
106
108
  == More Info
107
109
 
110
+ * Rudy-Introduction[http://blog.solutious.com/2009/04/21/rudy-deployment-introduction/]
108
111
  * GitHub[http://github.com/solutious/rudy]
109
112
  * Issues[http://github.com/solutious/rudy/issues]
110
113
  * RubyForge[http://rubyforge.org/projects/rudy]
@@ -120,13 +123,13 @@ Although Rudy has been well tested and is currently being used in production in
120
123
  * Colin Brumelle
121
124
  * Everyone at Utrecht.rb[http://groups.google.com/group/utrecht-rb]
122
125
  * Jamis Buck for writing Net::SSH and friends.
126
+ * Keshia Knight Pulliam
123
127
 
124
128
 
125
129
  == Credits
126
130
 
127
131
  * Rudy::AWS::SDB adapted from aws_sdb by Tim Dysinger (http://dysinger.net)
128
132
  * Escape, Copyright (C) 2006,2007 Tanaka Akira <akr@fsij.org>
129
- * Keshia Knight Pulliam (rudy@solutious.com)
130
133
  * Delano Mandelbaum (delano@solutious.com)
131
134
 
132
135
 
data/bin/rudy CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
  $:.unshift File.join(File.dirname(__FILE__), '..', 'lib') # Put our local lib in first place
12
12
  $:.unshift File.join(File.dirname(__FILE__), '..', 'vendor', 'highline-1.5.1', 'lib')
13
- #%w{amazon-ec2 rye}.each { |dir| $:.unshift File.join(File.dirname(__FILE__), '..', '..', dir, 'lib') }
13
+ %w{amazon-ec2 drydock rye}.each { |dir| $:.unshift File.join(File.dirname(__FILE__), '..', '..', dir, 'lib') }
14
14
  #require 'rubygems'
15
15
 
16
16
  #$SAFE = 1 # require is unsafe in Ruby 1.9??
@@ -251,7 +251,7 @@ class RudyCLI < Rudy::CLI::Base
251
251
 
252
252
  # ------------------------------------------- UGLY STUFFS --------
253
253
  # ------------------------------------------------------------------
254
- debug :off
254
+ debug :on
255
255
  default :machines
256
256
 
257
257
 
@@ -272,6 +272,9 @@ rescue Rudy::Error => ex
272
272
  rescue => ex
273
273
  STDERR.puts "ERROR (#{ex.class.to_s}): #{ex.message}"
274
274
  STDERR.puts ex.backtrace if Drydock.debug?
275
+ rescue Interrupt
276
+ puts "#{$/}Exiting... "
277
+ exit 1
275
278
  rescue SystemExit
276
279
  # Don't balk
277
280
  end
data/bin/rudy-ec2 CHANGED
@@ -29,11 +29,11 @@ module RudyCLI_EC2
29
29
 
30
30
  desc "Amazon EC2 Elastic IP addresses"
31
31
  usage "rudy-ec2 addresses"
32
+ usage "rudy-ec2 addresses -C"
32
33
  usage "rudy-ec2 addresses -A -i instance-id address"
33
34
  usage "rudy-ec2 addresses -A -i instance-id -n"
34
35
  usage "rudy-ec2 addresses -N address"
35
36
  usage "rudy-ec2 addresses -D address"
36
- usage "rudy-ec2 addresses -C"
37
37
  option :i, :instance, String, "Instance ID"
38
38
  option :n, :newaddress, "Create and assign a new elastic IP"
39
39
  action :A, :associate, "Associate an IP address to a running instance"
@@ -98,8 +98,7 @@ module RudyCLI_EC2
98
98
  command_alias :groups, :g
99
99
 
100
100
  desc "Amazon EC2 Machine Images (AMIs)"
101
- usage "rudy-ec2 im"
102
- usage "rudy-ec2 image"
101
+ usage "rudy-ec2 images"
103
102
  usage "rudy-ec2 images image-id"
104
103
  usage "rudy-ec2 images -o 123456789012"
105
104
  usage "rudy-ec2 images -o amazon"
@@ -119,11 +118,9 @@ module RudyCLI_EC2
119
118
  command_alias :images, :im
120
119
 
121
120
  desc "Amazon EC2 Instances"
122
- usage "rudy-ec2 i"
123
- usage "rudy-ec2 instance"
124
121
  usage "rudy-ec2 instances"
125
122
  usage "rudy-ec2 instances [-g group-name] [instance-ID]"
126
- usage "rudy-ec2 instances -C -g group-name -s m1.small -k keypair-name"
123
+ usage "rudy-ec2 instances -C -m ami-235fba4a -s m1.small -k keypair-name"
127
124
  usage "rudy-ec2 instances -C -a 255.255.255.255 -k keypair-name"
128
125
  usage "rudy-ec2 instances -R instance-ID"
129
126
  usage "rudy-ec2 instances -D instance-ID"
@@ -204,6 +201,7 @@ module RudyCLI_EC2
204
201
  command_alias :volumes, :v
205
202
 
206
203
  desc "Availability Zones"
204
+ usage "rudy-ec2 zones"
207
205
  argv :name
208
206
  command :zones => Rudy::CLI::AWS::EC2::Zones
209
207
  command_alias :zones, :zone
@@ -234,6 +232,9 @@ rescue Rudy::Error => ex
234
232
  rescue => ex
235
233
  STDERR.puts "ERROR (#{ex.class.to_s}): #{ex.message}"
236
234
  STDERR.puts ex.backtrace if Drydock.debug?
235
+ rescue Interrupt
236
+ puts "#{$/}Exiting... "
237
+ exit 1
237
238
  rescue SystemExit
238
239
  # Don't balk
239
240
  end
data/bin/rudy-s3 CHANGED
@@ -69,6 +69,9 @@ rescue Rudy::Error => ex
69
69
  rescue => ex
70
70
  STDERR.puts "ERROR (#{ex.class.to_s}): #{ex.message}"
71
71
  STDERR.puts ex.backtrace if Drydock.debug?
72
+ rescue Interrupt
73
+ puts "#{$/}Exiting... "
74
+ exit 1
72
75
  rescue SystemExit
73
76
  # Don't balk
74
77
  end
data/bin/rudy-sdb CHANGED
@@ -59,6 +59,9 @@ rescue Rudy::Error => ex
59
59
  rescue => ex
60
60
  STDERR.puts "ERROR (#{ex.class.to_s}): #{ex.message}"
61
61
  STDERR.puts ex.backtrace if Drydock.debug?
62
+ rescue Interrupt
63
+ puts "#{$/}Exiting... "
64
+ exit 1
62
65
  rescue SystemExit
63
66
  # Don't balk
64
67
  end
data/lib/annoy.rb CHANGED
@@ -122,9 +122,7 @@ class Annoy
122
122
  #writer.flush
123
123
  #end
124
124
  #response = Annoy.get_response(writer)
125
-
126
- trap("SIGINT") { raise Annoy::GiveUp }
127
-
125
+
128
126
  highline = HighLine.new
129
127
  response = highline.ask(msg) { |q|
130
128
  q.echo = '*' # Don't display response
@@ -132,11 +130,14 @@ class Annoy
132
130
  q.whitespace = :strip # Remove whitespace from the response
133
131
  q.answer_type = Integer if flavor == :numeric
134
132
  }
135
-
133
+
136
134
  ret = (response == answer)
137
135
  writer.puts "Incorrect" unless ret
138
136
  ret
139
137
  end
138
+ rescue Interrupt
139
+ writer.puts $/, "Giving up!"
140
+ false
140
141
  rescue Annoy::GiveUp => ex
141
142
  writer.puts $/, "Giving up!"
142
143
  false
data/lib/rudy.rb CHANGED
@@ -65,7 +65,7 @@ module Rudy
65
65
  unless defined?(MAJOR)
66
66
  MAJOR = 0.freeze
67
67
  MINOR = 6.freeze
68
- TINY = 6.freeze
68
+ TINY = 7.freeze
69
69
  end
70
70
  def self.to_s; [MAJOR, MINOR, TINY].join('.'); end
71
71
  def self.to_f; self.to_s.to_f; end
@@ -131,7 +131,7 @@ module Rudy
131
131
  def sysinfo; @@sysinfo; end
132
132
 
133
133
  class Error < RuntimeError
134
- def initialize(obj); @obj = obj; end
134
+ def initialize(obj=nil); @obj = obj; end
135
135
  def message; "#{self.class}: #{@obj}"; end
136
136
  end
137
137
  class InsecureKeyPermissions < Rudy::Error
@@ -142,7 +142,16 @@ module Rudy
142
142
  end
143
143
  end
144
144
  class NoConfig < Rudy::Error
145
- def message; "No AWS credentials. Check your configs!"; end
145
+ def message; "No configuration found!"; end
146
+ end
147
+ class NoGlobal < Rudy::Error
148
+ def message; "No globals defined!"; end
149
+ end
150
+ class NoMachinesConfig < Rudy::Error
151
+ def message; "No machines configuration. Check your configs!"; end
152
+ end
153
+ class NoRoutinesConfig < Rudy::Error
154
+ def message; "No routines configuration. Check your configs!"; end
146
155
  end
147
156
  class ServiceUnavailable < Rudy::Error
148
157
  def message; "#{@obj} is not available. Check your internets!"; end
@@ -19,10 +19,8 @@ module Rudy::AWS
19
19
  field :reason
20
20
  field :groups => Array
21
21
 
22
- # Groups aren't returned when creating an instance so this
23
- # method returns an empty Array if +@groups+ is not set.
24
- def groups
25
- @groups || []
22
+ def init
23
+ @groups ||= []
26
24
  end
27
25
 
28
26
  def liner_note
@@ -11,6 +11,11 @@ module AWS; module EC2;
11
11
  end
12
12
  def status
13
13
  url = 'http://status.aws.amazon.com/rss/EC2.rss'
14
+
15
+ if (@@global.region || '').to_s.strip.match(/\Aeu/)
16
+ url = 'http://status.aws.amazon.com/rss/EC2EU.rss'
17
+ end
18
+
14
19
  # TODO: Move to Rudy::AWS
15
20
  ec2 = Rudy::Utils::RSSReader.run(url) || {}
16
21
 
@@ -21,14 +26,21 @@ module AWS; module EC2;
21
26
  require 'json'
22
27
  puts ec2.to_json
23
28
  else
24
- puts "Updated: #{ec2[:pubdate]} (updated every #{ec2[:ttl]} minutes)"
25
- ec2[:items].each do |i|
29
+ puts "#{ec2[:title]}"
30
+ puts "Updated: #{ec2[:pubdate]}"
31
+ (ec2[:items] || []).each do |i|
26
32
  puts
27
33
  puts '%s' % i[:title]
28
34
  puts ' %s: %s' % [i[:pubdate], i[:description]]
29
-
35
+ end
36
+ if ec2.empty? || ec2[:items].empty?
37
+ puts "No announcements"
38
+ return
30
39
  end
31
40
  end
41
+
42
+
43
+
32
44
  end
33
45
 
34
46
  def ssh_valid?
data/lib/rudy/huxtable.rb CHANGED
@@ -122,9 +122,10 @@ module Rudy
122
122
 
123
123
 
124
124
  def user_keypairpath(name)
125
- raise "No user provided" unless name
126
- raise "No configuration" unless @@config
127
- raise "No machines configuration" unless @@config.machines
125
+ raise Rudy::Error, "No user provided" unless name
126
+ raise NoConfig unless @@config
127
+ raise NoMachinesConfig unless @@config.machines
128
+ raise NoGlobal unless @@global
128
129
  zon, env, rol = @@global.zone, @@global.environment, @@global.role
129
130
  #Caesars.enable_debug
130
131
  path = @@config.machines.find_deferred(zon, env, rol, [:users, name, :keypair])
@@ -189,8 +190,8 @@ module Rudy
189
190
  end
190
191
 
191
192
  def current_machine_address(position='01')
192
- raise "No configuration" unless @@config
193
- raise "No machines configuration" unless @@config.machines
193
+ raise NoConfig unless @@config
194
+ raise NoMachinesConfig unless @@config.machines
194
195
  raise "Position cannot be nil" if position.nil?
195
196
  addresses = [fetch_machine_param(:addresses)].flatten.compact
196
197
  addresses[position.to_i-1]
@@ -232,6 +233,8 @@ module Rudy
232
233
  # at least one definition in the config for this to return true
233
234
  # That's how Rudy knows the current group is defined.
234
235
  def known_machine_group?
236
+ raise NoConfig unless @@config
237
+ raise NoMachinesConfig unless @@config.machines
235
238
  return false if !@@config && !@@global
236
239
  zon, env, rol = @@global.zone, @@global.environment, @@global.role
237
240
  conf = @@config.machines.find_deferred(@@global.region, zon, [env, rol])
@@ -265,9 +268,9 @@ module Rudy
265
268
  # :size: 1
266
269
  #
267
270
  def fetch_routine_config(action)
268
- raise "No configuration" unless @@config
269
- raise "No routines configuration" unless @@config.routines
270
- raise "No globals" unless @@global
271
+ raise NoConfig unless @@config
272
+ raise NoRoutinesConfig unless @@config.routines
273
+ raise NoGlobal unless @@global
271
274
 
272
275
  zon, env, rol = @@global.zone, @@global.environment, @@global.role
273
276
 
@@ -295,18 +298,18 @@ module Rudy
295
298
 
296
299
 
297
300
  def fetch_machine_param(parameter)
298
- raise "No configuration" unless @@config
299
- raise "No machines configuration" unless @@config.machines
300
- raise "No globals" unless @@global
301
+ raise NoConfig unless @@config
302
+ raise NoMachinesConfig unless @@config.machines
303
+ raise NoGlobal unless @@global
301
304
  top_level = @@config.machines.find(parameter)
302
305
  mc = fetch_machine_config
303
306
  mc[parameter] || top_level || nil
304
307
  end
305
308
 
306
309
  def fetch_machine_config
307
- raise "No configuration" unless @@config
308
- raise "No machines configuration" unless @@config.machines
309
- raise "No globals" unless @@global
310
+ raise NoConfig unless @@config
311
+ raise NoMachinesConfig unless @@config.machines
312
+ raise NoGlobal unless @@global
310
313
  zon, env, rol = @@global.zone, @@global.environment, @@global.role
311
314
  hashes = []
312
315
  hashes << @@config.machines.find(env, rol)
data/rudy.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  @spec = Gem::Specification.new do |s|
2
2
  s.name = "rudy"
3
3
  s.rubyforge_project = 'rudy'
4
- s.version = "0.6.6"
4
+ s.version = "0.6.7"
5
5
  s.summary = "Rudy: Not your grandparent's deployment tool."
6
6
  s.description = s.summary
7
7
  s.author = "Delano Mandelbaum"
@@ -14,9 +14,9 @@
14
14
  s.require_paths = %w[lib]
15
15
  s.rubygems_version = '1.1.1'
16
16
 
17
- s.add_dependency 'drydock', '>= 0.5.5'
17
+ s.add_dependency 'drydock', '>= 0.5.6'
18
18
  s.add_dependency 'caesars', '>= 0.5.4'
19
- s.add_dependency 'rye', '>= 0.5.3'
19
+ s.add_dependency 'rye', '>= 0.5.4'
20
20
 
21
21
  s.add_dependency 'echoe'
22
22
  s.add_dependency 'amazon-ec2', '>= 0.3.8' # Region fix
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rudy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.6
4
+ version: 0.6.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Delano Mandelbaum
@@ -20,7 +20,7 @@ dependencies:
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: 0.5.5
23
+ version: 0.5.6
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: caesars
@@ -40,7 +40,7 @@ dependencies:
40
40
  requirements:
41
41
  - - ">="
42
42
  - !ruby/object:Gem::Version
43
- version: 0.5.3
43
+ version: 0.5.4
44
44
  version:
45
45
  - !ruby/object:Gem::Dependency
46
46
  name: echoe