From: Ladislav Martincik lmartinc@redhat.com
- This patch is simply removing 'rb-inotify' gem dependent on Linux and substituting it with fssm which is multiplatform. --- src/config/environment.rb | 2 +- src/dbomatic/dbomatic | 31 ++++++++++++++++--------------- 2 files changed, 17 insertions(+), 16 deletions(-)
diff --git a/src/config/environment.rb b/src/config/environment.rb index 423f224..be6f77c 100644 --- a/src/config/environment.rb +++ b/src/config/environment.rb @@ -53,7 +53,7 @@ Rails::Initializer.run do |config| config.gem "compass-960-plugin", :lib => "ninesixty" config.gem "simple-navigation" config.gem "typhoeus" - config.gem "rb-inotify" + config.gem "fssm"
config.active_record.observers = :instance_observer, :task_observer # Only load the plugins named here, in the order given. By default, all plugins diff --git a/src/dbomatic/dbomatic b/src/dbomatic/dbomatic index 8a3e968..36bea6a 100755 --- a/src/dbomatic/dbomatic +++ b/src/dbomatic/dbomatic @@ -22,7 +22,7 @@ $: << File.join(File.dirname(__FILE__), "../dutils") require 'rubygems' require 'dutils' require 'nokogiri' -require 'rb-inotify' +require 'fssm' require 'optparse'
help = false @@ -269,7 +269,7 @@ begin # Create one for parsing purposes. parser << "<events>"
- notifier = INotify::Notifier.new + notifier = FSSM::Monitor.new log_file = nil
if File.exists? CONDOR_EVENT_LOG_FILE @@ -284,24 +284,25 @@ begin logger.info "done" end
- # Setup inotify watch for condor event log - notifier.watch(CONDOR_EVENT_LOG_FILE, :modify){ |event| - parse_log_file log_file, parser - } + # Setup file monitor for condor event log + notifier.path condor_event_log_dir, File.basename(CONDOR_EVENT_LOG_FILE) do + update { parse_log_file log_file, parser } + end
# if log file doesn't exist wait until it does else - notifier.watch(condor_event_log_dir, :create){ |event| - if event.name == "EventLog" - log_file = File.open(CONDOR_EVENT_LOG_FILE) - parse_log_file log_file, parser - - # Setup inotify watch for condor event log - notifier.watch(CONDOR_EVENT_LOG_FILE, :modify){ |event| + notifier.path condor_event_log_dir do + create do |base, relative| + if relative.name == "EventLog" + log_file = File.open(CONDOR_EVENT_LOG_FILE) parse_log_file log_file, parser - } + + notifier.path condor_event_log_dir, File.basename(CONDOR_EVENT_LOG_FILE) do + update { parse_log_file log_file, parser } + end + end end - } + end end
while true