My head hurts from trying to figure this out for the past several hours . . . I want to determine what provider to use based on a fact (thanks for the suse version fact btw) but I ain''t gettin it: What''s wrong? Am I going down the completely wrong path? Is there a better way? # suse-yum.pp case $suse_repo_name { #sled10-i586: {Package{ provider => rug}} sled10-i586: {Package{ provider => yum[sled10-i586] }} sles10: {Package{ provider => yum["sles10-i586"] }} sles9-i586: {Package{ provider => yum["sles9-i586"] }} } $server = "puppet.example.com" class yumrepos-suse { yumrepo { sles9-i586: descr => ''SuSE Linux Enterprise Server 9'', enabled => 1, gpgcheck => 0, baseurl => "http://$server/sles9/" } yumrepo { sles10-i586: descr => ''SuSE Linux Enterprise Server 10'', enabled => 1, gpgcheck => 0, baseurl => "http://$server/sles10/" } yumrepo { sled10-i586: descr => ''SuSE Linux Enterprise Desktop 10'', enabled => 1, gpgcheck => 0, baseurl => "http://$server/sled10/" } } Any help GREATLY appreciated!!!! Jeff
Blake Barnett
2007-Apr-26 23:28 UTC
Re: Struggling to define multiple yum/rug repositories
On Apr 26, 2007, at 3:52 PM, Jeff Falgout wrote:> My head hurts from trying to figure this out for the past several > hours . . . > > I want to determine what provider to use based on a fact (thanks for > the suse version fact btw) but I ain''t gettin it: > > What''s wrong? Am I going down the completely wrong path? Is there a > better way? > > # suse-yum.pp > case $suse_repo_name { > #sled10-i586: {Package{ provider => rug}} > sled10-i586: {Package{ provider => yum[sled10-i586] }} > sles10: {Package{ provider => yum["sles10-i586"] }} > sles9-i586: {Package{ provider => yum["sles9-i586"] }} > }I don''t believe the provider takes parameters. It should be "provider => yum" (= only? that''s what the example shows...) only. I believe the yumrepo name should match the release that the OS reports. yumrepo { "sled-10-i586": ...} should probably be more like what they have on this page as an example: http://www.reductivelabs.com/trac/puppet/wiki/PuppetSuSE -Blake
> > > > What''s wrong? Am I going down the completely wrong path? Is there a > > better way? > > > > # suse-yum.pp > > case $suse_repo_name { > > #sled10-i586: {Package{ provider => rug}} > > sled10-i586: {Package{ provider => yum[sled10-i586] }} > > sles10: {Package{ provider => yum["sles10-i586"] }} > > sles9-i586: {Package{ provider => yum["sles9-i586"] }} > > } > > I don''t believe the provider takes parameters. It should be > "provider => yum" (= only? that''s what the example shows...) only. I > believe the yumrepo name should match the release that the OS reports. > > yumrepo { "sled-10-i586": ...} should probably be more like what they > have on this page as an example: > http://www.reductivelabs.com/trac/puppet/wiki/PuppetSuSE >I suspected you couldn''t pass parameters to a provider. I spent a fair amount of time working off the example at http://www.reductivelabs.com/trac/puppet/wiki/PuppetSuSE and all of the yum repos I have defined get pushed out to the clients - even the repos that I don''t want there. What does work for me is: # cat suse-yum.pp case $suse_repo_name { sled10-i586: {include yumrepos-sled10-i586} sles10-i586: {include yumrepos-sles10-i586} sles9-i586: {include yumrepos-sles9-i586} } $server = "puppet.example.com" class yumrepos-sles9-i586 { # SLES 9 yumrepo { sles9-i586: descr => ''SuSE Linux Enterprise Server 9'', enabled => 1, gpgcheck => 0, baseurl => "http://$server/sles9/" } } class yumrepos-sled10-i586 { yumrepo { sled10-i586: descr => ''SuSE Linux Enterprise Desktop 10'', enabled => 1, gpgcheck => 0, baseurl => "http://$server/sled10/" } } class yumrepos-sles10-i586 { yumrepo { sled10-i586: descr => ''SuSE Linux Enterprise Server 10'', enabled => 1, gpgcheck => 0, baseurl => "http://$server/sles10/" } } Is this a valid way to handle multiple os''s and repos? Thanks for all the help, Jeff
On Apr 27, 2007, at 1:12 PM, Jeff Falgout wrote:> I suspected you couldn''t pass parameters to a provider. > > I spent a fair amount of time working off the example at > http://www.reductivelabs.com/trac/puppet/wiki/PuppetSuSE and all of > the yum repos I have defined get pushed out to the clients - even the > repos that I don''t want there. > > What does work for me is: > > # cat suse-yum.pp > case $suse_repo_name { > sled10-i586: {include yumrepos-sled10-i586} > sles10-i586: {include yumrepos-sles10-i586} > sles9-i586: {include yumrepos-sles9-i586} > }You should just be able to do this: include "yumrepos-$suse_repo_name" No need for the case statement. And your exmaple code creates repos with ''sled'' in the name for both sled and sles; might be a typo. -- There are three kinds of death in this world. There''s heart death, there''s brain death, and there''s being off the network. -- Guy Almes --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com
David Lutterkort
2007-Apr-27 23:23 UTC
Re: Struggling to define multiple yum/rug repositories
On Fri, 2007-04-27 at 12:12 -0600, Jeff Falgout wrote:> What does work for me is: > > # cat suse-yum.pp > case $suse_repo_name { > sled10-i586: {include yumrepos-sled10-i586} > sles10-i586: {include yumrepos-sles10-i586} > sles9-i586: {include yumrepos-sles9-i586} > }What I do is define a class that contains all the repos that are generally put down by an OS install, with all of them disabled: class yumrepos-fedora-core { yumrepo { core: descr => ''Fedora Core $releasever - $basearch'', mirrorlist => ''http://mirrors.fedoraproject.org/mirrorlist?repo=core-$releasever&arch=$basearch'', enabled => 0, gpgcheck => 1, gpgkey => ''file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY'' } yumrepo { core-debuginfo: descr => ''Fedora Core $releasever - $basearch - Debug'', mirrorlist => ''http://mirrors.fedoraproject.org/mirrorlist?repo=core-debug-$releasever&arch=$basearch'', enabled => 0, gpgcheck => 1, gpgkey => ''file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY'' } ... lots more .. and then create subclasses like class yum-fedora-released inherits yumrepos-fedora-core { Yumrepo[core] { enabled => 1 } Yumrepo[extras] { enabled => 1 } Yumrepo[updates] { enabled => 1 } } class yum-fedora-rawhide inherits yumrepos-fedora-core { Yumrepo[development] { enabled => 1 } Yumrepo[extras-development] { enabled => 1 } } that enable the repos that you generally want on on a machine that''s off a stable Fedora release resp. off Fedora rawhide. I also create subclasses to add in local repos, livna etc. That way, if you''re ever on the box and need to pull a debuginfo package, it''s a simple matter of enabling the appropriate repo on the yum command line. David
On 4/27/07, David Lutterkort <dlutter@redhat.com> wrote:> On Fri, 2007-04-27 at 12:12 -0600, Jeff Falgout wrote: > > What does work for me is: > > > > # cat suse-yum.pp > > case $suse_repo_name { > > sled10-i586: {include yumrepos-sled10-i586} > > sles10-i586: {include yumrepos-sles10-i586} > > sles9-i586: {include yumrepos-sles9-i586} > > } > > What I do is define a class that contains all the repos that are > generally put down by an OS install, with all of them disabled: > > class yumrepos-fedora-core { > yumrepo { core: > descr => ''Fedora Core $releasever - $basearch'', > mirrorlist => ''http://mirrors.fedoraproject.org/mirrorlist?repo=core-$releasever&arch=$basearch'', > enabled => 0, > gpgcheck => 1, > gpgkey => ''file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY'' > } > yumrepo { core-debuginfo: > descr => ''Fedora Core $releasever - $basearch - Debug'', > mirrorlist => ''http://mirrors.fedoraproject.org/mirrorlist?repo=core-debug-$releasever&arch=$basearch'', > enabled => 0, > gpgcheck => 1, > gpgkey => ''file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY'' > } > ... lots more .. > > and then create subclasses like > > class yum-fedora-released inherits yumrepos-fedora-core { > Yumrepo[core] { enabled => 1 } > Yumrepo[extras] { enabled => 1 } > Yumrepo[updates] { enabled => 1 } > } > > class yum-fedora-rawhide inherits yumrepos-fedora-core { > Yumrepo[development] { enabled => 1 } > Yumrepo[extras-development] { enabled => 1 } > } > > that enable the repos that you generally want on on a machine that''s off > a stable Fedora release resp. off Fedora rawhide. I also create > subclasses to add in local repos, livna etc. > > That way, if you''re ever on the box and need to pull a debuginfo > package, it''s a simple matter of enabling the appropriate repo on the > yum command line. > > David >And the AH-HA light pops on - Now I get it!!!! That explanation helps a lot. I had looked at your repositories earlier but they just didn''t sink in. Now I get em. Thanks for the help.
> > > > # cat suse-yum.pp > > case $suse_repo_name { > > sled10-i586: {include yumrepos-sled10-i586} > > sles10-i586: {include yumrepos-sles10-i586} > > sles9-i586: {include yumrepos-sles9-i586} > > } > > You should just be able to do this: > > include "yumrepos-$suse_repo_name" > > No need for the case statement.Ok - that makes things easier.> > And your exmaple code creates repos with ''sled'' in the name for both > sled and sles; might be a typo. > > --Yup - typo. Thanks Luke