1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Initial integration of powerdns

This commit is contained in:
Chris Luo 2015-03-13 13:42:56 -04:00
parent a332d394d5
commit d3fdfebd4c
6 changed files with 42 additions and 0 deletions

View file

@ -57,6 +57,7 @@ Gem::Specification.new do |s|
s.add_dependency("fog-brightbox", "~> 0.4") s.add_dependency("fog-brightbox", "~> 0.4")
s.add_dependency("fog-ecloud") s.add_dependency("fog-ecloud")
s.add_dependency("fog-local") s.add_dependency("fog-local")
s.add_dependency("fog-powerdns", ">= 0.1.1")
s.add_dependency("fog-profitbricks") s.add_dependency("fog-profitbricks")
s.add_dependency("fog-radosgw", ">= 0.0.2") s.add_dependency("fog-radosgw", ">= 0.0.2")
s.add_dependency("fog-riakcs") s.add_dependency("fog-riakcs")

View file

@ -49,6 +49,7 @@ require 'fog/rage4'
require 'fog/riakcs' require 'fog/riakcs'
require 'fog/openstack' require 'fog/openstack'
require 'fog/ovirt' require 'fog/ovirt'
require 'fog/powerdns'
require 'fog/profitbricks' require 'fog/profitbricks'
require 'fog/sakuracloud' require 'fog/sakuracloud'
require 'fog/serverlove' require 'fog/serverlove'

View file

@ -81,6 +81,7 @@ require 'fog/bin/rage4'
require 'fog/bin/riakcs' require 'fog/bin/riakcs'
require 'fog/bin/openstack' require 'fog/bin/openstack'
require 'fog/bin/ovirt' require 'fog/bin/ovirt'
require 'fog/bin/powerdns'
require 'fog/bin/profitbricks' require 'fog/bin/profitbricks'
require 'fog/bin/sakuracloud' require 'fog/bin/sakuracloud'
require 'fog/bin/serverlove' require 'fog/bin/serverlove'

28
lib/fog/bin/powerdns.rb Normal file
View file

@ -0,0 +1,28 @@
class Softlayer < Fog::Bin
class << self
def class_for(key)
case key
when :dns
Fog::DNS::PowerDNS
else
raise ArgumentError, "Unsupported #{self} service: #{key}"
end
end
def [](service)
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :dns
Fog::Logger.warning("PowerDNS[:dns] is not recommended, use DNS[:powerdns] for portability")
Fog::DNS.new(:provider => :powerdns)
else
raise ArgumentError, "Unrecognized service: #{key.inspect}"
end
end
@@connections[service]
end
def services
Fog::PowerDNS.services
end
end
end

View file

@ -0,0 +1,8 @@
require "minitest/autorun"
require "fog"
require "fog/bin"
require "helpers/bin"
describe PowerDNS do
include Fog::BinSpec
let(:subject) { PowerDNS }
end

View file

@ -34,6 +34,7 @@ describe Fog do
assert_equal "OpenStack", Fog.providers[:openstack] assert_equal "OpenStack", Fog.providers[:openstack]
assert_equal "Openvz", Fog.providers[:openvz] assert_equal "Openvz", Fog.providers[:openvz]
assert_equal "Ovirt", Fog.providers[:ovirt] assert_equal "Ovirt", Fog.providers[:ovirt]
assert_equal "PowerDNS", Fog.providers[:powerdns]
assert_equal "ProfitBricks", Fog.providers[:profitbricks] assert_equal "ProfitBricks", Fog.providers[:profitbricks]
assert_equal "Rackspace", Fog.providers[:rackspace] assert_equal "Rackspace", Fog.providers[:rackspace]
assert_equal "Rage4", Fog.providers[:rage4] assert_equal "Rage4", Fog.providers[:rage4]
@ -84,6 +85,7 @@ describe Fog do
assert_includes Fog.registered_providers, "OpenStack" assert_includes Fog.registered_providers, "OpenStack"
assert_includes Fog.registered_providers, "Openvz" assert_includes Fog.registered_providers, "Openvz"
assert_includes Fog.registered_providers, "Ovirt" assert_includes Fog.registered_providers, "Ovirt"
assert_includes Fog.registered_providers, "PowerDNS"
assert_includes Fog.registered_providers, "ProfitBricks" assert_includes Fog.registered_providers, "ProfitBricks"
assert_includes Fog.registered_providers, "Rackspace" assert_includes Fog.registered_providers, "Rackspace"
assert_includes Fog.registered_providers, "Rage4" assert_includes Fog.registered_providers, "Rage4"
@ -134,6 +136,7 @@ describe Fog do
assert_includes Fog.available_providers, "OpenStack" if OpenStack.available? assert_includes Fog.available_providers, "OpenStack" if OpenStack.available?
assert_includes Fog.available_providers, "Openvz" if Openvz.available? assert_includes Fog.available_providers, "Openvz" if Openvz.available?
assert_includes Fog.available_providers, "Ovirt" if Ovirt.available? assert_includes Fog.available_providers, "Ovirt" if Ovirt.available?
assert_includes Fog.available_providers, "ProfitBricks" if PowerDNS.available?
assert_includes Fog.available_providers, "ProfitBricks" if ProfitBricks.available? assert_includes Fog.available_providers, "ProfitBricks" if ProfitBricks.available?
assert_includes Fog.available_providers, "Rackspace" if Rackspace.available? assert_includes Fog.available_providers, "Rackspace" if Rackspace.available?
assert_includes Fog.available_providers, "Rage4" if Rage4.available? assert_includes Fog.available_providers, "Rage4" if Rage4.available?