- File.open(File.join(@@dns_server_conf_dir, 'restart.txt'), 'w') do |f|
- # this will trigger a dns server restart
- f.puts @@dns_server_reload_command
+
+ if Rails.configuration.dns_server_update_command
+ cmd = Rails.configuration.dns_server_update_command % template_vars
+ if not system cmd
+ logger.error "dns_server_update_command #{cmd.inspect} failed: #{$?}"
+ ok = false
+ end
+ end
+
+ if Rails.configuration.dns_server_conf_dir and Rails.configuration.dns_server_reload_command
+ restartfile = File.join(Rails.configuration.dns_server_conf_dir, 'restart.txt')
+ begin
+ File.open(restartfile, 'w') do |f|
+ # Typically, this is used to trigger a dns server restart
+ f.puts Rails.configuration.dns_server_reload_command
+ end
+ rescue => e
+ logger.error "Unable to write #{restartfile}: #{e.message}"
+ ok = false
+ end