I'm trying to use my first custom function *prefixPaths*.

The function is defined in:

my_module/lib/puppet/parser/functions/prefixPaths.rb


Listing:

module Puppet::Parser::Functions
    newfunction(:prefixPaths, :type => :rvalue) do |args|
        args[1].map{|path| "#{args[0]}/#{path}"}
    end
end


It's usage is e.g. *prefixPaths( 'base', [ 'A', 'path/to/B' ] ) => [ 
'base/A', 'base/path/to/B' ]*
*
*
I'm trying to use it in a Puppet manifest when creating a set of 
directories on the client:

    $bashScriptDir  = "bash-scripts"
    $karafScriptDir = "karaf-scripts"
    $userTypeDir    = "user-type-resources"
    $resourceDirs   = [$bashScriptDir,$karafScriptDir,$userTypeDir]
    file { 'Create common dirs.':
        path => $localPaths,
        ensure => 'Directory'
    }

However, when I use this the following error results:

err: Failed to apply catalog: Parameter path failed: File paths must be 
fully qualified, not 
'/fuse/common/bash-scripts/fuse/common/karaf-scripts/fuse/common/user-type-resources'
 
at /etc/puppet/gitmodules/app_fuse/manifests/init.pp:113


It looks like it's flattening the array.

I've seen another conversation on here indicating arrays are permitted to 
be used as custom function return values.

Would someone be kind enough to indicate what I'm doing wrong?

I'm on Puppet version 2.7.6 .

Sincere thanks for your time. 

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/oGz4QjGWNzgJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to