Skip to content

Commit 6850041

Browse files
(PE-40350) add module version to logging
1 parent 93bb3e1 commit 6850041

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

functions/log_plan_parameters.pp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
function peadm::log_plan_parameters(Hash $params) {
2+
out::message("PEADM Module version: ${peadm::module_version()}")
23
$params.each |$key, $value| {
34
out::message("Parameter '${key}': [${value}]")
45
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Puppet::Functions.create_function(:'peadm::module_version', Puppet::Functions::InternalFunction) do
2+
dispatch :module_version do
3+
scope_param
4+
end
5+
6+
def module_version(scope)
7+
scope.compiler.environment.module('peadm').version
8+
end
9+
end

spec/plans/install_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55

66
describe 'basic functionality' do
77
it 'runs successfully with the minimum required parameters' do
8+
allow_out_message
89
expect_plan('peadm::subplans::install')
910
expect_plan('peadm::subplans::configure')
1011
expect(run_plan('peadm::install', 'primary_host' => 'primary', 'console_password' => 'puppetLabs123!', 'version' => '2021.7.9')).to be_ok
11-
allow_any_instance_of(Out).to receive(:message).and_return(true)
1212
end
1313
end
1414
end

spec/plans/subplans/install_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
#########
2828
## <🤮>
29-
rubocop:disable AnyInstance
29+
# rubocop:disable AnyInstance
3030
allow(Tempfile).to receive(:new).and_call_original
3131
allow(Pathname).to receive(:new).and_call_original
3232
allow(Puppet::FileSystem).to receive(:exist?).and_call_original

0 commit comments

Comments
 (0)