I'd like to call function File.basename
which is available in Ruby. Is it possible in puppet?
Something like:
$filename = basename($download_url)
I'd like to call function File.basename
which is available in Ruby. Is it possible in puppet?
Something like:
$filename = basename($download_url)
Ruby functions are not directly available in Puppet, but you can use inline_template:
meanwhile it is possible to use the puppetlabs-stdlib which provides a
basename()
function.No, you can not call arbitrary Ruby functions in a Puppet manifest, but you can do so in Puppet templates which use ERB. Have a look at the
inline_template
function, which might be useful for your use case.