Sha256: c76a7f8187731afb66ef3bfb05e07feaf2260fd9caef7604fa2428a39799eb41

Contents?: true

Size: 1.91 KB

Versions: 5

Compression:

Stored size: 1.91 KB

Contents

module Mccloud::Provider
  module Aws
    module ProviderCommand

      def status(selection=nil,options=nil)

        env.ui.info ""
        env.ui.info "Server(s) - provider #{@name}"

        printf "%-10s %-12s %-20s %-15s %-8s\n", "Name", "Instance Id", "IP", "Type","Status"
        80.times { |i| printf "=" } ; env.ui.info ""

        # List servers
        raw.servers.each do |vm|
          name="<no name set>"
          if !vm.tags["Name"].nil?
            name=vm.tags["Name"].strip
          end #end if

          if name.start_with?(self.filter)
            unless self.filter==""
              name[self.filter]=""
              printf "%-10s %-12s %-20s %-20s %-15s %-8s\n",name,vm.id, vm.public_ip_address, vm.private_ip_address,vm.flavor.name,vm.state
            else
              env.ui.info "Name: #{name}"
              env.ui.info "Instance Id: #{vm.id}"
              env.ui.info "Public Ip: #{vm.public_ip_address}"
              env.ui.info "Flavor: #{vm.flavor.name}"
              env.ui.info "State: #{vm.state}"
              80.times { |i| printf "=" } ; env.ui.info ""
            end
          end
        end #End 1 provider

        # List images
        env.ui.info ""
        env.ui.info "Image(s) - provider #{@name}"
        80.times { |i| printf "=" } ; env.ui.info ""
        images_list=raw.images.all({"Owner" => "self"})
        images_list.each do |image|
          printf "%-10s %-10s %-10s %-20s\n",image.id,image.name.gsub(/"#{filter}"/,''),image.state, image.description[0..20]
        end

        # List volumes
        env.ui.info ""
        env.ui.info "Volume(s) - provider #{@name}"
        80.times { |i| printf "=" } ; env.ui.info ""
        volume_list=raw.volumes.all()
        volume_list.each do |volume|
          printf "%-10s %-10s %-10s %-20s\n",volume.id,volume.device,volume.server_id, volume.size
        end
        env.ui.info ""

      end

    end #module
  end #module
end #module

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mccloud-0.0.18 lib/mccloud/provider/aws/provider/status.rb
mccloud-0.0.17 lib/mccloud/provider/aws/provider/status.rb
mccloud-0.0.16 lib/mccloud/provider/aws/provider/status.rb
mccloud-0.0.15 lib/mccloud/provider/aws/provider/status.rb
mccloud-0.0.14 lib/mccloud/provider/aws/provider/status.rb