Class: ForemanTasks::Dynflow::Configuration
- Inherits:
-
Foreman::Dynflow::Configuration
- Object
- Foreman::Dynflow::Configuration
- ForemanTasks::Dynflow::Configuration
- Defined in:
- lib/foreman_tasks/dynflow/configuration.rb
Overview
Import all Dynflow configuration from Foreman, and add our own for Tasks
Instance Method Summary collapse
- #backup_settings ⇒ Object
- #default_backup_dir ⇒ Object
- #persistence_class ⇒ Object
- #with_environment_override(options) ⇒ Object
- #world_config ⇒ Object
Instance Method Details
#backup_settings ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/foreman_tasks/dynflow/configuration.rb', line 14 def backup_settings return @backup_settings if @backup_settings = { :backup_deleted_plans => true, :backup_dir => default_backup_dir, } settings = SETTINGS[:'foreman-tasks'] && SETTINGS[:'foreman-tasks'][:backup] .merge!(settings) if settings @backup_settings = with_environment_override end |
#default_backup_dir ⇒ Object
25 26 27 |
# File 'lib/foreman_tasks/dynflow/configuration.rb', line 25 def default_backup_dir File.join(Rails.root, 'tmp', 'task-backup') end |
#persistence_class ⇒ Object
38 39 40 |
# File 'lib/foreman_tasks/dynflow/configuration.rb', line 38 def persistence_class ForemanTasks::Dynflow::Persistence end |
#with_environment_override(options) ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/foreman_tasks/dynflow/configuration.rb', line 29 def with_environment_override() env_var = ENV['TASK_BACKUP'] unless env_var.nil? # Everything except 0, n, no, false is considered to be a truthy value [:backup_deleted_plans] = !%w[0 n no false].include?(env_var.downcase) end end |
#world_config ⇒ Object
7 8 9 10 11 12 |
# File 'lib/foreman_tasks/dynflow/configuration.rb', line 7 def world_config super.tap do |config| config.backup_deleted_plans = backup_settings[:backup_deleted_plans] config.backup_dir = backup_settings[:backup_dir] end end |