lib/foreman_tasks/dynflow/daemon.rb in foreman-tasks-0.1.4 vs lib/foreman_tasks/dynflow/daemon.rb in foreman-tasks-0.1.5

- old
+ new

@@ -1,5 +1,7 @@ +require 'fileutils' + module ForemanTasks class Dynflow::Daemon # load the Rails environment and initialize the executor and listener # in this thread. @@ -23,10 +25,11 @@ process_name: 'dynflow_executor', pid_dir: "#{Rails.root}/tmp/pids", wait_attempts: 300, wait_sleep: 1 } options = default_options.merge(options) + FileUtils.mkdir_p(options[:pid_dir]) begin require 'daemons' rescue LoadError raise "You need to add gem 'daemons' to your Gemfile if you wish to use it." end @@ -66,10 +69,11 @@ end protected def listener - ::Dynflow::Listeners::Socket.new(world, socket_path) + FileUtils.mkdir_p(File.dirname(socket_path)) + ::Dynflow::Listeners::Socket.new(world, socket_path) end def socket_path ForemanTasks.dynflow.config.remote_socket_path end