Sha256: a4f23eec5327ffabd3a22bdfffce9a20d308fbc8790bd416c53b58e53de7f368

Contents?: true

Size: 1.3 KB

Versions: 8

Compression:

Stored size: 1.3 KB

Contents


module Rudy
  module CLI
    class Metadata < Rudy::CLI::CommandBase
      
      def metadata_valid?
        @option.rtype ||= 'm'
        @metaobj = Rudy::Metadata.get_rclass @option.rtype
        true
      end
      
      def metadata
        unless @argv.empty?
          h = Rudy::Metadata.get(@argv.first)
          return if h.nil?
          @metaobj = Rudy::Metadata.get_rclass h['rtype'].first
          objlist = Hash[@argv.first => @metaobj.from_hash(h)]
        else
          more, less = {}, []
          less = [:environment, :role, :zone, :region, :position] if @option.all
          objlist = @metaobj.list_as_hash(more, less) || {}
        end
        
        objlist.each_pair do |k,o|
          puts "#{k}: " << o.inspect
        end
      end
      
      def metadata_delete_valid?
        raise "Must supply object ID" unless @argv.oid
        raise Rudy::Metadata::UnknownObject, @argv.oid unless Rudy::Metadata.exists? @argv.oid
        true
      end
      
      def metadata_delete

        unless @@global.quiet
          msg = "NOTE: This will delete only the metadata and "
          msg << "not the EC2 object (volume, instance, etc...)"
          puts msg
        end
        
        execute_check(:medium)
        
        Rudy::Metadata.destroy @argv.oid
      end
    
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
solutious-rudy-0.9.0 lib/rudy/cli/metadata.rb
solutious-rudy-0.9.1 lib/rudy/cli/metadata.rb
solutious-rudy-0.9.2 lib/rudy/cli/metadata.rb
solutious-rudy-0.9.3 lib/rudy/cli/metadata.rb
rudy-0.9.3 lib/rudy/cli/metadata.rb
rudy-0.9.2 lib/rudy/cli/metadata.rb
rudy-0.9.0 lib/rudy/cli/metadata.rb
rudy-0.9.1 lib/rudy/cli/metadata.rb