hello,
I'm getting into troubles while using rake (not important) for --noop
tests during modules development. Using
puppet apply -e 'include class'
everything works fine, but using .pp file containing exactly the same
puppet apply tests/class.pp
results in "Unknown function:" as shown below, where whole usecase is
documented.
Acording to strace myfunc.rb is found by lstat and fopen in both cases,
but in the latter (error one), myfunc.rb is searched also in gems
directories ...
any advice would be appreciated
thanks
bodik
===============================================
===============================================
root@tester:~/pb1# find .
./mod1
./mod1/manifests
./mod1/manifests/init.pp
./mod1/lib
./mod1/lib/facter
./mod1/lib/facter/myfunc.rb
./mod1/tests
./mod1/tests/init.pp
./run.sh
root@tester:~/pb1# cat ./mod1/manifests/init.pp
class mod1::puppet_function_resolution() {
notice(myfunc(1))
}
root@tester:~/pb1# cat ./mod1/lib/facter/myfunc.rb
# simple wrapper for custom execs
require "puppet"
module Puppet::Parser::Functions
newfunction(:myfunc, :type => :rvalue) do |args|
return "returned value"
end
end
root@tester:~/pb1# cat ./mod1/tests/init.pp
include mod1::puppet_function_resolution
root@tester:~/pb1# cat ./run.sh
#!/bin/sh
set -x
puppet apply --modulepath=/root/pb1 -e 'include
mod1::puppet_function_resolution' --noop
puppet apply --modulepath=/root/pb1 "mod1/tests/init.pp" --noop
root@tester:~/pb1# sh ./run.sh
+ puppet apply --modulepath=/root/pb1 -e include
mod1::puppet_function_resolution --noop
Notice: Scope(Class[Mod1::Puppet_function_resolution]): returned value
Notice: Compiled catalog for tester in environment production in 0.04
seconds
Notice: Applied catalog in 0.63 seconds
+ puppet apply --modulepath=/root/pb1 mod1/tests/init.pp --noop
Error: Evaluation Error: Unknown function: 'myfunc'. at
/root/pb1/mod1/manifests/init.pp:2:9 on node tester
root@tester:~/pb1# puppet --version
4.5.2
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/5821A30B.1040104%40cesnet.cz.
For more options, visit https://groups.google.com/d/optout.