0fc013377b
This patch adds support for managing repos for major distros, separated by osfamily at the top level and operatingsystem below that. Since redhat, fedora and centos can all install from rdo, which is the only current option, the fedora and centos classes simply wrap around the redhat one. This may change in the future if any of them change (for example if RHOS support is added and redhat is now different to fedora) Change-Id: I5b18f393999d6f70757a2dfd9b12da049d6b64e1
60 lines
1.2 KiB
Ruby
60 lines
1.2 KiB
Ruby
module Puppet::Parser::Functions
|
|
|
|
yumrepo_arguments = [
|
|
'name',
|
|
'ensure',
|
|
'baseurl',
|
|
'cost',
|
|
'descr',
|
|
'enabled',
|
|
'enablegroups',
|
|
'exclude',
|
|
'failovermethod',
|
|
'gpgcheck',
|
|
'gpgkey',
|
|
'http_caching',
|
|
'include',
|
|
'includepkgs',
|
|
'keepalive',
|
|
'metadata_expire',
|
|
'metalink',
|
|
'mirrorlist',
|
|
'priority',
|
|
'protect',
|
|
'provider',
|
|
'proxy',
|
|
'proxy_password',
|
|
'proxy_username',
|
|
'repo_gpgcheck',
|
|
's3_enabled',
|
|
'skip_if_unavailable',
|
|
'sslcacert',
|
|
'sslclientcert',
|
|
'sslclientkey',
|
|
'sslverify',
|
|
'target',
|
|
'timeout'
|
|
]
|
|
|
|
newfunction(:validate_yum_hash) do |args|
|
|
if args.size > 1
|
|
raise Puppet::Error, "validate_yum_hash takes only a single argument, #{args.size} provided"
|
|
end
|
|
arg = args[0]
|
|
|
|
if not arg.kind_of?(Hash)
|
|
raise Puppet::Error, "non-hash argument provided to validate_yum_hash"
|
|
end
|
|
|
|
if arg.size > 0
|
|
arg.each do |title, params|
|
|
params.each do |param, value|
|
|
if ! yumrepo_arguments.include?(param)
|
|
raise Puppet::Error, "Parameter #{param} is not valid for the yumrepo type"
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|