rudy 0.9.7.001 → 0.9.8.001

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES.txt CHANGED
@@ -10,6 +10,10 @@ Creating volume...
10
10
  (S)kip (A)bort:
11
11
 
12
12
 
13
+ #### 0.9.7.002 (2010-04-02) ###############################
14
+
15
+ * ADDED: Support for specifying non-ec2 instances in machines config with hostname parameter
16
+
13
17
  #### 0.9.7 (2010-02-20) ###############################
14
18
 
15
19
  * FIXED: Replace the group_id parameter with security_group. [Diego Elio 'Flameeyes' Pettenò]
@@ -5,8 +5,8 @@ module Rudy::AWS
5
5
  module EC2
6
6
 
7
7
  class Address < Storable
8
- field :ipaddress
9
- field :instid
8
+ field :ipaddress => String
9
+ field :instid => String
10
10
 
11
11
  def liner_note
12
12
  info = self.associated? ? @instid : "available"
@@ -133,7 +133,7 @@ module Rudy::AWS
133
133
  # Returns true if the given address is assigned to the current account
134
134
  def exists?(address)
135
135
  address = address.ipaddress if address.is_a?(Rudy::AWS::EC2::Address)
136
- list.each do |a|
136
+ (list || []).each do |a|
137
137
  return true if a.ipaddress == address
138
138
  end
139
139
  false
@@ -143,7 +143,7 @@ module Rudy::AWS
143
143
  # Returns true if the given address is associated to an instance
144
144
  def associated?(address)
145
145
  address = address.ipaddress if address.is_a?(Rudy::AWS::EC2::Address)
146
- list.each do |a|
146
+ (list || []).each do |a|
147
147
  return true if a.ipaddress == address && a.instid
148
148
  end
149
149
  false
@@ -4,15 +4,15 @@ module Rudy::AWS
4
4
  class EC2::Image < Storable
5
5
  @@sformat = " -> %8s; %12s; %12s; %12s; %8s"
6
6
 
7
- field :awsid
8
- field :owner
9
- field :aki
10
- field :ari
11
- field :state
12
- field :arch
13
- field :visibility
14
- field :location
15
- field :kind
7
+ field :awsid => String
8
+ field :owner => String
9
+ field :aki => String
10
+ field :ari => String
11
+ field :state => String
12
+ field :arch => String
13
+ field :visibility => String
14
+ field :location => String
15
+ field :kind => String
16
16
 
17
17
  def to_s(with_title=false)
18
18
  [@awsid.bright, @arch, @visibility, @location].join '; '
@@ -4,20 +4,20 @@
4
4
  module Rudy::AWS
5
5
  class EC2::Instance < Storable
6
6
  @@sformat = " -> %10s; %10s; %12s; %10s; groups: %s"
7
- field :aki
8
- field :ari
9
7
  field :launch_index => Time
10
- field :created
11
- field :keyname
12
- field :size
13
- field :ami
14
- field :dns_private
15
- field :dns_public
16
- field :awsid
17
- field :state
18
- field :zone
19
- field :reason
20
8
  field :groups => Array
9
+ field :aki => String
10
+ field :ari => String
11
+ field :created => String
12
+ field :keyname => String
13
+ field :size => String
14
+ field :ami => String
15
+ field :dns_private => String
16
+ field :dns_public => String
17
+ field :awsid => String
18
+ field :state => String
19
+ field :zone => String
20
+ field :reason => String
21
21
 
22
22
  def init
23
23
  @groups ||= []
@@ -4,9 +4,9 @@ module Rudy::AWS
4
4
 
5
5
  class Keypair < Storable
6
6
 
7
- field :name
8
- field :fingerprint
9
- field :private_key
7
+ field :name => String
8
+ field :fingerprint => String
9
+ field :private_key => String
10
10
 
11
11
  def to_s(titles=false)
12
12
  [@name.bright, @fingerprint].join '; '
@@ -5,13 +5,13 @@ module Rudy::AWS
5
5
  class Volume < Storable
6
6
  @@sformat = "%s %10s;%4sGB; %s " # cram the terabyte
7
7
 
8
- field :awsid
9
- field :status
10
8
  field :size => Integer
11
- field :snapid
12
9
  field :zone => Symbol
13
10
  field :created => Time
14
11
  field :attached => Time
12
+ field :awsid
13
+ field :status
14
+ field :snapid
15
15
  field :instid
16
16
  field :device
17
17
 
@@ -41,7 +41,10 @@ module AWS; module EC2;
41
41
 
42
42
  li "Destroying #{@volume.awsid}"
43
43
  execute_check(:medium)
44
- execute_action("Destroy Failed") { Rudy::AWS::EC2::Volumes.destroy(@volume.awsid) }
44
+ execute_action("Destroy Failed") {
45
+ Rudy::AWS::EC2::Volumes.destroy(@volume.awsid)
46
+ true
47
+ }
45
48
 
46
49
  vol = Rudy::AWS::EC2::Volumes.get(@volume.awsid)
47
50
 
data/lib/rudy/cli/base.rb CHANGED
@@ -107,8 +107,8 @@ module Rudy::CLI
107
107
  def print_stobject(obj, noverbose=false)
108
108
  format = @@global.format
109
109
  format = :yaml if @@global.verbose > 0 && @@global.format == :string
110
- format = :string if noverbose
111
- li obj.dump(format)
110
+ format = :string if noverbose || format.to_s == "s"
111
+ li String === obj ? obj.dump : obj.dump(format)
112
112
  end
113
113
 
114
114
  def machine_separator(name, awsid)
@@ -243,16 +243,24 @@ module Rudy
243
243
 
244
244
  rset = Rye::Set.new(current_machine_group, :parallel => @global.parallel)
245
245
  lt.each do |machine|
246
- machine.refresh! # make sure we have the latest DNS info
247
- rbox = Rye::Box.new(machine.dns_public, rye_opts)
248
- rbox.nickname = machine.name
246
+ if Rudy::Machine === machine
247
+ machine.refresh! # make sure we have the latest DNS info
248
+ rbox = Rye::Box.new(machine.dns_public, rye_opts)
249
+ rbox.nickname = machine.name
250
+ instid = machine.instid
251
+ else
252
+ rbox = Rye::Box.new(machine, rye_opts)
253
+ rbox.nickname = machine
254
+ instid = ''
255
+ end
256
+
249
257
  if command == :interactive_ssh
250
258
  # Print header
251
259
  if @@global.quiet
252
260
  print "You are #{rye_opts[:user].to_s.bright}. " if !checked # only the 1st
253
261
  else
254
- li machine_separator(machine.name, machine.instid)
255
- li "Connecting #{rye_opts[:user].to_s.bright}@#{machine.dns_public} "
262
+ li machine_separator(rbox.nickname, instid)
263
+ li "Connecting #{rye_opts[:user].to_s.bright}@#{rbox.host} "
256
264
  li
257
265
  end
258
266
  else
data/lib/rudy/global.rb CHANGED
@@ -9,6 +9,7 @@ module Rudy
9
9
  # be added to this class (optional: a default value in initialize).
10
10
  class Global < Storable
11
11
 
12
+ field :config => String
12
13
  field :region
13
14
  field :zone
14
15
  field :environment
@@ -41,7 +42,6 @@ module Rudy
41
42
  field :offline
42
43
  field :bucket
43
44
 
44
- field :config => String
45
45
 
46
46
  attr_accessor :print_header
47
47
 
data/lib/rudy/machines.rb CHANGED
@@ -16,6 +16,13 @@ module Rudy
16
16
  tmp.from_hash record
17
17
  end
18
18
 
19
+ def self.list(*args, &blk)
20
+ machs = super(*args, &blk) || []
21
+ manual = [fetch_machine_param(:hostname)].flatten.compact
22
+ manual.reject! { |m| m.is_a?(Symbol) }
23
+ machs.push *manual
24
+ machs
25
+ end
19
26
  def find_next_position
20
27
  raise "reimplement by looking at position values"
21
28
  list = Rudy::Machines.list({}, [:position]) || []
@@ -68,18 +75,6 @@ module Rudy
68
75
  def from_hash(h)
69
76
  Rudy::Machine.from_hash h
70
77
  end
71
-
72
-
73
-
74
-
75
- class UnknownRecordType < Rudy::Error
76
- def message; "Unknown record type: #{@obj}"; end
77
- end
78
- class UnknownObject < Rudy::Error
79
- def message; "Unknown object: #{@obj}"; end
80
- end
81
- # Raised when trying to save a record with a key that already exists
82
- class DuplicateRecord < Rudy::Error; end
83
78
 
84
79
  end
85
80
 
@@ -6,23 +6,23 @@ module Rudy
6
6
  include Rudy::Metadata
7
7
  include Gibbler::Complex
8
8
 
9
- field :rtype
10
- field :snapid
11
- field :volid
12
-
13
- field :path
14
-
15
9
  field :created => Time
16
- field :year
17
- field :month
18
- field :day
19
- field :hour
20
- field :minute
21
- field :second
22
-
23
- field :user
24
- field :size
25
- field :fstype
10
+ field :rtype => String
11
+ field :snapid => String
12
+ field :volid => String
13
+
14
+ field :path => String
15
+
16
+ field :year => String
17
+ field :month => String
18
+ field :day => String
19
+ field :hour => String
20
+ field :minute => String
21
+ field :second => String
22
+
23
+ field :user => String
24
+ field :size => String
25
+ field :fstype => String
26
26
 
27
27
  # If one argument is supplied:
28
28
  # * +path+ is a an absolute filesystem path
@@ -5,26 +5,26 @@ module Rudy
5
5
  include Rudy::Metadata
6
6
  include Gibbler::Complex
7
7
 
8
- field :rtype
9
- field :volid
10
- field :status
11
- field :instid
8
+ field :created => Time
9
+ field :rtype => String
10
+ field :volid => String
11
+ field :status => String
12
+ field :instid => String
12
13
 
13
- field :path
14
+ field :path => String
14
15
 
15
- field :device
16
- field :size
17
- field :fstype
16
+ field :device => String
17
+ field :size => String
18
+ field :fstype => String
18
19
 
19
- field :name # Windows, used for label
20
- field :index # Windows, used for diskpart
20
+ field :name => String# Windows, used for label
21
+ field :index => String# Windows, used for diskpart
21
22
 
22
23
  #field :backups => Array
23
24
 
24
25
  # Is the associated volume formatted? One of: true, false
25
- field :raw
26
- field :mounted
27
- field :created => Time
26
+ field :raw => String
27
+ field :mounted => String
28
28
 
29
29
  # If one argument is supplied:
30
30
  # * +path+ is a an absolute filesystem path
@@ -9,30 +9,30 @@ module Rudy
9
9
  include Rudy::Metadata
10
10
  include Gibbler::Complex
11
11
 
12
- field :rtype
13
- field :instid
14
-
15
- field :region
16
- field :zone
17
- field :environment
18
- field :role
19
- field :position
20
-
21
- field :size
22
- field :ami
23
- field :group
24
- field :keypair
25
- field :address
26
-
27
12
  field :created => Time
28
13
  field :started => Time
29
14
 
30
- field :dns_public
31
- field :dns_private
32
- field :state
33
-
34
- field :os
35
- field :impl
15
+ field :rtype => String
16
+ field :instid => String
17
+
18
+ field :region => Symbol
19
+ field :zone => Symbol
20
+ field :environment => Symbol
21
+ field :role => Symbol
22
+ field :position => Integer
23
+
24
+ field :size => String
25
+ field :ami => String
26
+ field :group => String
27
+ field :keypair => String
28
+ field :address => String
29
+
30
+ field :dns_public => String
31
+ field :dns_private => String
32
+ field :state => String
33
+
34
+ field :os => Symbol
35
+ field :impl => Symbol
36
36
 
37
37
  attr_reader :instance
38
38
 
data/lib/rudy/metadata.rb CHANGED
@@ -118,7 +118,7 @@ module Rudy
118
118
  fields = Rudy::Metadata.build_criteria self::RTYPE, fields, less
119
119
  records_raw, records = Rudy::Metadata.select(fields), []
120
120
  return nil if records_raw.nil? || records_raw.empty?
121
- records_raw.each_pair do |p, r|
121
+ records_raw.each_pair do |key, r|
122
122
  obj = self.from_hash r
123
123
  records << obj
124
124
  end
@@ -232,6 +232,19 @@ module Rudy
232
232
  !Rudy::Metadata.get(self.name).nil?
233
233
  end
234
234
 
235
+
236
+
237
+
238
+
239
+ class UnknownRecordType < Rudy::Error
240
+ def message; "Unknown record type: #{@obj}"; end
241
+ end
242
+ class UnknownObject < Rudy::Error
243
+ def message; "Unknown object: #{@obj}"; end
244
+ end
245
+ # Raised when trying to save a record with a key that already exists
246
+ class DuplicateRecord < Rudy::Error; end
247
+
235
248
  end
236
249
  autoload :Backup, 'rudy/metadata/backup'
237
250
  autoload :Disk, 'rudy/metadata/disk'
@@ -11,7 +11,7 @@ module Rudy; module Routines;
11
11
 
12
12
  def execute
13
13
  Rudy::Routines::Handlers::Depends.execute_all @before
14
- li " Executing routine: #{@name} ".att(:reverse)
14
+ li " Executing routine: #{@name} ".att(:reverse), ""
15
15
  # Re-retreive the machine set to reflect dependency changes
16
16
  Rudy::Routines.rescue {
17
17
  @machines = Rudy::Machines.list || []
@@ -30,7 +30,7 @@ module Rudy; module Routines;
30
30
  if run?
31
31
  Rudy::Routines::Handlers::Depends.execute_all @before
32
32
 
33
- li " Executing routine: #{@name} ".att(:reverse)
33
+ li " Executing routine: #{@name} ".att(:reverse), ""
34
34
  ld "[this is a generic routine]" if @routine.empty?
35
35
 
36
36
  # Re-retreive the machine set to reflect dependency changes
@@ -34,7 +34,7 @@ module Rudy; module Routines;
34
34
 
35
35
  Rudy::Routines::Handlers::Depends.execute_all @before
36
36
 
37
- li " Executing routine: #{@name} ".att(:reverse)
37
+ li " Executing routine: #{@name} ".att(:reverse), ""
38
38
  ld "[this is a generic routine]" if @routine.empty?
39
39
 
40
40
  # Re-retreive the machine set to reflect dependency changes
@@ -24,7 +24,7 @@ module Rudy; module Routines;
24
24
  if run?
25
25
  Rudy::Routines::Handlers::Depends.execute_all @before
26
26
 
27
- li " Executing routine: #{@name} ".att(:reverse)
27
+ li " Executing routine: #{@name} ".att(:reverse), ""
28
28
  ld "[this is a generic routine]" if @routine.empty?
29
29
 
30
30
  if @routine.has_key? :before_local
@@ -113,7 +113,7 @@ module Rudy; module Routines;
113
113
  if run? && !@@global.force
114
114
  if @@global.position.nil?
115
115
  raise MachineGroupAlreadyRunning, current_machine_group if Rudy::Machines.running?
116
- raise MachineGroupMetadataExists, current_machine_group if Rudy::Machines.exists?
116
+ #raise MachineGroupMetadataExists, current_machine_group if Rudy::Machines.exists?
117
117
  else
118
118
  if Rudy::Machines.running? @@global.position
119
119
  m = Rudy::Machine.new @@global.position
data/lib/rudy/routines.rb CHANGED
@@ -87,7 +87,7 @@ module Rudy
87
87
  def self.runner(routine, rset, lbox, argv=nil)
88
88
  routine.each_pair do |name,definition|
89
89
  handler = Rudy::Routines.get_handler name
90
- Rudy::Huxtable.li " #{name}:".bright
90
+ #Rudy::Huxtable.li " #{name}:".bright
91
91
  self.rescue {
92
92
  handler.execute(name, definition, rset, lbox, argv)
93
93
  }
data/lib/rudy.rb CHANGED
@@ -4,9 +4,9 @@ unless defined?(RUDY_HOME)
4
4
  RUDY_LIB = File.join(File.dirname(__FILE__), '..', 'lib')
5
5
  end
6
6
 
7
- #local_libs = %w{net-ssh net-scp aws-s3 caesars drydock rye storable sysinfo annoy gibbler}
8
- #local_libs.each { |dir| $:.unshift File.join(RUDY_HOME, '..', dir, 'lib') }
9
- #require 'rubygems'
7
+ local_libs = %w{net-ssh net-scp aws-s3 caesars drydock rye storable sysinfo annoy gibbler}
8
+ local_libs.each { |dir| $:.unshift File.join(RUDY_HOME, '..', dir, 'lib') }
9
+ require 'rubygems'
10
10
 
11
11
  begin; require 'json'; rescue LoadError; end # Silence!
12
12
 
@@ -43,8 +43,8 @@ module Rudy
43
43
  unless defined?(MAJOR)
44
44
  MAJOR = 0.freeze
45
45
  MINOR = 9.freeze
46
- TINY = 7.freeze
47
- PATCH = '001'.freeze
46
+ TINY = 8.freeze
47
+ PATCH = '001'.freeze
48
48
  end
49
49
  def self.to_s; [MAJOR, MINOR, TINY, PATCH].join('.'); end
50
50
  def self.to_f; self.to_s.to_f; end
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.9.7.001"
4
+ s.version = "0.9.8.001"
5
5
  s.summary = "Rudy: Not your grandparents' EC2 deployment tool."
6
6
  s.description = s.summary
7
7
  s.author = "Delano Mandelbaum"
@@ -16,18 +16,19 @@
16
16
 
17
17
  s.executables = %w[rudy rudy-ec2 rudy-sdb rudy-s3]
18
18
 
19
- s.add_dependency 'rye', '>= 0.8.11'
19
+ s.add_dependency 'rye', '>= 0.8.15'
20
+ s.add_dependency 'storable', '>= 0.7.1'
20
21
  s.add_dependency 'attic', '>= 0.5.2'
21
22
  s.add_dependency 'annoy', '>= 0.5.6'
22
23
  s.add_dependency 'drydock', '>= 0.6.9'
23
24
  s.add_dependency 'caesars', '>= 0.7.4'
24
25
  s.add_dependency 'sysinfo', '>= 0.7.3'
25
- s.add_dependency 'gibbler', '>= 0.7.4'
26
- s.add_dependency 'storable', '>= 0.6.3'
26
+ s.add_dependency 'gibbler', '>= 0.7.7'
27
+ s.add_dependency 'storable', '>= 0.6.5'
27
28
 
28
29
  s.add_dependency 'aws-s3', '>= 0.6.1'
29
30
  s.add_dependency 'highline', '>= 1.5.1'
30
- s.add_dependency 'amazon-ec2', '>= 0.9.4'
31
+ s.add_dependency 'amazon-ec2', '>= 0.9.10'
31
32
 
32
33
  s.add_development_dependency 'tryouts', '>= 0.8.8'
33
34
 
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.9.7.001
4
+ version: 0.9.8.001
5
5
  platform: ruby
6
6
  authors:
7
7
  - Delano Mandelbaum
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-02-20 00:00:00 -05:00
12
+ date: 2010-04-04 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -20,7 +20,17 @@ dependencies:
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: 0.8.11
23
+ version: 0.8.15
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: storable
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.7.1
24
34
  version:
25
35
  - !ruby/object:Gem::Dependency
26
36
  name: attic
@@ -80,7 +90,7 @@ dependencies:
80
90
  requirements:
81
91
  - - ">="
82
92
  - !ruby/object:Gem::Version
83
- version: 0.7.4
93
+ version: 0.7.7
84
94
  version:
85
95
  - !ruby/object:Gem::Dependency
86
96
  name: storable
@@ -90,7 +100,7 @@ dependencies:
90
100
  requirements:
91
101
  - - ">="
92
102
  - !ruby/object:Gem::Version
93
- version: 0.6.3
103
+ version: 0.6.5
94
104
  version:
95
105
  - !ruby/object:Gem::Dependency
96
106
  name: aws-s3
@@ -120,7 +130,7 @@ dependencies:
120
130
  requirements:
121
131
  - - ">="
122
132
  - !ruby/object:Gem::Version
123
- version: 0.9.4
133
+ version: 0.9.10
124
134
  version:
125
135
  - !ruby/object:Gem::Dependency
126
136
  name: tryouts