Sha256: 30ac03fee79a9e242c3415a856103b00d50d55610f77d0a004ac885c3765ed14

Contents?: true

Size: 1.12 KB

Versions: 10

Compression:

Stored size: 1.12 KB

Contents

module Fog
  module Compute
    class OpenStack
      class Real
        # Available filters: name, status, image, flavor, changes_since, reservation_id
        def list_servers_detail(options = {})
          params = options.dup
          if params[:all_tenants]
            params['all_tenants'] = 'True'
            params.delete(:all_tenants)
          end

          request(
            :expects => [200, 203],
            :method  => 'GET',
            :path    => 'servers/detail.json',
            :query   => params
          )
        end
      end

      class Mock
        def list_servers_detail(_filters = {})
          response = Excon::Response.new

          servers = data[:servers].values
          servers.each do |server|
            case server['status']
            when 'BUILD'
              if Time.now - data[:last_modified][:servers][server['id']] > Fog::Mock.delay * 2
                server['status'] = 'ACTIVE'
              end
            end
          end

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

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
fog-openstack-0.1.21 lib/fog/compute/openstack/requests/list_servers_detail.rb
fog-openstack-0.1.20 lib/fog/compute/openstack/requests/list_servers_detail.rb
fog-openstack-0.1.19 lib/fog/compute/openstack/requests/list_servers_detail.rb
fog-openstack-0.1.18 lib/fog/compute/openstack/requests/list_servers_detail.rb
fog-openstack-0.1.17 lib/fog/compute/openstack/requests/list_servers_detail.rb
fog-openstack-0.1.15 lib/fog/compute/openstack/requests/list_servers_detail.rb
fog-openstack-0.1.14 lib/fog/compute/openstack/requests/list_servers_detail.rb
fog-openstack-0.1.13 lib/fog/compute/openstack/requests/list_servers_detail.rb
fog-openstack-0.1.12 lib/fog/compute/openstack/requests/list_servers_detail.rb
fog-openstack-0.1.11 lib/fog/compute/openstack/requests/list_servers_detail.rb