how can I call ruby function basename in puppet
Solution 1:
Ruby functions are not directly available in Puppet, but you can use inline_template:
$filename = inline_template('<%= File.basename(download_url) %>')
Solution 2:
meanwhile it is possible to use the puppetlabs-stdlib which provides a basename()
function.
Returns the basename of a path (optionally stripping an extension).
basename('/path/to/a/file.ext') returns 'file.ext'
basename('relative/path/file.ext') returns 'file.ext'
basename('/path/to/a/file.ext', '.ext') returns 'file'