solutious-rudy 0.7.3 → 0.7.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES.txt +28 -5
- data/README.rdoc +1 -1
- data/Rudyfile +51 -19
- data/bin/ird +153 -0
- data/bin/rudy +18 -23
- data/bin/rudy-ec2 +5 -10
- data/bin/rudy-s3 +1 -3
- data/bin/rudy-sdb +0 -2
- data/examples/README.md +10 -0
- data/examples/debian-sinatra-passenger/commands.rb +19 -0
- data/examples/debian-sinatra-passenger/machines.rb +32 -0
- data/examples/debian-sinatra-passenger/routines.rb +30 -0
- data/examples/debian-sinatra-thin/commands.rb +17 -0
- data/examples/debian-sinatra-thin/machines.rb +35 -0
- data/examples/debian-sinatra-thin/routines.rb +72 -0
- data/lib/rudy.rb +8 -17
- data/lib/rudy/aws.rb +1 -2
- data/lib/rudy/aws/ec2/address.rb +0 -1
- data/lib/rudy/aws/ec2/snapshot.rb +11 -0
- data/lib/rudy/aws/s3.rb +6 -3
- data/lib/rudy/cli.rb +12 -2
- data/lib/rudy/cli/aws/ec2/candy.rb +19 -48
- data/lib/rudy/cli/aws/ec2/images.rb +109 -122
- data/lib/rudy/cli/aws/s3/buckets.rb +1 -2
- data/lib/rudy/cli/config.rb +13 -0
- data/lib/rudy/cli/disks.rb +24 -1
- data/lib/rudy/cli/routines.rb +10 -11
- data/lib/rudy/config.rb +6 -9
- data/lib/rudy/config/objects.rb +4 -0
- data/lib/rudy/global.rb +4 -5
- data/lib/rudy/huxtable.rb +23 -8
- data/lib/rudy/machines.rb +11 -4
- data/lib/rudy/metadata.rb +8 -94
- data/lib/rudy/metadata/backup.rb +113 -0
- data/lib/rudy/metadata/backups.rb +65 -0
- data/lib/rudy/{disks.rb → metadata/disk.rb} +36 -69
- data/lib/rudy/metadata/disks.rb +67 -0
- data/lib/rudy/metadata/objectbase.rb +104 -0
- data/lib/rudy/mixins.rb +2 -0
- data/lib/rudy/routines.rb +173 -88
- data/lib/rudy/routines/helpers/dependshelper.rb +34 -0
- data/lib/rudy/routines/helpers/diskhelper.rb +174 -5
- data/lib/rudy/routines/helpers/scmhelper.rb +2 -2
- data/lib/rudy/routines/helpers/scripthelper.rb +11 -4
- data/lib/rudy/routines/passthrough.rb +3 -1
- data/lib/rudy/routines/reboot.rb +75 -0
- data/lib/rudy/routines/startup.rb +3 -3
- data/lib/rudy/scm/git.rb +17 -17
- data/lib/rudy/scm/svn.rb +46 -5
- data/lib/rudy/utils.rb +3 -2
- data/rudy.gemspec +24 -46
- data/test/30_sdb_metadata/10_disks_test.rb +5 -5
- metadata +35 -67
- data/lib/annoy.rb +0 -298
- data/lib/console.rb +0 -404
- data/lib/escape.rb +0 -305
- data/lib/rudy/backup.rb +0 -135
- data/lib/storable.rb +0 -292
- data/lib/sysinfo.rb +0 -285
- data/lib/tryouts.rb +0 -33
- data/vendor/highline-1.5.1/CHANGELOG +0 -222
- data/vendor/highline-1.5.1/INSTALL +0 -35
- data/vendor/highline-1.5.1/LICENSE +0 -7
- data/vendor/highline-1.5.1/README +0 -63
- data/vendor/highline-1.5.1/Rakefile +0 -82
- data/vendor/highline-1.5.1/TODO +0 -6
- data/vendor/highline-1.5.1/examples/ansi_colors.rb +0 -38
- data/vendor/highline-1.5.1/examples/asking_for_arrays.rb +0 -18
- data/vendor/highline-1.5.1/examples/basic_usage.rb +0 -75
- data/vendor/highline-1.5.1/examples/color_scheme.rb +0 -32
- data/vendor/highline-1.5.1/examples/limit.rb +0 -12
- data/vendor/highline-1.5.1/examples/menus.rb +0 -65
- data/vendor/highline-1.5.1/examples/overwrite.rb +0 -19
- data/vendor/highline-1.5.1/examples/page_and_wrap.rb +0 -322
- data/vendor/highline-1.5.1/examples/password.rb +0 -7
- data/vendor/highline-1.5.1/examples/trapping_eof.rb +0 -22
- data/vendor/highline-1.5.1/examples/using_readline.rb +0 -17
- data/vendor/highline-1.5.1/lib/highline.rb +0 -758
- data/vendor/highline-1.5.1/lib/highline/color_scheme.rb +0 -120
- data/vendor/highline-1.5.1/lib/highline/compatibility.rb +0 -17
- data/vendor/highline-1.5.1/lib/highline/import.rb +0 -43
- data/vendor/highline-1.5.1/lib/highline/menu.rb +0 -395
- data/vendor/highline-1.5.1/lib/highline/question.rb +0 -463
- data/vendor/highline-1.5.1/lib/highline/system_extensions.rb +0 -193
- data/vendor/highline-1.5.1/setup.rb +0 -1360
- data/vendor/highline-1.5.1/test/tc_color_scheme.rb +0 -56
- data/vendor/highline-1.5.1/test/tc_highline.rb +0 -823
- data/vendor/highline-1.5.1/test/tc_import.rb +0 -54
- data/vendor/highline-1.5.1/test/tc_menu.rb +0 -429
- data/vendor/highline-1.5.1/test/ts_all.rb +0 -15
@@ -64,7 +64,7 @@ module AWS; module EC2;
|
|
64
64
|
opts[:group] = :any if @option.all
|
65
65
|
opts[:id] = @option.instid if @option.instid
|
66
66
|
|
67
|
-
# Options to be sent to
|
67
|
+
# Options to be sent to Rye::Box
|
68
68
|
ssh_opts = { :user => @global.user || Rudy.sysinfo.user, :debug => nil }
|
69
69
|
if @@global.pkey
|
70
70
|
raise "Cannot find file #{@@global.pkey}" unless File.exists?(@@global.pkey)
|
@@ -124,12 +124,13 @@ module AWS; module EC2;
|
|
124
124
|
opts[:id] = @argv.shift if Rudy::Utils.is_id?(:instance, @argv.first)
|
125
125
|
opts[:id] &&= [opts[:id]].flatten
|
126
126
|
|
127
|
-
#
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
127
|
+
# Options to be sent to Net::SSH
|
128
|
+
ssh_opts = { :user => @global.user || Rudy.sysinfo.user, :debug => nil }
|
129
|
+
if @@global.pkey
|
130
|
+
raise "Cannot find file #{@@global.pkey}" unless File.exists?(@@global.pkey)
|
131
|
+
raise InsecureKeyPermissions, @@global.pkey unless File.stat(@@global.pkey).mode == 33152
|
132
|
+
ssh_opts[:keys] = @@global.pkey
|
133
|
+
end
|
133
134
|
|
134
135
|
opts[:paths] = @argv
|
135
136
|
opts[:dest] = opts[:paths].pop
|
@@ -139,14 +140,16 @@ module AWS; module EC2;
|
|
139
140
|
opts[:task] ||= :upload
|
140
141
|
opts[:user] = @global.user || Rudy.sysinfo.user
|
141
142
|
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
if @@global.pkey
|
143
|
+
|
144
|
+
# Options to be sent to Rye::Box
|
145
|
+
info = @@global.quiet ? nil : STDERR
|
146
|
+
ssh_opts = { :user => @global.user || Rudy.sysinfo.user, :info => info }
|
147
|
+
if @@global.pkey
|
147
148
|
raise "Cannot find file #{@@global.pkey}" unless File.exists?(@@global.pkey)
|
148
|
-
raise
|
149
|
+
raise InsecureKeyPermissions, @@global.pkey unless File.stat(@@global.pkey).mode == 33152
|
150
|
+
ssh_opts[:keys] = @@global.pkey
|
149
151
|
end
|
152
|
+
|
150
153
|
|
151
154
|
checked = false
|
152
155
|
rudy = Rudy::AWS::EC2::Instances.new(@@global.accesskey, @@global.secretkey, @@global.region)
|
@@ -171,46 +174,14 @@ module AWS; module EC2;
|
|
171
174
|
checked = true
|
172
175
|
end
|
173
176
|
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
:chunk_size => 16384
|
178
|
-
}
|
179
|
-
|
180
|
-
Candy.scp(opts[:task], inst.dns_public, opts[:user], @@global.pkey, opts[:paths], opts[:dest], scp_opts)
|
181
|
-
puts
|
182
|
-
puts unless @@global.quiet
|
177
|
+
# Open the connection and run the command
|
178
|
+
rbox = Rye::Box.new(inst.dns_public, ssh_opts)
|
179
|
+
rbox.send(opts[:task], opts[:paths], opts[:dest])
|
183
180
|
end
|
184
181
|
|
185
182
|
end
|
186
183
|
|
187
184
|
|
188
|
-
private
|
189
|
-
|
190
|
-
def Candy.scp(task, host, user, keypairpath, paths, dest, opts)
|
191
|
-
|
192
|
-
connect_opts = {}
|
193
|
-
connect_opts[:keys] = [keypairpath] if keypairpath
|
194
|
-
|
195
|
-
Net::SCP.start(host, user, connect_opts) do |scp|
|
196
|
-
|
197
|
-
paths.each do |path|
|
198
|
-
prev_path = nil
|
199
|
-
scp.send("#{task}", path, dest, opts) do |ch, name, sent, total|
|
200
|
-
#print "#{name}: #{sent}/#{total}\r"
|
201
|
-
msg = ((prev_path == name) ? "\r" : "\n") # new line for new file
|
202
|
-
msg << "#{name}: #{sent}/#{total}" # otherwise, update the same line
|
203
|
-
print msg
|
204
|
-
STDOUT.flush # update the screen every cycle
|
205
|
-
prev_path = name
|
206
|
-
break if sent == total
|
207
|
-
end
|
208
|
-
puts unless prev_path == path
|
209
|
-
end
|
210
|
-
|
211
|
-
end
|
212
|
-
end
|
213
|
-
|
214
185
|
|
215
186
|
|
216
187
|
end
|
@@ -33,161 +33,148 @@ module AWS; module EC2;
|
|
33
33
|
puts "No images" if images.empty?
|
34
34
|
end
|
35
35
|
|
36
|
-
def prepare_images_valid?
|
37
|
-
|
38
|
-
end
|
39
|
-
def prepare_images
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
end
|
36
|
+
##def prepare_images_valid?
|
37
|
+
## true
|
38
|
+
##end
|
39
|
+
##def prepare_images
|
40
|
+
## opts = {}
|
41
|
+
## opts[:id] = @option.instid if @option.instid
|
42
|
+
##
|
43
|
+
## puts "This will do the following:"
|
44
|
+
## puts "- Clear bash history"
|
45
|
+
## # NOTE: We can't delete the host keys here. Otherwise we can't create the image.
|
46
|
+
## #puts "- Delete host SSH keys (this is permanent!)"
|
47
|
+
## puts ""
|
48
|
+
##
|
49
|
+
## ## TODO:
|
50
|
+
## ## ~/.rudy, /etc/motd, history -c, /etc/hosts, /var/log/rudy*
|
51
|
+
##
|
52
|
+
## execute_check(:medium)
|
53
|
+
##
|
54
|
+
##
|
55
|
+
## # Options to be sent to Net::SSH
|
56
|
+
## ssh_opts = { :user => @global.user || Rudy.sysinfo.user, :debug => STDERR }
|
57
|
+
## if @@global.pkey
|
58
|
+
## raise "Cannot find file #{@@global.pkey}" unless File.exists?(@@global.pkey)
|
59
|
+
## raise InsecureKeyPermissions, @@global.pkey unless File.stat(@@global.pkey).mode == 33152
|
60
|
+
## ssh_opts[:keys] = @@global.pkey
|
61
|
+
## end
|
62
|
+
##
|
63
|
+
##
|
64
|
+
## rudy = Rudy::AWS::EC2::Instances.new(@@global.accesskey, @@global.secretkey, @@global.region)
|
65
|
+
## lt = rudy.list_group(nil, :running, opts[:id]) do |inst|
|
66
|
+
##
|
67
|
+
## puts "Preparing #{inst.dns_public}..."
|
68
|
+
##
|
69
|
+
## # Open the connection and run the command
|
70
|
+
## rbox = Rye::Box.new(inst.dns_public, ssh_opts)
|
71
|
+
##
|
72
|
+
## # We need to explicitly add the rm command for rbox so we
|
73
|
+
## # can delete the SSH host keys. This is will force the instance
|
74
|
+
## # to re-create it's SSH keys on first boot.
|
75
|
+
## def rbox.rm(*args); cmd('rm', args); end
|
76
|
+
## p ret = rbox.history(:c)
|
77
|
+
## p ret.exit_code
|
78
|
+
## p ret.stderr
|
79
|
+
## p ret.stdout
|
80
|
+
##
|
81
|
+
## end
|
82
|
+
##
|
83
|
+
## puts "done"
|
84
|
+
##end
|
82
85
|
|
83
86
|
def create_images_valid?
|
84
87
|
raise "No account number" unless @@global.accountnum
|
85
88
|
raise "No Amazon cert-***.pem" unless @@global.cert
|
86
89
|
raise "No Amazon pk-***.pem" unless @@global.privatekey
|
90
|
+
raise "You must supply a root keypair path" unless @@global.pkey
|
91
|
+
|
92
|
+
@rinst = Rudy::AWS::EC2::Instances.new(@@global.accesskey, @@global.secretkey, @@global.region)
|
93
|
+
@rimages = Rudy::AWS::EC2::Images.new(@@global.accesskey, @@global.secretkey, @@global.region)
|
94
|
+
@s3 = Rudy::AWS::S3.new(@@global.accesskey, @@global.secretkey, @@global.region)
|
95
|
+
raise "No instances" unless @rinst.any?
|
96
|
+
raise "You must supply an S3 bucket name. See: 'rudy-s3 buckets'" unless @option.bucket
|
97
|
+
raise "You must supply an image name" unless @option.name
|
98
|
+
raise "The bucket '#{@option.bucket}' does not exist" unless @s3.bucket_exists?(@option.bucket)
|
87
99
|
true
|
88
100
|
end
|
89
101
|
|
90
102
|
def create_images
|
91
103
|
opts = {}
|
92
|
-
opts[:group] = @option.group if @option.group
|
93
|
-
opts[:group] = :any if @option.all
|
94
104
|
opts[:id] = @option.instid if @option.instid
|
95
105
|
|
96
|
-
|
97
|
-
puts "This feature is experimental. Make sure you enter the bucket"
|
98
|
-
puts "and image names correctly because if they're wrong the image"
|
99
|
-
puts "won't get created and you'll be annoyed that you waited."
|
106
|
+
@@global.user = 'root'
|
100
107
|
|
108
|
+
puts "You may want to run rudy-ec2 #{@alias} --prepare first".bright
|
109
|
+
puts "NOTE 1: This process is currently Linux-only"
|
110
|
+
puts "NOTE 2: If you plan to create a public machine image, there are "
|
111
|
+
puts "additional steps to take to remove any sensitive information"
|
112
|
+
puts "before creating the image. See:"
|
113
|
+
puts "http://docs.amazonwebservices.com/AWSEC2/latest/DeveloperGuide/AESDG-chapter-sharingamis.html"
|
114
|
+
exit unless Annoy.pose_question(" Continue?\a ", /yes|y|ya|sure|you bet!/i, STDERR)
|
115
|
+
|
101
116
|
# Options to be sent to Net::SSH
|
102
|
-
ssh_opts = { :user =>
|
117
|
+
ssh_opts = { :user => @@global.user || Rudy.sysinfo.user, :debug => nil }
|
103
118
|
if @@global.pkey
|
104
119
|
raise "Cannot find file #{@@global.pkey}" unless File.exists?(@@global.pkey)
|
105
120
|
raise InsecureKeyPermissions, @@global.pkey unless File.stat(@@global.pkey).mode == 33152
|
106
121
|
ssh_opts[:keys] = @@global.pkey
|
107
122
|
end
|
108
123
|
|
109
|
-
|
110
|
-
print "Enter the image name: "
|
111
|
-
@option.image_name = gets.chomp
|
112
|
-
end
|
113
|
-
|
114
|
-
unless @option.bucket
|
115
|
-
print "Enter the S3 bucket that will store the image: "
|
116
|
-
@option.bucket_name = gets.chomp
|
117
|
-
end
|
118
|
-
|
119
|
-
execute_check(:medium)
|
120
|
-
|
121
|
-
rudy = Rudy::AWS::EC2::Instances.new(@@global.accesskey, @@global.secretkey, @@global.region)
|
122
|
-
lt = rudy.list_group(opts[:group], :running, opts[:id]) do |inst|
|
124
|
+
lt = @rinst.list_group(nil, :running, opts[:id]) do |inst|
|
123
125
|
|
124
|
-
puts inst.
|
126
|
+
puts inst.to_s
|
125
127
|
|
126
128
|
# Open the connection and run the command
|
127
129
|
rbox = Rye::Box.new(inst.dns_public, ssh_opts)
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
cert = File.read(@@global.cert)
|
133
|
-
pk = File.read(@@global.privatekey)
|
134
|
-
rbox.safe = false
|
135
|
-
rbox.echo("'#{cert}' > /mnt/cert-temporary.pem")
|
136
|
-
rbox.echo("'#{pk}' > /mnt/pk-temporary.pem")
|
137
|
-
rbox.safe = true
|
130
|
+
def rbox.bundle_vol(*args); cmd('ec2-bundle-vol', args); end
|
131
|
+
def rbox.upload_vol(*args); cmd('ec2-upload-bundle', args); end
|
132
|
+
|
133
|
+
rbox.upload(@@global.cert, @@global.privatekey, "/mnt")
|
138
134
|
rbox.touch("/root/firstrun")
|
139
135
|
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
136
|
+
## TODO:
|
137
|
+
## We have to delete the host keys just before we run the bundle command.
|
138
|
+
## The problem is that if we lose the connection we won't be able to connect
|
139
|
+
## to the instance again. A better solution is to add the keys to the ignore
|
140
|
+
## list for the bundle command.
|
141
|
+
##ret = rbox.rm('/etc/ssh/ssh_host_*_key*')
|
142
|
+
|
143
|
+
puts "Starting bundling process..."
|
144
|
+
|
145
|
+
pkeyfile = File.basename(@@global.privatekey)
|
146
|
+
certfile = File.basename(@@global.cert)
|
145
147
|
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
#
|
151
|
-
#@ec2.images.register("#{@option.bucket_name}/#{@option.image_name}.manifest.xml") unless @option.print
|
148
|
+
rbox.bundle_vol(:r, "i386", :p, @option.name, :k, "/mnt/#{pkeyfile}", :c, "/mnt/#{certfile}", :u, @@global.accountnum)
|
149
|
+
rbox.upload_vol(:b, @option.bucket, :m, "/tmp/#{@option.name}.manifest.xml", :a, @@global.accesskey, :s, @@global.secretkey)
|
150
|
+
|
151
|
+
@rimages.register("#{@option.bucket}/#{@option.name}.manifest.xml")
|
152
152
|
|
153
153
|
break
|
154
154
|
end
|
155
155
|
|
156
156
|
end
|
157
157
|
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
# ami = @argv.first
|
179
|
-
# raise "You must supply an AMI ID (ami-XXXXXXX)" unless ami
|
180
|
-
# puts "Deregistering AMI: #{ami}"
|
181
|
-
#
|
182
|
-
# exit unless Annoy.are_you_sure?
|
183
|
-
#
|
184
|
-
# if @ec2.images.deregister(ami)
|
185
|
-
# puts "Done!"
|
186
|
-
# else
|
187
|
-
# puts "There was an unknown problem!"
|
188
|
-
# end
|
189
|
-
#
|
190
|
-
#end
|
158
|
+
def deregister_valid?
|
159
|
+
unless @argv.ami && Rudy::Utils.is_id?(:image, @argv.ami)
|
160
|
+
raise "You must supply an AMI ID (ami-XXXXXXX)"
|
161
|
+
end
|
162
|
+
end
|
163
|
+
def deregister
|
164
|
+
puts "Deregistering #{@argv.ami}"
|
165
|
+
|
166
|
+
execute_check(:medium)
|
167
|
+
|
168
|
+
rimages = Rudy::AWS::EC2::Images.new(@@global.accesskey, @@global.secretkey, @@global.region)
|
169
|
+
|
170
|
+
if rimages.deregister(ami)
|
171
|
+
puts "Done!"
|
172
|
+
else
|
173
|
+
puts "There was an unknown problem!"
|
174
|
+
end
|
175
|
+
|
176
|
+
end
|
177
|
+
|
191
178
|
|
192
179
|
end
|
193
180
|
|
@@ -26,9 +26,8 @@ module AWS; module S3;
|
|
26
26
|
true
|
27
27
|
end
|
28
28
|
def create_buckets
|
29
|
-
execute_check(:low)
|
30
29
|
s3 = Rudy::AWS::S3.new(@@global.accesskey, @@global.secretkey, @@global.region)
|
31
|
-
s3.create_bucket(@argv.name)
|
30
|
+
s3.create_bucket(@argv.name, @option.location)
|
32
31
|
buckets
|
33
32
|
end
|
34
33
|
|
data/lib/rudy/cli/config.rb
CHANGED
@@ -63,6 +63,19 @@ module Rudy
|
|
63
63
|
end
|
64
64
|
|
65
65
|
end
|
66
|
+
|
67
|
+
def print_global
|
68
|
+
# NOTE: This method cannot be called just "global" b/c that conflicts
|
69
|
+
# with the global accessor for Drydock::Command classes.
|
70
|
+
if @@global.nil?
|
71
|
+
raise Rudy::NoGlobal
|
72
|
+
end
|
73
|
+
gtmp = @@global.clone
|
74
|
+
gtmp.format = "yaml" if gtmp.format == :s || gtmp.format == :string
|
75
|
+
gtmp.accesskey = gtmp.secretkey = "[not displayed]"
|
76
|
+
puts gtmp.dump(gtmp.format)
|
77
|
+
end
|
78
|
+
|
66
79
|
end
|
67
80
|
end
|
68
81
|
end
|
data/lib/rudy/cli/disks.rb
CHANGED
@@ -7,8 +7,31 @@ module Rudy
|
|
7
7
|
|
8
8
|
def disks
|
9
9
|
rdisk = Rudy::Disks.new
|
10
|
-
|
10
|
+
rback = Rudy::Backups.new
|
11
|
+
more, less = [], []
|
12
|
+
less = [:environment, :role] if @option.all
|
13
|
+
# We first get the disk metadata
|
14
|
+
disk_list = rdisk.list(more, less) || []
|
15
|
+
# If there are no disks currently, there could be backups
|
16
|
+
# so we grab those to create a list of disks.
|
17
|
+
if @option.backups
|
18
|
+
backups = rback.list(more, less) || []
|
19
|
+
backups.each_with_index do |b, index|
|
20
|
+
disk_list << b.disk
|
21
|
+
end
|
22
|
+
end
|
23
|
+
# We go through the list of disks but we'll skip ones we've seen
|
24
|
+
seen = []
|
25
|
+
disk_list.each do |d|
|
26
|
+
next if seen.member?(d.name)
|
27
|
+
seen << d.name
|
11
28
|
puts @@global.verbose > 0 ? d.inspect : d.dump(@@global.format)
|
29
|
+
if @option.backups
|
30
|
+
d.list_backups.each_with_index do |b, index|
|
31
|
+
puts ' %s' % b.name
|
32
|
+
break if @option.all.nil? && index >= 2 # display only 3, unless all
|
33
|
+
end
|
34
|
+
end
|
12
35
|
end
|
13
36
|
end
|
14
37
|
|
data/lib/rudy/cli/routines.rb
CHANGED
@@ -9,25 +9,24 @@ module Rudy; module CLI;
|
|
9
9
|
true
|
10
10
|
end
|
11
11
|
def startup
|
12
|
-
machines = @rr.execute
|
13
|
-
puts $/, "The following machines are now available:"
|
12
|
+
machines = @rr.execute || []
|
13
|
+
puts $/, "The following machines are now available:" unless machines.empty?
|
14
14
|
machines.each do |machine|
|
15
15
|
puts machine.to_s
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
def
|
20
|
-
@rr = Rudy::Routines::
|
19
|
+
def reboot_valid?
|
20
|
+
@rr = Rudy::Routines::Reboot.new
|
21
21
|
@rr.raise_early_exceptions
|
22
22
|
true
|
23
23
|
end
|
24
|
-
def
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
#puts "Restart is disabled"
|
24
|
+
def reboot
|
25
|
+
machines = @rr.execute
|
26
|
+
puts $/, "The following machines have been restarted:"
|
27
|
+
machines.each do |machine|
|
28
|
+
puts machine.to_s
|
29
|
+
end
|
31
30
|
end
|
32
31
|
|
33
32
|
def release_valid?
|