diff --git a/lib/fog/cdn.rb b/lib/fog/cdn.rb index 8f86a16cb..0c3dce627 100644 --- a/lib/fog/cdn.rb +++ b/lib/fog/cdn.rb @@ -19,5 +19,9 @@ module Fog end end + def self.providers + Fog.services[:cdn] + end + end end diff --git a/lib/fog/compute.rb b/lib/fog/compute.rb index e5ca41d4f..aa985b7b5 100644 --- a/lib/fog/compute.rb +++ b/lib/fog/compute.rb @@ -55,9 +55,13 @@ module Fog end end + def self.providers + Fog.services[:compute] + end + def self.servers servers = [] - for provider in [:aws, :bluebox, :brightbox, :ecloud, :gogrid, :linode, :newservers, :ninefold, :rackspace, :slicehost, :stormondemand, :virtualbox, :voxel] + for provider in self.providers begin servers.concat(self[provider].servers) rescue # ignore any missing credentials/etc diff --git a/lib/fog/core/provider.rb b/lib/fog/core/provider.rb index 3df55b7f2..0d8d0f7e5 100644 --- a/lib/fog/core/provider.rb +++ b/lib/fog/core/provider.rb @@ -6,7 +6,9 @@ module Fog end def service(new_service, path) - services << new_service + Fog.services[new_service] ||= [] + Fog.services[new_service] << self.to_s.split('::').last.downcase.to_sym + self.services << new_service require File.join('fog', path) end diff --git a/lib/fog/core/service.rb b/lib/fog/core/service.rb index e594fbd4d..da29ebffa 100644 --- a/lib/fog/core/service.rb +++ b/lib/fog/core/service.rb @@ -1,4 +1,9 @@ module Fog + + def self.services + @services ||= {} + end + class Service class Error < Fog::Errors::Error; end diff --git a/lib/fog/dns.rb b/lib/fog/dns.rb index ef9ac9fe4..2291012cb 100644 --- a/lib/fog/dns.rb +++ b/lib/fog/dns.rb @@ -34,9 +34,13 @@ module Fog end end + def self.providers + Fog.services[:dns] + end + def self.zones zones = [] - for provider in [:aws, :bluebox, :dnsimple, :dnsmadeeasy, :linode, :slicehost, :zerigo] + for provider in self.providers begin zones.concat(self[provider].zones) rescue # ignore any missing credentials/etc diff --git a/lib/fog/storage.rb b/lib/fog/storage.rb index 9b76ac372..c9a0b6e96 100644 --- a/lib/fog/storage.rb +++ b/lib/fog/storage.rb @@ -30,7 +30,7 @@ module Fog def self.directories directories = [] - for provider in [:aws, :google, :local, :ninefold, :rackspace] + for provider in self.providers begin directories.concat(self[provider].directories) rescue # ignore any missing credentials/etc @@ -73,5 +73,9 @@ module Fog metadata end + def self.providers + Fog.services[:storage] + end + end end