(PUP-7174) Add 'call' to the Puppet built in language functions#5609
(PUP-7174) Add 'call' to the Puppet built in language functions#5609hlindberg merged 1 commit intopuppetlabs:masterfrom
Conversation
|
Tests are failing with this error: |
spec/unit/functions/call_spec.rb
Outdated
|
|
||
| it 'call on a Puppet language function with no arguments' do | ||
| expect(compile_to_catalog(<<-CODE)).to have_resource('Notify[called]') | ||
| function call_me() { 'called' } |
There was a problem hiding this comment.
This does not seem to take - not sure why.
There was a problem hiding this comment.
That was the bug I was referring to on Slack that I thought I had found. I've tested the call function in a full environment and it works for namedspaced Puppet language functions. However, it does not work for a non-namespaced Puppet language function. And that seems like a bug in internal_call_function to me. Based on my reading of the code and the API notes it sounds like internal_call_function should work equally for all types of functions. The loader seems unable to find it, but how/why that occurs I don't know. I started digging into the pops code, but quickly got lost.
|
CLA signed by all contributors. |
5866c0f to
5188eb5
Compare
|
@hlindberg, I spent a bit more time looking into this one spec test failing and saw what I considered to be some surprising behavior. This is all tested on 2016.4.2 If I take an empty environment (without the and then create Then I get According to https://docs.puppet.com/puppet/4.7/lang_write_functions_in_puppet.html#aside-writing-functions-in-the-main-manifest I believe that it should work. Also interestingly, if I do: It also works in the agent/master scenario if I call the function directly in I feel like I am hitting the same (or a very similar) issue in the spec test. Given how simple the I think I've hit the limit of what I can diagnose. Any ideas? |
|
I'm not sure why the appveyor build failed - it looks to be an unrelated problem. However, I have refactored the spec tests a bit and they are all passing for all the original test cases. |
|
@seanmil the appveyor tests are failing because of a bug in a recent version of AppVeyor (errors related to UNC paths) - there are 4 failing tests (which we ignore for now). |
|
Thanks @seanmil for the contribution! |
Per PUP-7174