Peter Meier
2008-Apr-28 16:21 UTC
[Puppet Users] Overwrite type which is defined in a a define
Hi
so I have now this class with the additional define:
---
class yum::centos {
yum::managed_yumrepo {base:
descr => ''CentOS-$releasever - Base'',
mirrorlist =>
''http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os'',
gpgcheck => 1,
gpgkey =>
''file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5'',
priority => 1,
}
}
define yum::managed_yumrepo (
$descr = ''absent'',
$baseurl = ''absent'',
$mirrorlist = ''absent'',
$enabled = 0,
$gpgcheck = 0,
$gpgkey = ''absent'',
$failovermethod = ''absent'',
$priority = 99){
# ensure that everything is setup
include yum::prerequisites
file{"/etc/yum.repos.d/${name}.repo":
ensure => file,
replace => false,
before => Yumrepo[$name],
require => File[yum_repos_d],
mode => 0644, owner => root, group => 0;
}
yumrepo{$name:
descr => $descr,
baseurl => $baseurl,
enabled => $enabled,
gpgcheck => $gpgcheck,
gpgkey => $gpgkey,
failovermethod => $failovermethod,
priority => $priority,
require => [ File[rpm_gpg],
Package[yum-priorities]
],
}
}
---
The idea was to have yum.repos.d automanaged (see mails some days ago).
I''d like to subclass now the first class and disable the repo:
---
class yum::centos::disable inherits yum::centos {
Yumrepo[base]{
enable => 0,
}
}
---
However this fails with the following error:
---
err: Could not retrieve catalog: Only subclasses can override parameters
---
Obviously the problem seems to be that Yumrepo[base] is defined in the
define. Therefor puppet doesn''t seem to see that type as actually being
defined in the class.
How could I solve this problem? Or would it be just easier to leave the
wrapper script away, which would mean that I would need to define for
every yumrepo an additional file.
thanks and greets pete
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com
To unsubscribe from this group, send email to
puppet-users-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en
-~----------~----~----~----~------~----~------~--~---
Luke Kanies
2008-Apr-28 18:40 UTC
[Puppet Users] Re: Overwrite type which is defined in a a define
On Apr 28, 2008, at 11:21 AM, Peter Meier wrote:> Obviously the problem seems to be that Yumrepo[base] is defined in the > define. Therefor puppet doesn''t seem to see that type as actually > being > defined in the class. > How could I solve this problem? Or would it be just easier to leave > the > wrapper script away, which would mean that I would need to define for > every yumrepo an additional file.Override the define, rather than the yumrepo. -- In theory, there is no difference between theory and practice; in practice, there is. -- Chuck Reid --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
Peter Meier
2008-Apr-29 13:45 UTC
[Puppet Users] Re: Overwrite type which is defined in a a define
Hi>> Obviously the problem seems to be that Yumrepo[base] is defined in the >> define. Therefor puppet doesn''t seem to see that type as actually >> being >> defined in the class. >> How could I solve this problem? Or would it be just easier to leave >> the >> wrapper script away, which would mean that I would need to define for >> every yumrepo an additional file. > > > Override the define, rather than the yumrepo.works perfectly. Didn''t know that one can overwrite defines. Thought that this is only for types. Or maybe I just couldn''t find it in the docu. greets Pete --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---