fix crash if no dnsmasq_conf_dir configured
authorTom Clegg <tom@clinicalfuture.com>
Thu, 10 Jan 2013 20:39:23 +0000 (12:39 -0800)
committerTom Clegg <tom@clinicalfuture.com>
Thu, 10 Jan 2013 20:39:23 +0000 (12:39 -0800)
app/models/node.rb

index 4b51fd4bfe1ceda205a6d3aa87b3473cb9aa2526..29233748dd1cf77cc61b77fc08b23130dee0102c 100644 (file)
@@ -5,9 +5,12 @@ class Node < ActiveRecord::Base
 
   MAX_SLOTS = 64
 
-  @@confdir = begin
-                Rails.configuration.dnsmasq_conf_dir or
-                  ('/etc/dnsmasq.d' if File.exists? '/etc/dnsmasq.d/.')
+  @@confdir = if Rails.configuration.respond_to? :dnsmasq_conf_dir
+                Rails.configuration.dnsmasq_conf_dir
+              elsif File.exists? '/etc/dnsmasq.d/.'
+                '/etc/dnsmasq.d'
+              else
+                nil
               end
 
   def info