[Opendnssec-commits] [keihatsu.kirei.se/svn/dnssec] r1617 - in trunk/auditor: . lib lib/kasp_auditor

Alex Dalitz alexd at nominet.org.uk
Fri Aug 14 11:48:41 CEST 2009


Author: alex
Date: 2009-08-14 11:48:41 +0200 (Fri, 14 Aug 2009)
New Revision: 1617

Added:
   trunk/auditor/lib/kasp_auditor/auditor_daemon.rb
Modified:
   trunk/auditor/kasp_auditor.in
   trunk/auditor/lib/kasp_auditor.rb
Log:
Adding daemon to auditor. Currently runs once an hour. Pivotal story 846598

Modified: trunk/auditor/kasp_auditor.in
===================================================================
--- trunk/auditor/kasp_auditor.in	2009-08-14 07:36:20 UTC (rev 1616)
+++ trunk/auditor/kasp_auditor.in	2009-08-14 09:48:41 UTC (rev 1617)
@@ -20,6 +20,7 @@
       options.default_conf_file = path + "conf.xml"
       options.zone_name = nil
       options.signed_temp = nil
+      options.daemonize = false
 
       opts = OptionParser.new do |opts|
         opts.banner = "Usage: kasp_auditor [options]"
@@ -58,6 +59,14 @@
         end
 
 
+        # daemonize
+        opts.on("-d", "--daemonize",
+                "Run the auditor as a daemon") do |ext|
+           options.daemonize = true
+        end
+
+
+
         opts.separator ""
         opts.separator "Common options:"
 
@@ -91,4 +100,8 @@
     runner.signed_temp = options.signed_temp
   end
 end
-runner.run
+if (options.daemonize)
+  runner.run_as_daemon()
+else
+  runner.run()
+end

Modified: trunk/auditor/lib/kasp_auditor.rb
===================================================================
--- trunk/auditor/lib/kasp_auditor.rb	2009-08-14 07:36:20 UTC (rev 1616)
+++ trunk/auditor/lib/kasp_auditor.rb	2009-08-14 09:48:41 UTC (rev 1617)
@@ -32,6 +32,7 @@
 require 'kasp_auditor/auditor.rb'
 require 'kasp_auditor/parse.rb'
 require 'kasp_auditor/preparser.rb'
+require 'kasp_auditor/auditor_daemon.rb'
 
 # This module provides auditing capabilities to OpenDNSSEC.
 # Once an unsigned zone has been signed, this module is used to check that
@@ -74,6 +75,21 @@
       }
     end
 
+    def run_as_daemon
+      daemon = AuditorDaemon.new
+      daemon.conf_file = @conf_file
+      if (@kasp_file)
+        daemon.kasp_file = @kasp_file
+      end
+      if (@zone_name)
+        daemon.zone_name = @zone_name
+        if (@signed_temp)
+          daemon.signed_temp = @signed_temp
+        end
+      end
+      daemon.run
+    end
+
     # This method is provided so that the test code can use its own syslog
     def run_with_syslog(zonelist_file, kasp_file, syslog, working) # :nodoc: all
       zones = Parse.parse(File.dirname(kasp_file)  + "/", zonelist_file, kasp_file, syslog)




More information about the Opendnssec-commits mailing list