Sha256: 19e98d3fcbbdf4a24444cc5ffb33294ffab58a7ce203c2457660ceea8840472d

Contents?: true

Size: 1.04 KB

Versions: 16

Compression:

Stored size: 1.04 KB

Contents

require 'mccloud/util/iterator'

module Mccloud
  module Command
    def deregister(imageId=nil,options=nil)

      if imageId.nil?
        puts "[Error] We need at least need an imageId."
        exit
      end


      #f=Fog::Compute.new({ :region => "eu-west-1", :provider => "AWS"})
      # i=f.create_image("i-c1ac2bb7","name","description")
      # f.images.all({ "Owner" => "self"})
      # f.deregister_image("ami-796d5b0d")

      puts "Looking for imageId: #{imageId}"
      @environment.config.providers.each do |name,provider|
        begin
          image=provider.images.get(imageId)
          if image.nil?
            puts "[#{name}] - ImageId #{imageId} not found"
          else
            puts "[#{name}] - ImageId #{imageId} found"
            puts "[#{name}] - Deregistering #{imageId} now"
            begin
              provider.deregister_image(imageId)
            rescue Fog::Service::Error => fogerror
              puts "[Error] #{fogerror}"
            end
          end
        end
      end


    end #def
  end #module
end #module

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
mccloud-0.1.1 lib/mccloud/provider/aws/provider/old_deregister.rb
mccloud-0.0.28 lib/mccloud/provider/aws/provider/old_deregister.rb
mccloud-0.0.27 lib/mccloud/provider/aws/provider/old_deregister.rb
mccloud-0.0.26 lib/mccloud/provider/aws/provider/old_deregister.rb
mccloud-0.0.25 lib/mccloud/provider/aws/provider/old_deregister.rb
mccloud-0.0.24 lib/mccloud/provider/aws/provider/old_deregister.rb
mccloud-0.0.23 lib/mccloud/provider/aws/provider/old_deregister.rb
mccloud-0.0.22 lib/mccloud/provider/aws/provider/old_deregister.rb
mccloud-0.0.21 lib/mccloud/provider/aws/provider/old_deregister.rb
mccloud-0.0.20 lib/mccloud/provider/aws/provider/old_deregister.rb
mccloud-0.0.19 lib/mccloud/provider/aws/provider/old_deregister.rb
mccloud-0.0.18 lib/mccloud/provider/aws/provider/old_deregister.rb
mccloud-0.0.17 lib/mccloud/provider/aws/provider/old_deregister.rb
mccloud-0.0.16 lib/mccloud/provider/aws/provider/old_deregister.rb
mccloud-0.0.15 lib/mccloud/provider/aws/provider/old_deregister.rb
mccloud-0.0.14 lib/mccloud/provider/aws/provider/old_deregister.rb