Bug #2062

yumrepo resource does not support multiple repos per file

Added by Trevor Hemsley about 3 years ago. Updated 9 months ago.

Status:Accepted Start date:03/09/2009
Priority:Low Due date:
Assignee:- % Done:

0%

Category:yumrepo
Target version:-
Affected Puppet version:0.24.7 Branch:
Keywords:
Votes: 0

Description

Many of the files in /etc/yum.repos.d on Centos/Redhat contain multiple repos within a single file. Using the yumrepo resource it is not possible to manage the contents of these files. Example:

Cobbler installs a file called /etc/yum.repos.d/cobbler-config.repo which contains

name=core-0
baseurl=http://your.url:80/cobbler/ks_mirror/Centos5.2-i386
enabled=1
gpgcheck=1

[Centos5-x86_64-UPDATES]
name=Centos5-x86_64-UPDATES
baseurl=http://your.url:80/cobbler/repo_mirror/Centos5-i386-UPDATES
enabled=1
gpgcheck=1

Defining a yumrepo {“core-0”:} allows you to manage the first of these repos inside the file but if you attempt to define a yumrepo {“Centos5-x86_64-UPDATES”: } resource then puppet will create a new file containing a duplicate definition.

History

Updated by James Turnbull about 3 years ago

  • Status changed from Unreviewed to Accepted
  • Assignee set to Puppet Community
  • Target version set to 4

Updated by Jonathan Booth about 3 years ago

My tests using a epel.repo on RHEL5/puppet 0.24.6 seemed to let me edit all three entries in the epel.repo file just fine.

Now when I removed the epel-release rpms and let my same huge yumrepo definitions try to create everything for me, they generated multiple files rather than stuffing things into a collective file. The only problem with this I see is that if I installed epel-release after my yumrepo definitions have created 20 files, then I’ll have duplicates (it’ll just replace my epel.repo without removing epel-source.repo and epel-debuginfo.repo).

Is the original request just requesting that yumrepo get a file=> parameter? Or is it a request to fix a broken repo from another application?

Updated by Trevor Hemsley about 3 years ago

My vanilla Centos 5 installation installs a single file, /etc/yum.repos.d/CentOS-Base.repo that contains several repos, base, updates, addons, extras and centosplus. If I try to enable/disable any of these using puppet yumrepo definitions then they will create new files called the name of the individual repo and will clash with the contents of the file shipped by Centos. The behaviour I was expecting was that puppet would find the repo inside a file and use that in preference to creating a new one.

Centos themselves ship repo files that contain multiple repos so I think you have to treat that as accepted practice and work out how to manage them.

Updated by Jonathan Booth about 3 years ago

From epel-release’s “/etc/yum.repo.d/epel.repo”, modified with the puppet config below:

[epel]
name=Extra Packages for Enterprise Linux 5 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/5/$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL

baseurl=http://my.server/pub/monthly/epel/5/$basearch
[epel-debuginfo]
name=Extra Packages for Enterprise Linux 5 - $basearch - Debug
#baseurl=http://download.fedoraproject.org/pub/epel/5/$basearch/debug
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
gpgcheck=1

baseurl=http://my.server/pub/monthly/epel/5/$basearch/debug
[epel-source]
name=Extra Packages for Enterprise Linux 5 - $basearch - Source
#baseurl=http://download.fedoraproject.org/pub/epel/5/SRPMS
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
gpgcheck=1
baseurl=http://my.server/pub/monthly/epel/5/SRPMS

My puppet definitions:

        file {
                "/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL":
                        owner => root, group => root, mode => 0444,
                        source => "puppet://$servername/yum/RPM-GPG-KEY-EPEL";
        }
        Yumrepo {
                mirrorlist => absent,
                enabled => 0,
                gpgcheck => 1,
                gpgkey => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL",
                require => File["/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL"]
        }
        $server = "http://my.server/pub/monthly"
        # Note that EPEL hardcodes the RHEL 3/4/5 version, so $operatingsystemrelease isn't escaped here!
        yumrepo {
                "epel":
                        enabled => 1,
                        descr => "Extra Packages for Enterprise Linux $operatingsystemrelease - \$basearch",
                        baseurl => "$server/epel/$operatingsystemrelease/\$basearch";
                "epel-debuginfo":
                        descr => "Extra Packages for Enterprise Linux $operatingsystemrelease - \$basearch - Debug",
                        baseurl => "$server/epel/$operatingsystemrelease/\$basearch/debug";
                "epel-source":
                        descr => "Extra Packages for Enterprise Linux $operatingsystemrelease - \$basearch - Source",
                        baseurl => "$server/epel/$operatingsystemrelease/SRPMS";
                "epel-testing":
                        descr => "Extra Packages for Enterprise Linux $operatingsystemrelease - Testing - \$basearch",
                        baseurl => "$server/epel/testing/$operatingsystemrelease/\$basearch";
                "epel-testing-debuginfo":
                        descr => "Extra Packages for Enterprise Linux $operatingsystemrelease - Testing - \$basearch - Debug",
                        baseurl => "$server/epel/testing/$operatingsystemrelease/\$basearch/debug";
                "epel-testing-source":
                        descr => "Extra Packages for Enterprise Linux $operatingsystemrelease - Testing - \$basearch - Source",
                        baseurl => "$server/epel/testing/$operatingsystemrelease/SRPMS";
        }

As I said, it works for me. Things only get confused if I puppet first and then install epel-release, at which point it doesn’t create epel.repo, it creates epel.repo.rpmnew instead (config file already exists, so rpm doesn’t clobber it). It is possible this is a 0.24.7-specific bug because my RHEL5 box only has 0.24.6.

You might need the ‘descr’ lines set and matching to make it work? I hadn’t tested without them.

Updated by James Turnbull almost 3 years ago

  • Assignee deleted (Puppet Community)

Updated by James Turnbull 9 months ago

  • Target version deleted (4)

Also available in: Atom PDF