fix(stdlib::manage) parser fails $type resources#1477
Conversation
|
@jcpunk Did this ever work? I think there's an issue with the tests, and the |
|
If I comment out the but fail with... which is presumably the issue you are fixing. (This error happens regardless of the |
|
To fix the tests, mock diff --git a/spec/classes/manage_spec.rb b/spec/classes/manage_spec.rb
index db4b6a64..509c7c04 100644
--- a/spec/classes/manage_spec.rb
+++ b/spec/classes/manage_spec.rb
@@ -16,6 +16,9 @@ describe 'stdlib::manage' do
<<-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 @@ describe 'stdlib::manage' do
}
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}) }Without this with that change to the spec test, (and your fix) |
alexjfisher
left a comment
There was a problem hiding this comment.
Looks good, but please fix the tests too.
(and also update the commit message, as the fix isn't related to |
The string definition of the type resource is not converted by the parser to the actual type definition. Signed-off-by: Pat Riehecky <riehecky@fnal.gov>
|
When I tested the initial patch I'd swear it did work. But I'm unable to replicate it now. Someone I'm not going to name publicly, swapped out my fetch of my internal fork to a different branch with this fix applied but no internal ticket noting the change. So, as the initial patch author, I'll own the breakage since it is in fact broken and I wrote it.... I've manually ensured my test environment on my pilot server works from the branch on this PR (rather than my internal mirror). Does the updated PR look better? |
$type resources$type resources
No worries. Fix looks correct however we got here, (and apologies if the tone of my posts came across accusatory). I can't remember a similar case where rspec-puppet tests were silently not run. I enjoyed figuring that one out! |
|
:) no worries |
|
Thanks for the merge, any chance for a 10.0.2 release? |
Summary
When the puppet parser is set to its strictest mode,
$typeis not converted to the actual type and instead produces a catalog error.Eventually the strict parser will be required everywhere, so we should prepare for it.
pdk test unitworks just fine. It appears to not require the strict parser.Additional Context
Add any additional context about the problem here.
Related Issues (if any)
3cf1f1e
Checklist
puppet apply)