Skip to content

Commit dc8d365

Browse files
committed
Implement openbolt plugin support
1 parent 26333ee commit dc8d365

File tree

3 files changed

+82
-0
lines changed

3 files changed

+82
-0
lines changed

manifests/plugin/openbolt.pp

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# = Foreman Proxy openbolt plugin
2+
#
3+
# This class installs the OpenBolt plugin
4+
#
5+
# === Parameters:
6+
#
7+
# $environment_path:: Path to the environment with all modules
8+
#
9+
# $workers:: Define the amount of possible workers
10+
#
11+
# $concurrency:: Define the limit of concurrent connections for executed tasks
12+
#
13+
# $connect_timeout:: Timeout in seconds for connecting to remote systems
14+
#
15+
# $log_dir:: directory where bolt will write logs to
16+
#
17+
# === Advanced parameters:
18+
#
19+
# $enabled:: enables/disables the HDM plugin
20+
#
21+
# $listen_on:: proxy feature listens on http, https, or both
22+
#
23+
# $version:: plugin package version, it's passed to ensure parameter of package resource
24+
# can be set to specific version number, 'latest', 'present' etc.
25+
#
26+
class foreman_proxy::plugin::openbolt (
27+
Optional[String[1]] $version = undef,
28+
Boolean $enabled = true,
29+
Foreman_proxy::ListenOn $listen_on = 'https',
30+
Stdlib::Absolutepath $environment_path = '/etc/puppetlabs/code/environments/production',
31+
Integer[0] $workers = 20,
32+
Integer[0] $concurrency = 100,
33+
Integer[1] $connect_timeout = 30,
34+
Stdlib::Absolutepath $log_dir = '/var/log/foreman-proxy/openbolt',
35+
) {
36+
foreman_proxy::plugin::module { 'openbolt':
37+
template_path => 'foreman_proxy/plugin/openbolt.yml.erb',
38+
enabled => $enabled,
39+
feature => 'Openbolt',
40+
listen_on => $listen_on,
41+
version => $version,
42+
}
43+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
require 'spec_helper'
2+
3+
describe 'foreman_proxy::plugin::openbolt' do
4+
on_plugin_os.each do |os, os_facts|
5+
context "on #{os}" do
6+
let(:facts) { os_facts }
7+
let(:pre_condition) { 'include foreman_proxy' }
8+
let(:etc_dir) { '/etc' }
9+
10+
describe 'with default settings' do
11+
it { is_expected.to compile.with_all_deps }
12+
it { is_expected.to contain_foreman_proxy__plugin('openbolt') }
13+
it 'should configure openbolt.yml' do
14+
is_expected.to contain_file("#{etc_dir}/foreman-proxy/settings.d/openbolt.yml")
15+
.with_ensure('file')
16+
.with_owner('root')
17+
.with_group('foreman-proxy')
18+
19+
verify_exact_contents(catalogue, "#{etc_dir}/foreman-proxy/settings.d/openbolt.yml", [
20+
'---',
21+
':enabled: https',
22+
":environment_path: /etc/puppetlabs/code/environments/production",
23+
":workers: 20",
24+
":concurrency: 100",
25+
":connect_timeout: 30",
26+
":log_dir: /var/log/foreman-proxy/openbolt"
27+
])
28+
end
29+
end
30+
end
31+
end

templates/plugin/openbolt.yml.erb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#
2+
---
3+
:enabled: <%= @module_enabled %>
4+
:environment_path: <%= scope.lookupvar("foreman_proxy::plugin::openbolt::environment_path") %>
5+
:workers: <%= scope.lookupvar("foreman_proxy::plugin::openbolt::workers") %>
6+
:concurrency: <%= scope.lookupvar("foreman_proxy::plugin::openbolt::concurrency") %>
7+
:connect_timeout: <%= scope.lookupvar("foreman_proxy::plugin::openbolt::connect_timeout") %>
8+
:log_dir: <%= scope.lookupvar("foreman_proxy::plugin::openbolt::log_dir") %>

0 commit comments

Comments
 (0)