add configurable compute node domain
authorTom Clegg <tom@clinicalfuture.com>
Fri, 11 Jan 2013 22:13:35 +0000 (14:13 -0800)
committerTom Clegg <tom@clinicalfuture.com>
Fri, 11 Jan 2013 22:13:35 +0000 (14:13 -0800)
app/models/node.rb
config/environments/development.rb
config/environments/production.rb
config/environments/test.rb

index 364c1ac40c0b2de836bca294c414ce4ae6278b91..044035294de863a58d80abe6079c8f7dadbb0026 100644 (file)
@@ -13,12 +13,17 @@ class Node < ActiveRecord::Base
               else
                 nil
               end
+  @@domain = Rails.configuration.compute_node_domain rescue `hostname --domain`.strip
 
   def info
     @info ||= Hash.new
     super
   end
 
+  def domain
+    super || @@domain
+  end
+
   def status
     if !self.last_ping_at
       if Time.now - self.created_at > 5.minutes
@@ -110,6 +115,7 @@ class Node < ActiveRecord::Base
     hostfile = File.join @@confdir, hostname
     File.open hostfile, 'w' do |f|
       f.puts "address=/#{hostname}/#{ip_address}"
+      f.puts "address=/#{hostname}.#{@@domain}/#{ip_address}" if @@domain
       f.puts "ptr-record=#{ptr_domain},#{hostname}"
     end
     File.open(File.join(@@confdir, 'restart.txt'), 'w') do |f|
index e36350747874ef7412354914b75bae5192cb8424..c16640d48a3f0087d5b85336aa27da2452f9e954 100644 (file)
@@ -30,5 +30,7 @@ Server::Application.configure do
 
   config.force_ssl = false
 
-  config.dnsmasq_conf_dir = '/etc/dnsmasq.d'
+  # config.dnsmasq_conf_dir = '/etc/dnsmasq.d'
+
+  # config.compute_node_domain = `hostname --domain`.strip
 end
index 122ec94aa2e2ad15edac58535fdde1f479b583a9..8fbf0b18cb06d5d2099107350171ad2d40f570fe 100644 (file)
@@ -58,5 +58,7 @@ Server::Application.configure do
   # Send deprecation notices to registered listeners
   config.active_support.deprecation = :notify
 
-  config.dnsmasq_conf_dir = '/etc/dnsmasq.d'
+  # config.dnsmasq_conf_dir = '/etc/dnsmasq.d'
+
+  # config.compute_node_domain = `hostname --domain`.strip
 end
index f2af29ef998ea632b902572e8ca888771540c49e..bab2a60cd4b4bd9d4b915dd46f66f16b94a06aa1 100644 (file)
@@ -37,5 +37,7 @@ Server::Application.configure do
   # Print deprecation notices to the stderr
   config.active_support.deprecation = :stderr
 
-  config.dnsmasq_conf_dir = '/etc/dnsmasq.d'
+  # config.dnsmasq_conf_dir = '/etc/dnsmasq.d'
+
+  # config.compute_node_domain = `hostname --domain`.strip
 end