rudy 0.9.3 → 0.9.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. data/CHANGES.txt +8 -1
  2. data/bin/rudy +4 -0
  3. data/bin/rudy-ec2 +1 -0
  4. data/lib/rudy/aws/ec2/group.rb +0 -2
  5. data/lib/rudy/aws/ec2.rb +4 -5
  6. data/lib/rudy/aws/sdb.rb +3 -3
  7. data/lib/rudy/cli/aws/ec2/addresses.rb +5 -5
  8. data/lib/rudy/cli/aws/ec2/candy.rb +16 -16
  9. data/lib/rudy/cli/aws/ec2/groups.rb +6 -6
  10. data/lib/rudy/cli/aws/ec2/images.rb +3 -3
  11. data/lib/rudy/cli/aws/ec2/info.rb +18 -18
  12. data/lib/rudy/cli/aws/ec2/instances.rb +15 -15
  13. data/lib/rudy/cli/aws/ec2/keypairs.rb +6 -6
  14. data/lib/rudy/cli/aws/ec2/snapshots.rb +1 -1
  15. data/lib/rudy/cli/aws/ec2/volumes.rb +10 -10
  16. data/lib/rudy/cli/backups.rb +5 -5
  17. data/lib/rudy/cli/base.rb +9 -9
  18. data/lib/rudy/cli/candy.rb +1 -1
  19. data/lib/rudy/cli/config.rb +6 -6
  20. data/lib/rudy/cli/disks.rb +5 -5
  21. data/lib/rudy/cli/images.rb +12 -12
  22. data/lib/rudy/cli/info.rb +9 -9
  23. data/lib/rudy/cli/keypairs.rb +5 -5
  24. data/lib/rudy/cli/machines.rb +26 -26
  25. data/lib/rudy/cli/metadata.rb +2 -2
  26. data/lib/rudy/cli/networks.rb +17 -8
  27. data/lib/rudy/cli/routines.rb +10 -10
  28. data/lib/rudy/config/objects.rb +1 -1
  29. data/lib/rudy/config.rb +2 -2
  30. data/lib/rudy/huxtable.rb +11 -5
  31. data/lib/rudy/machines.rb +4 -1
  32. data/lib/rudy/metadata/machine.rb +18 -9
  33. data/lib/rudy/routines/handlers/base.rb +6 -6
  34. data/lib/rudy/routines/handlers/disks.rb +9 -9
  35. data/lib/rudy/routines/handlers/group.rb +1 -1
  36. data/lib/rudy/routines/handlers/rye.rb +7 -5
  37. data/lib/rudy/routines/handlers/script.rb +2 -2
  38. data/lib/rudy/routines/passthrough.rb +11 -4
  39. data/lib/rudy/routines/reboot.rb +16 -5
  40. data/lib/rudy/routines/shutdown.rb +14 -5
  41. data/lib/rudy/routines/startup.rb +5 -6
  42. data/lib/rudy/routines.rb +4 -4
  43. data/lib/rudy/utils.rb +2 -2
  44. data/lib/rudy.rb +1 -1
  45. data/rudy.gemspec +1 -1
  46. metadata +2 -2
data/CHANGES.txt CHANGED
@@ -1,6 +1,14 @@
1
1
  RUDY, CHANGES
2
2
 
3
3
 
4
+ #### 0.9.4 (2009-08-28) ###########################
5
+
6
+ * FIXED: NoMachines exception when running various dependency scenarios
7
+ * CHANGE: All puts to STDOUT and STDERR now go through Rudy::Huxtable.li and Rudy::Huxtable.le. This resolves the issues with the output printing in quiet mode.
8
+ * CHANGE: Overhaul on output formatting.
9
+ * ADDED: "rudy networks --create" and "rudy networks --destroy"
10
+
11
+
4
12
  #### 0.9.3 (2009-08-26) ###########################
5
13
 
6
14
  * FIXED: Updated dependencies in gemspec (Rye)
@@ -8,7 +16,6 @@ RUDY, CHANGES
8
16
  connections. This resolves the issues with creating and authorizing
9
17
  a remote user then getting an authentication error.
10
18
 
11
-
12
19
  #### 0.9.2 (2009-08-25) ###########################
13
20
 
14
21
  * FIXED: Threading error in Net::HTTP by forcing a mutex during AWS::EC2 requests
data/bin/rudy CHANGED
@@ -107,6 +107,8 @@ class RudyCLI < Rudy::CLI::Base
107
107
 
108
108
  about "View Network configuration"
109
109
  usage "rudy networks"
110
+ usage "rudy networks -C"
111
+ usage "rudy networks -D"
110
112
  usage "rudy networks -L"
111
113
  usage "rudy networks -L -i"
112
114
  usage "rudy networks -L -e"
@@ -124,6 +126,8 @@ class RudyCLI < Rudy::CLI::Base
124
126
  option :o, :owner, String, "Other group owner ID (account number). Use with -g!"
125
127
  action :U, :update, "Update networks based on configuration"
126
128
  action :L, :local, "Show local network configuration"
129
+ action :C, :create, "Create the network security group"
130
+ action :D, :destroy, "Create the network security group"
127
131
  action :A, :authorize, "Authorize a rule for a network security group"
128
132
  action :R, :revoke, "Revoke a rule for a network security group"
129
133
  command :networks => Rudy::CLI::Networks
data/bin/rudy-ec2 CHANGED
@@ -20,6 +20,7 @@ require 'rudy/cli'
20
20
  module RudyCLI_EC2
21
21
  extend Drydock
22
22
 
23
+ debug :off
23
24
  default :instances
24
25
 
25
26
  # ----------------------------------- AMAZON EC2 COMMANDS --------
@@ -244,7 +244,6 @@ module Rudy::AWS
244
244
 
245
245
  def modify_rules(meth, name, addresses, ports, protocols, &each_group)
246
246
  list(name, &each_group) if each_group
247
-
248
247
  ports = [[22,22],[80,80],[443,443]] if !ports || ports.empty?
249
248
  protocols = ["tcp"] if !protocols || protocols.empty?
250
249
  addresses = [Rudy::Utils::external_ip_address] if !addresses || addresses.empty?
@@ -257,7 +256,6 @@ module Rudy::AWS
257
256
  addresses.each do |address|
258
257
  ports.each do |port|
259
258
  port_lo, port_hi = port.is_a?(Array) ? [port[0], port[1]] : [port, port]
260
- @logger.puts "#{meth} for ports #{port[0]}:#{port[1]} (#{protocol}) for #{addresses.join(', ')}" if @logger
261
259
  ret = modify_rule(meth, name, port[0].to_i, (port[1] || port[0]).to_i, protocol, address)
262
260
  raise "Unknown error during #{meth}" unless ret
263
261
  end
data/lib/rudy/aws/ec2.rb CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  module Rudy; module AWS
3
3
  module EC2
4
- # include Rudy::Huxtable
4
+ include Rudy::Huxtable
5
5
 
6
6
  @@mutex = Mutex.new
7
7
 
@@ -18,7 +18,6 @@ module Rudy; module AWS
18
18
  port ||= DEFAULT_EC2_PORT
19
19
 
20
20
  @@ec2 = ::AWS::EC2::Base.new(:port => port, :server=> host, :access_key_id => access_key, :secret_access_key => secret_key)
21
- @@logger = logger
22
21
  end
23
22
 
24
23
  protected
@@ -50,10 +49,10 @@ module Rudy; module AWS
50
49
  raise Rudy::AWS::Error, ex.message
51
50
 
52
51
  rescue Timeout::Error => ex
53
- STDERR.puts "Timeout (#{timeout}): #{ex.message}!"
52
+ Rudy::Huxtable.le "Timeout (#{timeout}): #{ex.message}!"
54
53
  rescue SocketError => ex
55
- #STDERR.puts ex.message
56
- #STDERR.puts ex.backtrace
54
+ #Rudy::Huxtable.le ex.message
55
+ #Rudy::Huxtable.le ex.backtrace
57
56
  raise SocketError, "Check your Internets!" unless @@global.offline
58
57
  ensure
59
58
  response ||= default
data/lib/rudy/aws/sdb.rb CHANGED
@@ -190,10 +190,10 @@ module Rudy
190
190
  end
191
191
 
192
192
  rescue Timeout::Error => ex
193
- STDERR.puts "Timeout (#{timeout}): #{ex.message}!"
193
+ Rudy::Huxtable.le "Timeout (#{timeout}): #{ex.message}!"
194
194
  rescue SocketError => ex
195
- #STDERR.puts ex.message
196
- #STDERR.puts ex.backtrace
195
+ #Rudy::Huxtable.le ex.message
196
+ #Rudy::Huxtable.le ex.backtrace
197
197
  raise SocketError, "Check your Internets!" unless Rudy::Huxtable.global.offline
198
198
  ensure
199
199
  response ||= default
@@ -20,8 +20,8 @@ module AWS; module EC2;
20
20
  address = Rudy::AWS::EC2::Addresses.get(@argv.ipaddress)
21
21
  raise "Could not fetch #{address.ipaddress}" unless address
22
22
 
23
- puts "Destroying address: #{@argv.ipaddress}"
24
- puts "NOTE: this IP address will become available to other EC2 customers.".bright
23
+ li "Destroying address: #{@argv.ipaddress}"
24
+ li "NOTE: this IP address will become available to other EC2 customers.".bright
25
25
  execute_check(:medium)
26
26
  execute_action { Rudy::AWS::EC2::Addresses.destroy(@argv.ipaddress) }
27
27
  end
@@ -37,7 +37,7 @@ module AWS; module EC2;
37
37
  if @option.newaddress
38
38
  print "Creating address... "
39
39
  tmp = Rudy::AWS::EC2::Addresses.create
40
- puts "#{tmp.ipaddress}"
40
+ li "#{tmp.ipaddress}"
41
41
  address = tmp.ipaddress
42
42
  else
43
43
  address = @argv.ipaddress
@@ -53,7 +53,7 @@ module AWS; module EC2;
53
53
  instance_name = instance.dns_public
54
54
  instance_name = instance.awsid if !instance_name || instance_name.empty?
55
55
 
56
- puts "Associating #{address} to #{instance_name} (#{instance.groups.join(', ')})"
56
+ li "Associating #{address} to #{instance_name} (#{instance.groups.join(', ')})"
57
57
  execute_check(:low)
58
58
  execute_action { Rudy::AWS::EC2::Addresses.associate(address, instance.awsid) }
59
59
  address = Rudy::AWS::EC2::Addresses.get(address)
@@ -71,7 +71,7 @@ module AWS; module EC2;
71
71
  address = Rudy::AWS::EC2::Addresses.get(@argv.ipaddress)
72
72
  instance = Rudy::AWS::EC2::Instances.get(address.instid)
73
73
 
74
- puts "Disassociating #{address.ipaddress} from #{instance.awsid} (#{instance.groups.join(', ')})"
74
+ li "Disassociating #{address.ipaddress} from #{instance.awsid} (#{instance.groups.join(', ')})"
75
75
  execute_check(:medium)
76
76
  execute_action { Rudy::AWS::EC2::Addresses.disassociate(@argv.ipaddress) }
77
77
  address = Rudy::AWS::EC2::Addresses.get(@argv.ipaddress)
@@ -21,20 +21,20 @@ module AWS; module EC2;
21
21
 
22
22
  # TODO: Create Storable object
23
23
  if @@global.format == 'yaml'
24
- puts ec2.to_yaml
24
+ li ec2.to_yaml
25
25
  elsif @@global.format == 'json'
26
26
  require 'json'
27
- puts ec2.to_json
27
+ li ec2.to_json
28
28
  else
29
- puts "#{ec2[:title]}"
30
- puts "Updated: #{ec2[:pubdate]}"
29
+ li "#{ec2[:title]}"
30
+ li "Updated: #{ec2[:pubdate]}"
31
31
  (ec2[:items] || []).each do |i|
32
- puts
33
- puts '%s' % i[:title]
34
- puts ' %s: %s' % [i[:pubdate], i[:description]]
32
+ li
33
+ li '%s' % i[:title]
34
+ li ' %s: %s' % [i[:pubdate], i[:description]]
35
35
  end
36
36
  if ec2.empty? || ec2[:items].empty?
37
- puts "No announcements"
37
+ li "No announcements"
38
38
  return
39
39
  end
40
40
  end
@@ -76,7 +76,7 @@ module AWS; module EC2;
76
76
  # session so we need to prepare the command and its arguments
77
77
  if @argv.first
78
78
  command, command_args = @argv.shift, @argv || []
79
- puts "#{command} #{command_args.join(' ')}" if @@global.verbose > 1
79
+ li "#{command} #{command_args.join(' ')}" if @@global.verbose > 1
80
80
 
81
81
  # otherwise, we'll open an ssh session or print command
82
82
  else
@@ -91,7 +91,7 @@ module AWS; module EC2;
91
91
  print "You are #{rye_opts[:user].bright}. " if !checked # only the 1st
92
92
  else
93
93
  print "Connecting #{rye_opts[:user].bright}@#{inst.dns_public} "
94
- puts "(#{inst.awsid}, groups: #{inst.groups.join(', ')})"
94
+ li "(#{inst.awsid}, groups: #{inst.groups.join(', ')})"
95
95
  end
96
96
 
97
97
  # Make sure we want to run this command on all instances
@@ -103,7 +103,7 @@ module AWS; module EC2;
103
103
  # Open the connection and run the command
104
104
  rbox = Rye::Box.new(inst.dns_public, rye_opts)
105
105
  ret = rbox.send(command, command_args)
106
- puts ret unless command == :interactive_ssh
106
+ li ret unless command == :interactive_ssh
107
107
  end
108
108
  end
109
109
 
@@ -162,7 +162,7 @@ module AWS; module EC2;
162
162
  print "You are #{rye_opts[:user].bright}. " if !checked # only the 1st
163
163
  else
164
164
  print "Connecting #{rye_opts[:user].bright}@#{inst.dns_public} "
165
- puts "(#{inst.awsid}, groups: #{inst.groups.join(', ')})"
165
+ li "(#{inst.awsid}, groups: #{inst.groups.join(', ')})"
166
166
  end
167
167
 
168
168
  # Make sure we want to run this command on all instances
@@ -190,12 +190,12 @@ module AWS; module EC2;
190
190
  paths.each do |path|
191
191
  from_paths << "#{user}@#{host}:#{path} "
192
192
  end
193
- #puts "Copying FROM remote TO this machine", $/
193
+ #li "Copying FROM remote TO this machine", $/
194
194
 
195
195
  else
196
196
  to_path = "#{user}@#{host}:#{to_path}"
197
197
  from_paths = paths.join(' ')
198
- #puts "Copying FROM this machine TO remote", $/
198
+ #li "Copying FROM this machine TO remote", $/
199
199
  end
200
200
 
201
201
 
@@ -203,8 +203,8 @@ module AWS; module EC2;
203
203
  cmd << "-i #{keypair}" if keypair
204
204
  cmd << " #{from_paths} #{to_path}"
205
205
 
206
- puts cmd if verbose
207
- printonly ? (puts cmd) : system(cmd)
206
+ li cmd if verbose
207
+ printonly ? (li cmd) : system(cmd)
208
208
  end
209
209
 
210
210
 
@@ -17,7 +17,7 @@ module AWS; module EC2;
17
17
  Rudy::AWS::EC2::Groups.create(@argv.name, @option.description, opts[:addresses], opts[:ports], opts[:protocols])
18
18
  }
19
19
  Rudy::AWS::EC2::Groups.list(@argv.name) do |group|
20
- puts @@global.verbose > 0 ? group.inspect : group.dump(@@global.format)
20
+ li @@global.verbose > 0 ? group.inspect : group.dump(@@global.format)
21
21
  end
22
22
  end
23
23
 
@@ -29,7 +29,7 @@ module AWS; module EC2;
29
29
  end
30
30
 
31
31
  def destroy_groups
32
- puts "Destroying group: #{@argv.name}"
32
+ li "Destroying group: #{@argv.name}"
33
33
  execute_check(:medium)
34
34
  execute_action { Rudy::AWS::EC2::Groups.destroy(@argv.name) }
35
35
  @argv.clear # so groups will print all other groups
@@ -45,7 +45,7 @@ module AWS; module EC2;
45
45
  opts = {}
46
46
  name = @option.all ? nil : @argv.name
47
47
  Rudy::AWS::EC2::Groups.list(name).each do |group|
48
- puts @@global.verbose > 0 ? group.inspect : group.dump(@@global.format)
48
+ li @@global.verbose > 0 ? group.inspect : group.dump(@@global.format)
49
49
  end
50
50
  end
51
51
 
@@ -72,12 +72,12 @@ module AWS; module EC2;
72
72
  opts = check_options
73
73
  if (@option.group || @option.owner)
74
74
  g = [opts[:owner], opts[:group]].join(':')
75
- puts "#{action.to_s.capitalize} access to #{@argv.name.bright} from #{g.bright}"
75
+ li "#{action.to_s.capitalize} access to #{@argv.name.bright} from #{g.bright}"
76
76
  else
77
77
  print "#{action.to_s.capitalize} access to #{@argv.name.bright}"
78
- puts " from #{opts[:addresses].join(', ').bright}"
78
+ li " from #{opts[:addresses].join(', ').bright}"
79
79
  print "on #{opts[:protocols].join(', ').bright} "
80
- puts "ports: #{opts[:ports].map { |p| "#{p.join(' to ').bright}" }.join(', ')}"
80
+ li "ports: #{opts[:ports].map { |p| "#{p.join(' to ').bright}" }.join(', ')}"
81
81
  end
82
82
  execute_check(:medium)
83
83
  execute_action {
@@ -17,7 +17,7 @@ module AWS; module EC2;
17
17
 
18
18
  unless @option.all
19
19
  @option.owner ||= 'amazon'
20
- puts "Images owned by #{@option.owner.bright}" unless @argv.awsid
20
+ li "Images owned by #{@option.owner.bright}" unless @argv.awsid
21
21
  end
22
22
 
23
23
  images = Rudy::AWS::EC2::Images.list(@option.owner, @argv) || []
@@ -31,7 +31,7 @@ module AWS; module EC2;
31
31
  true
32
32
  end
33
33
  def destroy_images
34
- puts Rudy::AWS::EC2::Images.deregister(@argv.ami) ? "Done" : "Unknown error"
34
+ li Rudy::AWS::EC2::Images.deregister(@argv.ami) ? "Done" : "Unknown error"
35
35
  end
36
36
 
37
37
  def register_images_valid?
@@ -41,7 +41,7 @@ module AWS; module EC2;
41
41
  true
42
42
  end
43
43
  def register_images
44
- puts Rudy::AWS::EC2::Images.register(@argv.first)
44
+ li Rudy::AWS::EC2::Images.register(@argv.first)
45
45
  end
46
46
 
47
47
 
@@ -14,47 +14,47 @@ module AWS; module EC2;
14
14
  process_region region
15
15
  end
16
16
  else
17
- puts $/, "Other regions: " << oregions.join(', ')
17
+ li $/, "Other regions: " << oregions.join(', ')
18
18
  end
19
19
  end
20
20
 
21
21
 
22
22
  private
23
23
  def process_region(region)
24
- puts " Region: %s %30s".att(:reverse) % [region, '']
25
- puts " Instances".bright
24
+ li " Region: %s %30s".att(:reverse) % [region, '']
25
+ li " Instances".bright
26
26
  istatus = @option.all ? :any : :running
27
27
  (Rudy::AWS::EC2::Instances.list(istatus) || []).collect do |inst|
28
- #puts " %s (%s): %s; %s; %s" % [inst.awsid, inst.state, inst.dns_public || '[no dns]', inst.size, inst.created]
29
- puts " #{inst.to_s.noatt}"
28
+ #li " %s (%s): %s; %s; %s" % [inst.awsid, inst.state, inst.dns_public || '[no dns]', inst.size, inst.created]
29
+ li " #{inst.to_s.noatt}"
30
30
  end
31
31
 
32
- puts " Volumes".bright
32
+ li " Volumes".bright
33
33
  (Rudy::AWS::EC2::Volumes.list || []).collect do |vol|
34
- puts " %s (%s): %sGB; %s" % [vol.awsid, vol.instid || vol.status, vol.size, vol.created]
34
+ li " %s (%s): %sGB; %s" % [vol.awsid, vol.instid || vol.status, vol.size, vol.created]
35
35
  end
36
36
 
37
- puts " Snapshots".bright
37
+ li " Snapshots".bright
38
38
  (Rudy::AWS::EC2::Snapshots.list || []).collect do |snap|
39
- puts " %s: %s; %s" % [snap.awsid, snap.volid, snap.created]
39
+ li " %s: %s; %s" % [snap.awsid, snap.volid, snap.created]
40
40
  end
41
41
 
42
- puts " Addresses".bright
42
+ li " Addresses".bright
43
43
  (Rudy::AWS::EC2::Addresses.list || []).collect do |o|
44
- puts " %s (%s)" % [o.ipaddress, o.instid || 'available']
44
+ li " %s (%s)" % [o.ipaddress, o.instid || 'available']
45
45
  end
46
46
 
47
- puts " Groups".bright
48
- puts (Rudy::AWS::EC2::Groups.list || []).collect { |o| " #{o.name}" }
47
+ li " Groups".bright
48
+ li (Rudy::AWS::EC2::Groups.list || []).collect { |o| " #{o.name}" }
49
49
 
50
- puts " Keypairs".bright
51
- puts (Rudy::AWS::EC2::Keypairs.list || []).collect { |o| " #{o.name}" }
50
+ li " Keypairs".bright
51
+ li (Rudy::AWS::EC2::Keypairs.list || []).collect { |o| " #{o.name}" }
52
52
 
53
- puts " Images".bright
53
+ li " Images".bright
54
54
  (Rudy::AWS::EC2::Images.list('self') || []).collect do |o|
55
- puts " %s: %s; %s; %s" % [o.awsid, o.location, o.arch, o.visibility]
55
+ li " %s: %s; %s; %s" % [o.awsid, o.location, o.arch, o.visibility]
56
56
  end
57
- puts
57
+ li
58
58
  end
59
59
 
60
60
  end
@@ -47,11 +47,11 @@ module AWS; module EC2;
47
47
  opts[n] = @option.send(n) if @option.send(n)
48
48
  end
49
49
 
50
- puts "Creating #{opts[:size]} instance in #{@@global.zone}"
50
+ li "Creating #{opts[:size]} instance in #{@@global.zone}"
51
51
 
52
52
  unless opts[:keypair]
53
- puts "You did not specify a keypair. Unless you've prepared a user account".bright
54
- puts "on this image (#{opts[:ami]}) you will not be able to log in to it.".bright
53
+ li "You did not specify a keypair. Unless you've prepared a user account".bright
54
+ li "on this image (#{opts[:ami]}) you will not be able to log in to it.".bright
55
55
  exit unless Annoy.proceed?(:low)
56
56
  end
57
57
 
@@ -59,14 +59,14 @@ module AWS; module EC2;
59
59
 
60
60
  if instances && instances.size > 0
61
61
  instance_count = (instances.size == 1) ? 'is 1 instance' : "are #{instances.size} instances"
62
- puts "There #{instance_count} running in the #{opts[:group]} group."
62
+ li "There #{instance_count} running in the #{opts[:group]} group."
63
63
  exit unless Annoy.proceed?(:low)
64
64
  end
65
65
 
66
66
  if @option.newaddress
67
67
  print "Creating address... "
68
68
  address = Rudy::AWS::EC2::Addresses.create
69
- puts "#{address.ipaddress}"
69
+ li "#{address.ipaddress}"
70
70
  @option.address = address.ipaddress
71
71
  end
72
72
 
@@ -76,7 +76,7 @@ module AWS; module EC2;
76
76
 
77
77
  # Assign IP address to only the first instance
78
78
  if first_instance && @option.address
79
- puts "Associating #{@option.address} to #{inst.awsid}"
79
+ li "Associating #{@option.address} to #{inst.awsid}"
80
80
  Rudy::AWS::EC2::Addresses.associate(@option.address, inst.awsid)
81
81
  first_instance = false
82
82
  end
@@ -128,7 +128,7 @@ module AWS; module EC2;
128
128
  opts[:id] &&= [opts[:id]].flatten
129
129
 
130
130
  lt = Rudy::AWS::EC2::Instances.list_group(opts[:group], :any, opts[:id]) do |inst|
131
- puts instance_separator(inst.dns_public || inst.state, inst.awsid)
131
+ li instance_separator(inst.dns_public || inst.state, inst.awsid)
132
132
  console = Rudy::AWS::EC2::Instances.console(inst.awsid)
133
133
  output = console ? Base64.decode64(console) : "Unavailable"
134
134
 
@@ -137,20 +137,20 @@ module AWS; module EC2;
137
137
  # clear specifically. Otherwise the display is messed!
138
138
  output &&= output.noansi
139
139
 
140
- puts output
140
+ li output
141
141
 
142
142
  if output.match(/<Password>(.+)<\/Password>/m) # /m, match multiple lines
143
- puts
143
+ li
144
144
  if @@global.pkey
145
145
  encrtypted_text = ($1 || '').strip
146
146
  k = Rye::Key.from_file(@@global.pkey)
147
147
  pword = k.decrypt(encrtypted_text)
148
148
  answer = "%s: %s" % ['password', pword]
149
149
  Annoy.timed_display(answer, STDERR, 10)
150
- puts
150
+ li
151
151
  else
152
- puts "Please supply a private key path to decode the administrator password"
153
- puts "rudy-ec2 -k path/2/privatekey console [-g group] [instance ID]"
152
+ li "Please supply a private key path to decode the administrator password"
153
+ li "rudy-ec2 -k path/2/privatekey console [-g group] [instance ID]"
154
154
  end
155
155
  end
156
156
 
@@ -172,9 +172,9 @@ module AWS; module EC2;
172
172
 
173
173
  opts[:id] = @argv.instid if @argv.instid
174
174
  opts[:id] &&= [opts[:id]].flatten
175
-
175
+
176
176
  ilist = Rudy::AWS::EC2::Instances.list_group(opts[:group], opts[:state], opts[:id])
177
- ilist.nil? ? puts( "No instances running" ) : print_stobjects(ilist)
177
+ ilist.nil? ? li( "No instances running" ) : print_stobjects(ilist)
178
178
  end
179
179
  alias :instances :status
180
180
 
@@ -198,7 +198,7 @@ module AWS; module EC2;
198
198
 
199
199
  print "#{action.to_s.capitalize} #{instance_count} (#{inst_names.join(', ')}) "
200
200
  print "in #{opts[:group]}" if opts[:group]
201
- puts
201
+ li
202
202
  execute_check(:medium)
203
203
 
204
204
  execute_action("#{action.to_s.capitalize} Failed") {
@@ -12,11 +12,11 @@ module AWS; module EC2;
12
12
  def create_keypairs
13
13
  kp = execute_action { Rudy::AWS::EC2::Keypairs.create(@argv.name) }
14
14
  if [:s, :string].member?(@@global.format)
15
- puts "Name: #{kp.name}"
16
- puts "Fingerprint: #{kp.fingerprint}", $/
17
- puts "Copy the following private key data into a file."
18
- puts "Set the permissions to 0600 and keep it safe.", $/
19
- puts kp.private_key
15
+ li "Name: #{kp.name}"
16
+ li "Fingerprint: #{kp.fingerprint}", $/
17
+ li "Copy the following private key data into a file."
18
+ li "Set the permissions to 0600 and keep it safe.", $/
19
+ li kp.private_key
20
20
  else
21
21
  print_stobject kp
22
22
  end
@@ -29,7 +29,7 @@ module AWS; module EC2;
29
29
  def destroy_keypairs
30
30
  raise "Keypair #{@argv.name} does not exist" unless Rudy::AWS::EC2::Keypairs.exists?(@argv.name)
31
31
  kp = Rudy::AWS::EC2::Keypairs.get(@argv.name)
32
- puts "Destroying: #{kp.name}"
32
+ li "Destroying: #{kp.name}"
33
33
  execute_check(:medium)
34
34
  execute_action { Rudy::AWS::EC2::Keypairs.destroy(kp.name) }
35
35
  end
@@ -23,7 +23,7 @@ module AWS; module EC2;
23
23
  true
24
24
  end
25
25
  def destroy_snapshots
26
- puts "Destroying: #{@snap.awsid}"
26
+ li "Destroying: #{@snap.awsid}"
27
27
  execute_check(:medium)
28
28
  execute_action { Rudy::AWS::EC2::Snapshots.destroy(@snap.awsid) }
29
29
  end
@@ -12,12 +12,12 @@ module AWS; module EC2;
12
12
  true
13
13
  end
14
14
  def volumes_create
15
- puts "Creating #{@option.size}GB volume in #{@@global.zone}"
15
+ li "Creating #{@option.size}GB volume in #{@@global.zone}"
16
16
  execute_check(:low)
17
17
  vol = execute_action("Create Failed") {
18
18
  Rudy::AWS::EC2::Volumes.create(@option.size, @@global.zone, @option.snapshot)
19
19
  }
20
- puts @global.verbose > 1 ? vol.inspect : vol.dump(@@global.format)
20
+ li @global.verbose > 1 ? vol.inspect : vol.dump(@@global.format)
21
21
  end
22
22
 
23
23
 
@@ -39,13 +39,13 @@ module AWS; module EC2;
39
39
  raise "Volume #{@volume.awsid} is still attached" if @volume.attached?
40
40
  raise "Volume #{@volume.awsid} is not available (#{@volume.state})" unless @volume.available?
41
41
 
42
- puts "Destroying #{@volume.awsid}"
42
+ li "Destroying #{@volume.awsid}"
43
43
  execute_check(:medium)
44
44
  execute_action("Destroy Failed") { Rudy::AWS::EC2::Volumes.destroy(@volume.awsid) }
45
45
 
46
46
  vol = Rudy::AWS::EC2::Volumes.get(@volume.awsid)
47
47
 
48
- puts @global.verbose > 1 ? vol.inspect : vol.dump(@@global.format)
48
+ li @global.verbose > 1 ? vol.inspect : vol.dump(@@global.format)
49
49
  end
50
50
 
51
51
 
@@ -60,14 +60,14 @@ module AWS; module EC2;
60
60
  raise "Volume #{@argv.volid} is already attached" if Rudy::AWS::EC2::Volumes.attached?(@argv.volid)
61
61
  raise "Instance #{@option.instance} does not exist" unless Rudy::AWS::EC2::Instances.exists?(@option.instance)
62
62
 
63
- puts "Attaching #{@argv.volid} to #{@option.instance} on #{@option.device}"
63
+ li "Attaching #{@argv.volid} to #{@option.instance} on #{@option.device}"
64
64
  execute_check(:low)
65
65
  execute_action("Attach Failed") {
66
66
  Rudy::AWS::EC2::Volumes.attach(@argv.volid, @option.instance, @option.device)
67
67
  }
68
68
 
69
69
  vol = Rudy::AWS::EC2::Volumes.get(@argv.volid)
70
- puts @global.verbose > 1 ? vol.inspect : vol.dump(@@global.format)
70
+ li @global.verbose > 1 ? vol.inspect : vol.dump(@@global.format)
71
71
  end
72
72
 
73
73
  def volumes_detach_valid?
@@ -80,21 +80,21 @@ module AWS; module EC2;
80
80
  vol = Rudy::AWS::EC2::Volumes.get(@argv.volid)
81
81
  raise "Volume #{vol.awsid} is not attached" unless vol.attached?
82
82
 
83
- puts "Detaching #{vol.awsid} from #{vol.instid}"
83
+ li "Detaching #{vol.awsid} from #{vol.instid}"
84
84
  execute_check(:medium)
85
85
  execute_action("Detach Failed") { Rudy::AWS::EC2::Volumes.detach(vol.awsid) }
86
86
 
87
87
  vol = Rudy::AWS::EC2::Volumes.get(vol.awsid)
88
- puts @global.verbose > 1 ? vol.inspect : vol.dump(@@global.format)
88
+ li @global.verbose > 1 ? vol.inspect : vol.dump(@@global.format)
89
89
  end
90
90
 
91
91
 
92
92
  def volumes
93
93
  volumes = Rudy::AWS::EC2::Volumes.list || []
94
94
  volumes.each do |vol|
95
- puts @global.verbose > 1 ? vol.inspect : vol.dump(@@global.format)
95
+ li @global.verbose > 1 ? vol.inspect : vol.dump(@@global.format)
96
96
  end
97
- puts "No volumes" if volumes.empty?
97
+ li "No volumes" if volumes.empty?
98
98
  end
99
99
 
100
100
  end
@@ -13,12 +13,12 @@ module Rudy
13
13
  def backups_wash
14
14
  dirt = (get_backups || []).select { |b| !b.snapshot_exists? }
15
15
  if dirt.empty?
16
- puts "Nothing to wash in #{current_machine_group}"
16
+ li "Nothing to wash in #{current_machine_group}"
17
17
  return
18
18
  end
19
19
 
20
- puts "The following backup metadata will be deleted:"
21
- puts dirt.collect {|b| b.name }
20
+ li "The following backup metadata will be deleted:"
21
+ li dirt.collect {|b| b.name }
22
22
 
23
23
  execute_check(:medium)
24
24
 
@@ -38,9 +38,9 @@ module Rudy
38
38
 
39
39
  def backups_create
40
40
  @dlist.each do |d|
41
- puts "Creating backup for #{d.name}"
41
+ li "Creating backup for #{d.name}"
42
42
  back = d.archive
43
- puts back
43
+ li back
44
44
  end
45
45
  end
46
46