I am trying to define a type to create yum repos. I want to be able to pull the data from common.yaml and have this define pull in that data and act upon it. I have not gotton that far and I am getting an error for a invalid paramter. My code is this..
define xh_yumrepo::create_xh_yumrepo (
$descr = '',
$baseurl = $baseurl,
$enabled = $enabled,
$gpgcheck = $gpgcheck,
){
$ensure = 'present'
notify{"title is $title":}
yumrepo { $title:
baseurl => $baseurl,
ensure => present,
descr => $descr,
enabled => $enabled,
gpgcheck => $gpgcheck,
}
}
class xh_system::xh_yumrepo (
$yumrepo=hiera_hash('xh_yumrepo', undef),
){
$os=$yumrepo[$operatingsystem]
$rel=$os[$operatingsystemmajrelease]
notify {"$rel":}
create_resources("@xh_yumrepo::create_xh_yumrepo",$rel)
Xh_yumrepo::Create_xh_yumrepo <| |>
}
the data is like this
CentOS:
"6":
epel-6:
descr: EPEL mirror for RHEL/CentOS 6.x 86_64
baseurl: http://repo.example.com:8080/epel/x86_64/6
enabled: 1
gpgcheck: 0
Every time it gets run the parameter ensure is
Error: Could not retrieve catalog from remote server: Error 400 on
SERVER: Invalid parameter ensure at
/app/copa/puppet/conf/environments/qa/modules/xh_system/manifests/xh_yumrepo.pp:17
on node qa-test.example.com
hardcoding the ensure parameter or defining it in the common.yaml give the same error. According to Type yumrepo it is a valid parameter. I am stuck on what is causing the error since the parameter is valid, commenting out the ensure lines the puppet script works.
Best Answer
The parameter
ensure
foryumrepo
is not really supported before Puppet 3.5.1. There are multiple issues even in 3.5.0. See this ticket.