Sha256: 9c611f7fc6baf444e1f709a92360a75c1ebaa9e447e7425e86d134de8eb3300a

Contents?: true

Size: 884 Bytes

Versions: 4

Compression:

Stored size: 884 Bytes

Contents


module Rudy
  module CLI
    class Backups < Rudy::CLI::CommandBase

      
      def backups
        more, less = {}, []
        less = [:environment, :role] if @option.all
        # We first get the disk metadata
        b_list = Rudy::Backups.list(more, less) || []
        b_list.each do |back|
          puts @global.verbose > 0 ? "#{back.name}: #{back.inspect}" : back.name
        end
      end
      
      def backups_wash
        dirt = (Rudy::Backups.list || []).select { |b| !b.snapshot_exists? }
        if dirt.empty?
          puts "Nothing to wash in #{current_machine_group}"
          return
        end
        
        puts "The following backup metadata will be deleted:"
        puts dirt.collect {|b| b.name }
        
        execute_check(:medium)

        dirt.each do |b|
          b.destroy(:force)
        end
        
      end
      
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
solutious-rudy-0.9.0 lib/rudy/cli/backups.rb
solutious-rudy-0.9.1 lib/rudy/cli/backups.rb
rudy-0.9.0 lib/rudy/cli/backups.rb
rudy-0.9.1 lib/rudy/cli/backups.rb