lib/foreman_tasks/dynflow.rb in foreman-tasks-0.9.1 vs lib/foreman_tasks/dynflow.rb in foreman-tasks-0.9.2
- old
+ new
@@ -7,12 +7,13 @@
require 'foreman_tasks/dynflow/configuration'
require 'foreman_tasks/dynflow/persistence'
require 'foreman_tasks/dynflow/daemon'
require 'foreman_tasks/dynflow/console_authorizer'
- def initialize
+ def initialize(world_class = nil)
@required = false
+ @world_class = world_class
end
def config
@config ||= ForemanTasks::Dynflow::Configuration.new
end
@@ -35,11 +36,11 @@
return @world if @world
if config.lazy_initialization && defined?(PhusionPassenger)
config.dynflow_logger.warn('ForemanTasks: lazy loading with PhusionPassenger might lead to unexpected results')
end
- config.initialize_world.tap do |world|
+ init_world.tap do |world|
@world = world
unless config.remote?
# don't try to do any rescuing until the tables are properly migrated
if !Foreman.in_rake?('db:migrate') && (begin
@@ -116,8 +117,15 @@
@world.reload! if @world
end
def loaded_paths
@loaded_paths ||= Set.new
+ end
+
+ private
+
+ def init_world
+ return config.initialize_world(@world_class) if @world_class
+ config.initialize_world
end
end
end