puppet here

Tired of typing puppet://$server/module/$module/...? Here to the rescue:

module Puppet::Parser::Functions
	newfunction(:here, :type => :rvalue) do |args|
		"puppet://%s/modules/%s/%s" % [ lookupvar('servername'), lookupvar('module_name'), args[0] ]
	end
end

Put it in $module/lib/puppet/parser/functions/here.rb, use with:

file {
	ensure => ...
	...
	source => here('foo.txt');
}