rudy 0.8.3 → 0.8.4

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
@@ -1,6 +1,16 @@
1
1
  RUDY, CHANGES
2
2
 
3
3
 
4
+ #### 0.8.4 (2009-06-04) ###############################
5
+
6
+ * FIXED: Fixed nil exception in fetch_machine_param
7
+ * CHANGE: Disabled check for private key for shutdown routine.
8
+ If the private key doesn't exist it prevents shutting down.
9
+ * CHANGE: Re-enabled the check to make sure command config is parsed only one time
10
+ * CHANGE: Some UI tweaks, some minor integration stuff with Rye
11
+ * CHANGE: Caesars::Config verbose mode is now enabled at Rudy verbose level 2
12
+
13
+
4
14
  #### 0.8.3 (2009-06-03) ###############################
5
15
 
6
16
  * CHANGE: Now requires rye-0.7.3 (disable_safe_mode method)
data/Rudyfile CHANGED
@@ -118,12 +118,12 @@ routines do
118
118
  after :rudy do # Run remote SSH commands after startup
119
119
  mkdir :p, 'great' # $ mkdir -p great
120
120
  touch 'great/scott' # $ touch great/scott
121
- ls :l, :a, '*' # $ ls -l -a *
121
+ ls :l, :a # $ ls -l -a *
122
122
  end
123
123
  end
124
124
 
125
125
  shutdown do # $ rudy shutdown
126
- script :root do # Run remote SSH commands before shutdown
126
+ before :root do # Run remote SSH commands before shutdown
127
127
  uptime
128
128
  end
129
129
  disks do
data/lib/rudy.rb CHANGED
@@ -38,7 +38,7 @@ module Rudy
38
38
  unless defined?(MAJOR)
39
39
  MAJOR = 0.freeze
40
40
  MINOR = 8.freeze
41
- TINY = 3.freeze
41
+ TINY = 4.freeze
42
42
  end
43
43
  def self.to_s; [MAJOR, MINOR, TINY].join('.'); end
44
44
  def self.to_f; self.to_s.to_f; end
@@ -6,7 +6,7 @@ module Rudy
6
6
  def open
7
7
  rmach = Rudy::Machines.new
8
8
  machines = rmach.list
9
- puts 1
9
+
10
10
  if machines
11
11
  `open http://#{machines.first.dns_public}`
12
12
  else
@@ -86,6 +86,8 @@ module Rudy
86
86
  lt.each do |machine|
87
87
  machine.update # make sure we have the latest DNS info
88
88
 
89
+ # mount -t ext3 /dev/sdr /rudy/disk1
90
+
89
91
  # Print header
90
92
  if @@global.quiet
91
93
  print "You are #{ssh_opts[:user].to_s.bright}. " if !checked # only the 1st
@@ -12,7 +12,7 @@ module Rudy; module CLI;
12
12
  machines = @rr.execute || []
13
13
  puts $/, "The following machines are now available:" unless machines.empty?
14
14
  machines.each do |machine|
15
- puts machine.to_s
15
+ puts @@global.verbose > 2 ? machine.inspect : machine.dump(@@global.format)
16
16
  end
17
17
  end
18
18
 
@@ -25,7 +25,7 @@ module Rudy; module CLI;
25
25
  machines = @rr.execute
26
26
  puts $/, "The following machines have been restarted:"
27
27
  machines.each do |machine|
28
- puts machine.to_s
28
+ puts @@global.verbose > 2 ? machine.inspect : machine.dump(@@global.format)
29
29
  end
30
30
  end
31
31
 
@@ -53,7 +53,7 @@ module Rudy; module CLI;
53
53
  unless machines.empty?
54
54
  puts $/, "The following machines were processed:"
55
55
  machines.each do |machine|
56
- puts @@global.verbose > 0 ? machine.inspect : machine.dump(@@global.format)
56
+ puts @@global.verbose > 2 ? machine.inspect : machine.dump(@@global.format)
57
57
  end
58
58
  end
59
59
 
@@ -20,6 +20,9 @@ class Rudy::Config
20
20
  # important that new keywords do not conflict with existing
21
21
  # Rudy keywords. Strange things may happen!
22
22
  class Commands < Caesars
23
+ class AlreadyDefined < Rudy::Config::Error
24
+ def message; "The command '#{@obj}' has already been defined for this project"; end
25
+ end
23
26
  class PathNotString < Rudy::Config::Error
24
27
  def message; super << " (path must be a String)"; end
25
28
  end
@@ -30,7 +33,11 @@ class Rudy::Config
30
33
  def message; "Arguments for #{cmd} must be: Symbols, Strings only"; end
31
34
  end
32
35
 
33
- @@processed = false
36
+ @@processed = false
37
+
38
+ ## Not used currently. May be revived.
39
+ ##@@allowed = [] ## Commands which have been processed
40
+
34
41
  forced_array :allow
35
42
  forced_array :deny
36
43
  chill :allow
@@ -53,6 +60,7 @@ class Rudy::Config
53
60
  def postprocess
54
61
  return false if @@processed
55
62
  @@processed = true # Make sure this runs only once
63
+
56
64
  # Parses:
57
65
  # commands do
58
66
  # allow :kill
@@ -65,6 +73,10 @@ class Rudy::Config
65
73
  self.allow.each do |cmd|
66
74
  cmd, *args = *cmd
67
75
 
76
+ ## Currently disabled
77
+ ##raise AlreadyDefined.new(:commands, cmd) if @@allowed.member?(cmd)
78
+ ##@@allowed << cmd
79
+
68
80
  # We can allow existing commands to be overridden but we
69
81
  # print a message to STDERR so the user knows what's up.
70
82
  STDERR.puts "Redefining #{cmd}" if Rye::Cmd.can?(cmd)
data/lib/rudy/huxtable.rb CHANGED
@@ -40,7 +40,7 @@ module Rudy
40
40
  #def logger; @@logger; end
41
41
 
42
42
  def self.update_config(path=nil)
43
- @@config.verbose = (@@global.verbose > 0)
43
+ @@config.verbose = (@@global.verbose > 1)
44
44
  # nil and bad paths sent to look_and_load are ignored
45
45
  @@config.look_and_load(path || @@global.config)
46
46
  @@global.apply_config(@@config)
@@ -332,7 +332,7 @@ module Rudy
332
332
  raise NoMachinesConfig if !@@config.machines
333
333
  raise NoGlobal unless @@global
334
334
  top_level = @@config.machines.find(parameter)
335
- mc = fetch_machine_config
335
+ mc = fetch_machine_config || {}
336
336
  mc[parameter] || top_level || nil
337
337
  end
338
338
 
data/lib/rudy/routines.rb CHANGED
@@ -140,7 +140,7 @@ module Rudy
140
140
  if !skip_check && has_remote_task?(routine)
141
141
  enjoy_every_sandwich {
142
142
  msg = preliminary_separator("Waiting for SSH daemon...")
143
- ret = Rudy::Utils.waiter(2, 1, STDOUT, msg, 0) {
143
+ ret = Rudy::Utils.waiter(2, 30, STDOUT, msg, 0) {
144
144
  Rudy::Utils.service_available?(machine.dns_public, 22)
145
145
  }
146
146
  is_available = ret
@@ -149,7 +149,7 @@ module Rudy
149
149
 
150
150
  if is_available
151
151
  # TODO: trap rbox errors. We could get an authentication error.
152
- opts = { :keys => root_keypairpath, :user => remote_user, :info => @@global.verbose > 0 }
152
+ opts = { :keys => root_keypairpath, :user => remote_user, :info => @@global.verbose > 3 }
153
153
  begin
154
154
  rbox = Rye::Box.new(machine.dns_public, opts)
155
155
  Rudy::Utils.waiter(2, 10, STDOUT, nil, 0) { rbox.connect }
@@ -337,7 +337,7 @@ module Rudy
337
337
  rescue => ex
338
338
  STDERR.puts " Error: #{ex.message}".color(:red)
339
339
  STDERR.puts ex.backtrace if Rudy.debug?
340
- choice = Annoy.get_user_input('(S)kip (R)etry (A)bort: ')
340
+ choice = Annoy.get_user_input('(S)kip (R)etry (A)bort: ') || ''
341
341
  if choice.match(/\AS/i)
342
342
  return
343
343
  elsif choice.match(/\AR/i)
@@ -13,7 +13,7 @@ module Rudy
13
13
  print_response(ret)
14
14
  rescue IOError => ex
15
15
  STDERR.puts " Connection Error (#{ex.message})".color(:red)
16
- choice = Annoy.get_user_input('(S)kip (R)etry (A)bort: ')
16
+ choice = Annoy.get_user_input('(S)kip (R)etry (A)bort: ') || ''
17
17
  if choice.match(/\AS/i)
18
18
  return
19
19
  elsif choice.match(/\AR/i)
@@ -23,7 +23,7 @@ module Rudy
23
23
  end
24
24
  rescue Rye::CommandError => ex
25
25
  print_response(ex)
26
- choice = Annoy.get_user_input('(S)kip (R)etry (A)bort: ')
26
+ choice = Annoy.get_user_input('(S)kip (R)etry (A)bort: ') || ''
27
27
  if choice.match(/\AS/i)
28
28
  return
29
29
  elsif choice.match(/\AR/i)
@@ -34,7 +34,7 @@ module Rudy
34
34
  rescue Rye::CommandNotFound => ex
35
35
  STDERR.puts " CommandNotFound: #{ex.message}".color(:red)
36
36
  STDERR.puts ex.backtrace if Rudy.debug?
37
- choice = Annoy.get_user_input('(S)kip (R)etry (A)bort: ')
37
+ choice = Annoy.get_user_input('(S)kip (R)etry (A)bort: ') || ''
38
38
  if choice.match(/\AS/i)
39
39
  return
40
40
  elsif choice.match(/\AR/i)
@@ -9,7 +9,7 @@ module Rudy; module Routines;
9
9
  extend self
10
10
 
11
11
  @@script_types = [:after, :before, :after_local, :before_local, :script, :script_local]
12
- @@script_config_file_name = "rudy-config.yml"
12
+
13
13
 
14
14
  # TODO: refactor using this_method
15
15
 
@@ -76,7 +76,7 @@ module Rudy; module Routines;
76
76
  return false unless hasconf
77
77
  unless routine[timing].kind_of?(Hash)
78
78
  STDERR.puts "No user supplied for #{timing} block".color(:red)
79
- choice = Annoy.get_user_input('(S)kip (A)bort: ')
79
+ choice = Annoy.get_user_input('(S)kip (A)bort: ') || ''
80
80
  if choice.match(/\AS/i)
81
81
  return
82
82
  else
@@ -104,15 +104,6 @@ module Rudy; module Routines;
104
104
  raise "ScriptHelper: Not a Rye::Box" unless rbox.is_a?(Rye::Box)
105
105
  raise "ScriptHelper: #{timing}?" unless @@script_types.member?(timing)
106
106
 
107
- # The config file that gets created on each remote machine
108
- # will be created in the user's home directory.
109
- script_config_remote_path = File.join(rbox.getenv['HOME'] || '', @@script_config_file_name)
110
-
111
- if sconf && !sconf.empty?
112
- tf = Tempfile.new(@@script_config_file_name)
113
- Rudy::Utils.write_to_file(tf.path, sconf.to_hash.to_yaml, 'w')
114
- end
115
-
116
107
  # Do we need to run this again? It's called in generic_routine_runner
117
108
  ##if execute_command?(timing, routine) # i.e. before_local?
118
109
 
@@ -140,18 +131,6 @@ module Rudy; module Routines;
140
131
  next
141
132
  end
142
133
 
143
- trap_rbox_errors {
144
- # We need to create the config file for every script,
145
- # b/c the user may change and it would not be accessible.
146
- # We turn off safe mode so we can write the config file via SSH.
147
- # This will need to use SCP eventually; it is unsafe and error prone.
148
- # TODO: Replace with rbox.upload. Make it safe again!
149
- conf_str = StringIO.new
150
- conf_str.puts sconf.to_hash.to_yaml
151
- rbox.upload(conf_str, script_config_remote_path)
152
- rbox.chmod(600, script_config_remote_path)
153
- }
154
-
155
134
  begin
156
135
  # We define hooks so we can still print each command and its output
157
136
  # when running the command blocks. NOTE: We only print this in
@@ -176,7 +155,7 @@ module Rudy; module Routines;
176
155
 
177
156
  rescue Rye::CommandError => ex
178
157
  print_response(ex)
179
- choice = Annoy.get_user_input('(S)kip (R)etry (A)bort: ')
158
+ choice = Annoy.get_user_input('(S)kip (R)etry (A)bort: ') || ''
180
159
  if choice.match(/\AS/i)
181
160
  return
182
161
  elsif choice.match(/\AR/i)
@@ -187,7 +166,7 @@ module Rudy; module Routines;
187
166
  rescue Rye::CommandNotFound => ex
188
167
  STDERR.puts " CommandNotFound: #{ex.message}".color(:red)
189
168
  STDERR.puts ex.backtrace if Rudy.debug?
190
- choice = Annoy.get_user_input('(S)kip (R)etry (A)bort: ')
169
+ choice = Annoy.get_user_input('(S)kip (R)etry (A)bort: ') || ''
191
170
  if choice.match(/\AS/i)
192
171
  return
193
172
  elsif choice.match(/\AR/i)
@@ -202,7 +181,6 @@ module Rudy; module Routines;
202
181
  end
203
182
 
204
183
  rbox.cd # reset to home dir
205
- rbox.rudy_tmp_rm(:f, script_config_remote_path) # -f to ignore errors
206
184
  end
207
185
 
208
186
  # Return the borrowed rbox instance to the user it was provided with
@@ -212,7 +190,6 @@ module Rudy; module Routines;
212
190
  ## puts "Nothing to do"
213
191
  ##end
214
192
 
215
- tf.delete # delete local copy of script config
216
193
 
217
194
  end
218
195
  end
@@ -8,7 +8,7 @@ module Rudy; module Routines;
8
8
  end
9
9
 
10
10
  def execute
11
- routine_separator(:shutdown)
11
+ routine_separator(:list)
12
12
  unless @routine
13
13
  STDERR.puts "[this is a generic shutdown routine]"
14
14
  @routine = {}
@@ -24,9 +24,11 @@ module Rudy; module Routines;
24
24
  def raise_early_exceptions
25
25
  rmach = Rudy::Machines.new
26
26
  raise MachineGroupNotRunning, current_machine_group unless rmach.running?
27
+ ## NOTE: This check is disabled for now. If the private key doesn't exist
28
+ ## it prevents shutting down.
27
29
  # Check private key after machine group, otherwise we could get an error
28
30
  # about there being no key which doesn't make sense if the group isn't running.
29
- raise Rudy::PrivateKeyNotFound, root_keypairpath unless has_keypair?(:root)
31
+ ##raise Rudy::PrivateKeyNotFound, root_keypairpath unless has_keypair?(:root)
30
32
  end
31
33
 
32
34
  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.8.3"
4
+ s.version = "0.8.4"
5
5
  s.summary = "Rudy: Not your grandparents' EC2 deployment tool."
6
6
  s.description = s.summary
7
7
  s.author = "Delano Mandelbaum"
@@ -15,17 +15,26 @@
15
15
  s.rubygems_version = '1.1.1'
16
16
 
17
17
  s.add_dependency 'drydock', '>= 0.6.3'
18
- s.add_dependency 'caesars', '>= 0.6.8'
19
- s.add_dependency 'rye', '>= 0.7.3'
18
+ s.add_dependency 'caesars', '>= 0.7.0'
19
+ s.add_dependency 'rye', '>= 0.7.4'
20
20
  s.add_dependency 'sysinfo', '>= 0.5.1'
21
21
  s.add_dependency 'storable', '>= 0.5.2'
22
- s.add_dependency 'annoy', '>= 0.5.1'
22
+ s.add_dependency 'annoy', '>= 0.5.2'
23
23
 
24
24
  s.add_dependency 'echoe'
25
25
  s.add_dependency 'amazon-ec2', '>= 0.3.8' # Region fix
26
26
  s.add_dependency 'aws-s3', '>= 0.6.1' # Ruby 1.9.1 compatability
27
27
  s.add_dependency 'highline', '>= 1.5.1'
28
28
 
29
+ # One of the other dependencies needs these gems but doesn't seem
30
+ # to specify them. Why I outta!
31
+ s.add_dependency 'archive-tar-minitar'
32
+ s.add_dependency 'nokogiri'
33
+ s.add_dependency 'racc'
34
+ s.add_dependency 'tenderlove-frex'
35
+ s.add_dependency 'hoe'
36
+
37
+ # libxml2 libxml2-dev libxslt-dev
29
38
 
30
39
  # http://bit.ly/2WaAgV
31
40
  #s.add_runtime_dependency('xml-simple', '>= 1.0.11')
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.8.3
4
+ version: 0.8.4
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: 2009-06-03 00:00:00 -04:00
12
+ date: 2009-06-04 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -30,7 +30,7 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 0.6.8
33
+ version: 0.7.0
34
34
  version:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: rye
@@ -40,7 +40,7 @@ dependencies:
40
40
  requirements:
41
41
  - - ">="
42
42
  - !ruby/object:Gem::Version
43
- version: 0.7.3
43
+ version: 0.7.4
44
44
  version:
45
45
  - !ruby/object:Gem::Dependency
46
46
  name: sysinfo
@@ -70,7 +70,7 @@ dependencies:
70
70
  requirements:
71
71
  - - ">="
72
72
  - !ruby/object:Gem::Version
73
- version: 0.5.1
73
+ version: 0.5.2
74
74
  version:
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: echoe
@@ -112,6 +112,56 @@ dependencies:
112
112
  - !ruby/object:Gem::Version
113
113
  version: 1.5.1
114
114
  version:
115
+ - !ruby/object:Gem::Dependency
116
+ name: archive-tar-minitar
117
+ type: :runtime
118
+ version_requirement:
119
+ version_requirements: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - ">="
122
+ - !ruby/object:Gem::Version
123
+ version: "0"
124
+ version:
125
+ - !ruby/object:Gem::Dependency
126
+ name: nokogiri
127
+ type: :runtime
128
+ version_requirement:
129
+ version_requirements: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ version: "0"
134
+ version:
135
+ - !ruby/object:Gem::Dependency
136
+ name: racc
137
+ type: :runtime
138
+ version_requirement:
139
+ version_requirements: !ruby/object:Gem::Requirement
140
+ requirements:
141
+ - - ">="
142
+ - !ruby/object:Gem::Version
143
+ version: "0"
144
+ version:
145
+ - !ruby/object:Gem::Dependency
146
+ name: tenderlove-frex
147
+ type: :runtime
148
+ version_requirement:
149
+ version_requirements: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - ">="
152
+ - !ruby/object:Gem::Version
153
+ version: "0"
154
+ version:
155
+ - !ruby/object:Gem::Dependency
156
+ name: hoe
157
+ type: :runtime
158
+ version_requirement:
159
+ version_requirements: !ruby/object:Gem::Requirement
160
+ requirements:
161
+ - - ">="
162
+ - !ruby/object:Gem::Version
163
+ version: "0"
164
+ version:
115
165
  description: "Rudy: Not your grandparents' EC2 deployment tool."
116
166
  email: delano@solutious.com
117
167
  executables: