Sha256: c8877656cd9dfaba9221160303d73b2732461a2bb331ef9a1e597ff847a04152

Contents?: true

Size: 1.31 KB

Versions: 27

Compression:

Stored size: 1.31 KB

Contents

unless Fog.mocking?

  module Fog
    module Rackspace
      class Servers

        # List all images
        #
        # ==== Returns
        # * response<~Excon::Response>:
        #   * body<~Hash>:
        #     * 'id'<~Integer> - Id of the image
        #     * 'name'<~String> - Name of the image
        #     * 'updated'<~String> - Last update timestamp for image
        #     * 'created'<~String> - Creation timestamp for image
        #     * 'status'<~String> - Status of image
        def list_images_detail
          request(
            :expects  => [200, 203],
            :method   => 'GET',
            :path     => 'images/detail.json'
          )
        end

      end
    end
  end

else

  module Fog
    module Rackspace
      class Servers

        def list_images_detail
          response = Excon::Response.new

          images = Fog::Rackspace::Servers.data[:images].values
          for image in images
            case image['status']
            when 'SAVING'
              if Time.now - Fog::Rackspace::Servers.data[:last_modified][:images][image['id']] > 2
                image['status'] = 'ACTIVE'
              end
            end
          end

          response.status = [200, 203][rand(1)]
          response.body = { 'images' => images }
          response
        end

      end
    end
  end

end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
fog-0.0.58 lib/fog/rackspace/requests/servers/list_images_detail.rb
fog-0.0.57 lib/fog/rackspace/requests/servers/list_images_detail.rb
fog-0.0.56 lib/fog/rackspace/requests/servers/list_images_detail.rb
fog-0.0.55 lib/fog/rackspace/requests/servers/list_images_detail.rb
fog-0.0.54 lib/fog/rackspace/requests/servers/list_images_detail.rb
fog-0.0.53 lib/fog/rackspace/requests/servers/list_images_detail.rb
fog-0.0.52 lib/fog/rackspace/requests/servers/list_images_detail.rb
fog-0.0.51 lib/fog/rackspace/requests/servers/list_images_detail.rb
fog-0.0.50 lib/fog/rackspace/requests/servers/list_images_detail.rb
fog-0.0.49 lib/fog/rackspace/requests/servers/list_images_detail.rb
fog-0.0.48 lib/fog/rackspace/requests/servers/list_images_detail.rb
fog-0.0.47 lib/fog/rackspace/requests/servers/list_images_detail.rb
fog-0.0.46 lib/fog/rackspace/requests/servers/list_images_detail.rb
fog-0.0.45 lib/fog/rackspace/requests/servers/list_images_detail.rb
fog-0.0.44 lib/fog/rackspace/requests/servers/list_images_detail.rb
fog-0.0.43 lib/fog/rackspace/requests/servers/list_images_detail.rb
fog-0.0.42 lib/fog/rackspace/requests/servers/list_images_detail.rb
fog-0.0.41 lib/fog/rackspace/requests/servers/list_images_detail.rb
fog-0.0.40 lib/fog/rackspace/requests/servers/list_images_detail.rb
fog-0.0.39 lib/fog/rackspace/requests/servers/list_images_detail.rb