#
# Usage:
#
# artifacts()
#
# Returns:
#
# Puppet hash containing artifact info.
#
# @author N David Brown
module Puppet::Parser::Functions
newfunction(:artifacts, :type => :rvalue) do |args|
# Info common to all artifacts.
_common = {
'pkg' => 'tar.gz',
'ver' => '7.1.0.fuse-041',
'repo' => 'http://maven/nexus/content/groups/fusesource-features-group'
}
# Bespoke info for artifacts.
_artifacts = {
'fabric' => {
'id' => 'fuse-fabric',
'grp' => 'org.fusesource.fabric'
}.merge!(_common), # merge in common artifact info
'fmc' => {
'id' => 'fmc-distro',
'grp' => 'org.fusesource.fmc'
}.merge!(_common) # merge in common artifact info
}
return _artifacts
end
end
Earlier I was pointing out that moving _common and _artifacts above the module... line means they can't be accessed by the new function definition.
I thought that might work to make them accessible from a require in a standard Ruby file, having seen require be used at that scope in example Puppet custom functions in the official documentation.
Cheers,
Dave
--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To post to this group, send email to puppet...@googlegroups.com.
To unsubscribe from this group, send email to puppet-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
This message has been checked for all known viruses by the Postini Virus Control Centre.