From ee241959c647590ed137dc9727cd7c167fd2f7e5 Mon Sep 17 00:00:00 2001 From: Nicolae Claudius Date: Tue, 25 Oct 2011 11:38:22 -0700 Subject: [PATCH] random ns from config --- app/models/domain.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/domain.rb b/app/models/domain.rb index 156f817..ce6481f 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -47,7 +47,8 @@ class Domain < ActiveRecord::Base validate :domain_ownership, :on => :create def domain_ownership # at least one NS is among ours - Resolv::DNS.open do |dns| + ns = Settings.resolv.sample + Resolv::DNS.open(:nameserver => ns) do |dns| ress = dns.getresources name, Resolv::DNS::Resource::IN::NS if (Settings.ns & ress.map{|r| r.name.to_s}).blank? errors.add :base, "You must delegate #{name} to one of our NS servers before adding it"