Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default OS repositories layout messed up by yum module #132

Closed
cpeetersburg opened this issue Feb 18, 2019 · 2 comments
Closed

Default OS repositories layout messed up by yum module #132

cpeetersburg opened this issue Feb 18, 2019 · 2 comments
Labels
bug Something isn't working wont-fix This will not be worked on

Comments

@cpeetersburg
Copy link

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 5.5.10
  • Ruby: 2.4.5p33
  • Distribution: Centos 7.6.1810
  • Module version: 3.1.1

How to reproduce (e.g Puppet code you use)

I'm using roles and profiles so this is in my site/profile/manifests/base.pp

class { 'yum':
  manage_os_default_repos => true,
}

This is in my data/common.yaml

yum::managed_repos:
  - 'base'
  - 'updates'
  - 'extras'
  - 'centosplus'
  - 'example'
yum::repos:
  base:
    enabled: true
    baseurl: 'http://repo.example.org/CentOS/$releasever/os/$basearch/'
    mirrorlist: 'absent'
  updates:
    enabled: true
    baseurl: 'http://repo.example.org/CentOS/$releasever/updates/$basearch/'
    mirrorlist: 'absent'
  extras:
    enabled: true
    baseurl: 'http://repo.example.org/CentOS/$releasever/extras/$basearch/'
    mirrorlist: 'absent'
  centosplus:
    enabled: true
    baseurl: 'http://repo.example.org/CentOS/$releasever/centosplus/$basearch/'
    mirrorlist: 'absent'
  example:
    ensure: 'present'
    enabled: true
    descr: 'Example Repository'
    baseurl: 'http://repo.example.org/example/'
    gpgcheck: false
    target: '/etc/yum.repos.d/example.repo'

What are you seeing

When using the yum module to manage the default repositories, I get a messed up repofile. It still works, but it looks very chaotic because the whitespaces aren't correct. See the example below.

/etc/yum/repos.d/CentOS-Base.repo

[base]
name=CentOS-$releasever - Base
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
 
#released updates
baseurl=http://repo.example.org/CentOS/$releasever/os/$basearch/
enabled=1
[updates]
name=CentOS-$releasever - Updates
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

What behaviour did you expect instead

/etc/yum/repos.d/CentOS-Base.repo

[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
baseurl=http://repo.example.org/CentOS/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS-$releasever - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updatesinfra=$infra
baseurl=http://repo.example.org/CentOS/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

Output log

Any additional information you'd like to impart

The example repository is looking fine. There's a separate example.repo file which has the following contents:

[example]
name=Example Repository
baseurl=http://repo.example.org/example/
enabled=1
gpgcheck=0

In attachment also the CentOS-Base.repo file in 3 different versions (added .txt for Github support):

@dhoppe
Copy link
Member

dhoppe commented Apr 5, 2019

I am afraid there is nothing we can do about that. This module uses the resource type yumrepo which uses initial_setting and has the same side effect as you can see:

yumrepo { 'base':
  descr      => 'CentOS-$releasever - Base',
  baseurl    => 'http://repo.example.org/CentOS/$releasever/os/$basearch/',
  mirrorlist => 'absent',
  gpgkey     => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-${facts['os']['release']['major']}",
  enabled    => '1',
  gpgcheck   => '1',
  target     => '/etc/yum.repos.d/CentOS-Base.repo',
}
[vagrant@centos-7 yum.repos.d]$ diff -Naur /tmp/yum.repos.d/CentOS-Base.repo CentOS-Base.repo
--- /tmp/yum.repos.d/CentOS-Base.repo	2019-04-05 10:01:05.198449986 +0000
+++ CentOS-Base.repo	2019-04-05 11:03:12.928859128 +0000
@@ -12,12 +12,13 @@

 [base]
 name=CentOS-$releasever - Base
-mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
 #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
 gpgcheck=1
 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

 #released updates
+baseurl=http://repo.example.org/CentOS/$releasever/os/$basearch/
+enabled=1
 [updates]
 name=CentOS-$releasever - Updates
 mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra

@dhoppe dhoppe added bug Something isn't working wont-fix This will not be worked on labels Apr 5, 2019
This was referenced Oct 26, 2021
@bastelfreak
Copy link
Member

hey. This might be fixed with #225

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working wont-fix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants