Sha256: 633efd5dff1563ce09391ca12ff88ca33df2c08d62c55adae7441c4208f787bd

Contents?: true

Size: 962 Bytes

Versions: 12

Compression:

Stored size: 962 Bytes

Contents

require 'fog/core/collection'
require 'fog/openstack/models/compute/server'

module Fog
  module Compute
    class OpenStack

      class Servers < Fog::Collection

        attribute :filters

        model Fog::Compute::OpenStack::Server

        def initialize(attributes)
          self.filters ||= {}
          super
        end

        def all(filters = filters)
          self.filters = filters
          data = connection.list_servers_detail(filters).body['servers']
          load(data)
        end

        def bootstrap(new_attributes = {})
          server = create(new_attributes)
          server.wait_for { ready? }
          server.setup(:password => server.password)
          server
        end

        def get(server_id)
          if server = connection.get_server_details(server_id).body['server']
            new(server)
          end
        rescue Fog::Compute::OpenStack::NotFound
          nil
        end

      end

    end
  end
end

Version data entries

12 entries across 12 versions & 7 rubygems

Version Path
fog-nirvanix-1.8.2 lib/fog/openstack/models/compute/servers.rb
fog-nirvanix-1.8.1 lib/fog/openstack/models/compute/servers.rb
fog-parser-fix-1.6.1 lib/fog/openstack/models/compute/servers.rb
fog-test-again-1.6.0 lib/fog/openstack/models/compute/servers.rb
fog-parser-fix-1.6.0 lib/fog/openstack/models/compute/servers.rb
ey-vendored-backup-3.0.27 vendor/gems/fog/lib/fog/openstack/models/compute/servers.rb
fog-sgonyea-1.8.1 lib/fog/openstack/models/compute/servers.rb
fog-1.8.0 lib/fog/openstack/models/compute/servers.rb
fog-maestrodev-1.7.0.20121114190951 lib/fog/openstack/models/compute/servers.rb
fog-1.7.0 lib/fog/openstack/models/compute/servers.rb
fog-1.6.0 lib/fog/openstack/models/compute/servers.rb
fog-1.5.0 lib/fog/openstack/models/compute/servers.rb