From 500f69d74ade92fc22db1ad137f69c6a55506ddc Mon Sep 17 00:00:00 2001 From: Pat Riehecky Date: Tue, 30 Jun 2026 15:14:05 -0500 Subject: [PATCH] fix(stdlib::manage) parser fails `$type` resources aren't types The string definition of the type resource is not converted by the parser to the actual type definition. Signed-off-by: Pat Riehecky --- manifests/manage.pp | 6 ++---- spec/classes/manage_spec.rb | 10 +++------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/manifests/manage.pp b/manifests/manage.pp index cb8c3351a..d6b68e8dc 100644 --- a/manifests/manage.pp +++ b/manifests/manage.pp @@ -104,10 +104,8 @@ } else { $content = undef } - $type { $title: - * => $attributes - 'erb' - 'epp' - 'content', - content => $content, - } + $merged_attributes = ($attributes - 'erb' - 'epp' - 'content') + { 'content' => $content } + create_resources($type, { $title => $merged_attributes }) } default: { create_resources($type, { $title => $attributes }) diff --git a/spec/classes/manage_spec.rb b/spec/classes/manage_spec.rb index db4b6a64e..509c7c043 100644 --- a/spec/classes/manage_spec.rb +++ b/spec/classes/manage_spec.rb @@ -16,6 +16,9 @@ <<-PRECOND file { '/etc/motd.d' : } service { 'sshd' : } + + function epp(*$args) { 'I am an epp template' } + function template(*$args) { 'I am an erb template' } PRECOND end let :params do @@ -70,13 +73,6 @@ } end - Puppet::Functions.create_function(:epp) do - return 'I am an epp template' - end - Puppet::Functions.create_function(:template) do - return 'I am an erb template' - end - it { is_expected.to compile } it { is_expected.to contain_file('/etc/motd.d/hello').with_content('I say Hi').with_notify('Service[sshd]') } it { is_expected.to contain_file('/etc/motd').with_content(%r{I am an epp template}) }