Class: Rudy::CLI::Disks
Instance Attribute Summary
Attributes inherited from CommandBase
#config
Instance Method Summary
collapse
Methods included from Huxtable
change_environment, change_position, change_region, change_role, change_zone, #check_keys, #config_dirname, create_domain, #current_group_name, #current_machine_address, #current_machine_count, #current_machine_group, #current_machine_hostname, #current_machine_image, #current_machine_name, #current_machine_size, #current_user, #current_user_keypairpath, debug?, #debug?, domain, domain_exists?, #group_metadata, #has_keypair?, #has_keys?, #has_pem_keys?, #has_root_keypair?, keypair_path_to_name, #known_machine_group?, #root_keypairname, #root_keypairpath, #switch_user, update_config, update_global, update_logger, #user_keypairname, #user_keypairpath
Instance Method Details
#disks ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/rudy/cli/disks.rb', line 8
def disks
rdisk = Rudy::Disks.new
rback = Rudy::Backups.new
more, less = [], []
less = [:environment, :role] if @option.all
disk_list = rdisk.list(more, less) || []
if @option.backups
backups = rback.list(more, less) || []
backups.each_with_index do |b, index|
disk_list << b.disk
end
end
seen = []
disk_list.each do |d|
next if seen.member?(d.name)
seen << d.name
puts @@global.verbose > 0 ? d.inspect : d.dump(@@global.format)
if @option.backups
d.list_backups.each_with_index do |b, index|
puts ' %s' % b.name
break if @option.all.nil? && index >= 2 end
end
end
end
|
#disks_wash ⇒ Object
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/rudy/cli/disks.rb', line 38
def disks_wash
rdisk = Rudy::Disks.new
dirt = (rdisk.list || []) if dirt.empty?
puts "Nothing to wash in #{rdisk.current_machine_group}"
return
end
puts "The following disk metadata will be deleted:"
puts dirt.collect {|d| d.name }
execute_check(:medium)
dirt.each do |d|
d.destroy(:force)
end
end
|