Skip to content

Commit

Permalink
Add new dynflow plugin settings
Browse files Browse the repository at this point in the history
closes GH-219
  • Loading branch information
stbenjam authored and mmoll committed Feb 18, 2016
1 parent 5eacdeb commit 5791db1
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
10 changes: 9 additions & 1 deletion manifests/plugin/dynflow.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,21 @@
#
# $listen_on:: Proxy feature listens on https, http, or both
#
# $database_path:: Path to the SQLite database file
#
# $console_auth:: Whether to enable trusted hosts and ssl for the dynflow console
# type:boolean
#
class foreman_proxy::plugin::dynflow (
$enabled = $::foreman_proxy::plugin::dynflow::params::enabled,
$listen_on = $::foreman_proxy::plugin::dynflow::params::listen_on,
$database_path = $::foreman_proxy::plugin::dynflow::params::database_path,
$console_auth = $::foreman_proxy::plugin::dynflow::params::console_auth,
) inherits foreman_proxy::plugin::dynflow::params {

validate_bool($enabled)
validate_bool($enabled, $console_auth)
validate_listen_on($listen_on)
validate_absolute_path($database_path)

foreman_proxy::plugin { 'dynflow':
} ->
Expand Down
2 changes: 2 additions & 0 deletions manifests/plugin/dynflow/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
class foreman_proxy::plugin::dynflow::params {
$enabled = true
$listen_on = 'https'
$database_path = '/var/lib/foreman-proxy/dynflow/dynflow.sqlite'
$console_auth = true
}
16 changes: 8 additions & 8 deletions spec/classes/foreman_proxy__plugin__dynflow_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
end

it { should contain_foreman_proxy__plugin('dynflow') }
it 'should configure dynflow.yml' do
should contain_file('/etc/foreman-proxy/settings.d/dynflow.yml').
with({
:ensure => 'file',
:owner => 'root',
:mode => '0640',
:content => /:enabled: https/
})

it 'should generate correct dynflow.yml' do
verify_exact_contents(catalogue, "/etc/foreman-proxy/settings.d/dynflow.yml", [
'---',
':enabled: https',
':database: /var/lib/foreman-proxy/dynflow/dynflow.sqlite',
':console_auth: true',
])
end
end
end
2 changes: 2 additions & 0 deletions templates/plugin/dynflow.yml.erb
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
---
:enabled: <%= @module_enabled %>
:database: <%= scope.lookupvar('::foreman_proxy::plugin::dynflow::database_path') %>
:console_auth: <%= scope.lookupvar('::foreman_proxy::plugin::dynflow::console_auth') %>

0 comments on commit 5791db1

Please sign in to comment.