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.38 lib/fog/rackspace/requests/servers/list_images_detail.rb
fog-0.0.37 lib/fog/rackspace/requests/servers/list_images_detail.rb
fog-0.0.36 lib/fog/rackspace/requests/servers/list_images_detail.rb
fog-0.0.35 lib/fog/rackspace/requests/servers/list_images_detail.rb
fog-0.0.34 lib/fog/rackspace/requests/servers/list_images_detail.rb
fog-0.0.33 lib/fog/rackspace/requests/servers/list_images_detail.rb
fog-0.0.32 lib/fog/rackspace/requests/servers/list_images_detail.rb