Skip to content

Commit

Permalink
Fixes #11366 - adds dynflow persistance
Browse files Browse the repository at this point in the history
  • Loading branch information
ares committed Jan 20, 2016
1 parent 5320651 commit 3168a5c
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ task :default => :test

desc 'Test Dynflow plugin.'
Rake::TestTask.new(:test) do |t|
ENV['DYNFLOW_DB_CONN_STRING'] = 'sqlite:/'
t.libs << '.'
t.libs << 'lib'
t.libs << 'test'
Expand Down
11 changes: 10 additions & 1 deletion lib/smart_proxy_dynflow.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,16 @@ def create_world(&block)
end

def persistence_conn_string
ENV['DYNFLOW_DB_CONN_STRING'] || 'sqlite:/'
db_conn_string = 'sqlite:/'

db_file = Proxy::Dynflow::Plugin.settings.database
if db_file.nil? || db_file.empty?
Proxy::Log.logger.warn "Could not open DB for dynflow at '#{db_file}', will keep data in memory. Restart will drop all dynflow data."
else
db_conn_string += "/#{db_file}"
end

ENV['DYNFLOW_DB_CONN_STRING'] || db_conn_string
end

def persistence_adapter
Expand Down
1 change: 1 addition & 0 deletions lib/smart_proxy_dynflow/plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ class Plugin < Proxy::Plugin
https_rackup_path File.expand_path("http_config.ru", File.expand_path("../", __FILE__))

settings_file "dynflow.yml"
default_settings :database => '/var/spool/foreman-proxy/dynflow/dynflow.sqlite'
plugin :dynflow, Proxy::Dynflow::VERSION
end
end
Empty file added logs/.keep
Empty file.
1 change: 1 addition & 0 deletions settings.d/dynflow.yml.example
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
---
:enabled: true
:database: /var/spool/foreman-proxy/dynflow/dynflow.sqlite

0 comments on commit 3168a5c

Please sign in to comment.