Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

(#151) Install toml gem by default. #154

Merged
merged 2 commits into from
Jun 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions manifests/profile/master/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@
# @example Apply this class to the Master and any/all Compilers
# include puppet_metrics_dashboard::profile::master::install
#
class puppet_metrics_dashboard::profile::master::install {
class puppet_metrics_dashboard::profile::master::install (
Boolean $manage_ldap_auth = true,
) {

if $facts['pe_server_version'] {
$puppetserver_service = 'pe-puppetserver'
} else {
$puppetserver_service = 'puppetserver'
}

if $puppet_metrics_dashboard::enable_ldap_auth {
if $manage_ldap_auth {
package { 'toml':
ensure => present,
provider => 'puppetserver_gem',
Expand Down
48 changes: 48 additions & 0 deletions spec/classes/profile/master/install_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
require 'spec_helper'
describe 'puppet_metrics_dashboard::profile::master::install' do
on_supported_os.each do |os, facts|
context "with facter #{RSpec.configuration.default_facter_version} on #{os}" do
let(:node) do
'testhost.example.com'
end
let(:facts) do
facts.merge(pe_server_version: '2019.8.6')
end

context 'with defaults' do
let(:pre_condition) do
<<-PRE_COND
service { 'pe-puppetserver': ensure => running }
PRE_COND
end
let(:params) { { 'manage_ldap_auth' => true } }

it do
is_expected.to contain_package('toml')
.with_ensure('present')
end
it do
is_expected.to contain_package('toml-rb')
.with_ensure('present')
end
end

context 'manage_ldap_auth false' do
let(:pre_condition) do
<<-PRE_COND
service { 'pe-puppetserver': ensure => running }
PRE_COND
end
let(:params) { { 'manage_ldap_auth' => false } }

it do
is_expected.not_to contain_package('toml')
end
it do
is_expected.to contain_package('toml-rb')
.with_ensure('present')
end
end
end
end
end