Comments (6)
OK, so upon further investigation, its the resources { 'yumrepo': purge => true }
that is causing the error:
[root@linux01 ~]# puppet apply -e 'resources { "yumrepo": purge => true }'
Notice: Compiled catalog for linux01.vagrant.local in environment vagrant in 0.10 seconds
Error: /Stage[main]/Main/Resources[yumrepo]: Failed to generate additional resources using 'generate': Section "cr" is already defined, cannot redefine (file: /etc/yum.repos.d/CentOS-CR.repo)
Notice: Applied catalog in 0.08 seconds
However, I wonder why none of the others (base, updates, etc) caused this error too? Why CR? anyone?
from puppet-yum.
I need more information about how you added the CR repository. It might collide with the files from data/
.
FYI: I explained in issue #94 how to remove repositories.
from puppet-yum.
Steps to reproduce...
- Install CentOS 7.5 (or whatever latest -1 is)
- Remove all repos (
rm -rf /etc/yum.repos.d/*
)- NOTE: We do this because we do not have Internet access, and have to replace the OS provided repos with ones that get packages from an internal mirror (Artifactory in our case)
- Run puppet with the yum repo (
puppet apply -e 'include yum'
?) - Look at what is created in /etc/yum.repos.d ... should be like base.repo, updates.repo, cr.repo, etc
- Upgrade to the most recent (7.6 currently) CentOS... (
yum upgrade -y
) - Look again at what is in yum.repos.d (this time in addition to the files that puppet created, you will have several more files like CentOS-Base.repo, CentOS-CR.repo, etc., which are duplicates to the ones that puppet is managing
- Now, if you try purging yumrepo resources with
resources { yumrepo: purge => true }
in your puppet code, it will give an error similar to the one above (maybe not specifically "cr")
from puppet-yum.
So, I think based on everything else I have seen, the actual problem is the "yumrepo" type/provider. This module could workaround this issue using file resource backing and build the purge option in, rather than depending on the resources { yumrepo: purge => true }
.
Alternatively, the "cause" of this problem, which is an environment specific packer build script that removes all files from /etc/yum.repos.d, could be adjusted to truncate the file instead of removing it, which, since it is a "config" file in the repo, would not be overwritten.
I am going to close this one.
Thanks,
Tommy
from puppet-yum.
One other note, as of Puppet 6, the yumrepo resource type finally has a "target" parameter (that doesn't say not to use it) .. so the target could be set to the "expected" filename from the OS packages:
$ rpm -qV centos-release
missing c /etc/yum.repos.d/CentOS-Base.repo
missing c /etc/yum.repos.d/CentOS-CR.repo
missing c /etc/yum.repos.d/CentOS-Debuginfo.repo
missing c /etc/yum.repos.d/CentOS-Media.repo
missing c /etc/yum.repos.d/CentOS-Sources.repo
missing c /etc/yum.repos.d/CentOS-Vault.repo
missing c /etc/yum.repos.d/CentOS-fasttrack.repo
from puppet-yum.
If anyone else is being bit by this, instead of deleting the files in /etc/yum.repos.d, truncate them (make them empty). As they are "config" files, they will not be replaced during upgrades unless they are missing.
for file in /etc/yum.repos.d/CentOS-*; do cat /dev/null > $file; done
... then you can continue to use any "custom" files you have created. :)
~tommy
from puppet-yum.
Related Issues (20)
- Invalid configuration value: failovermethod=priority HOT 1
- How I can achieve puppet only managed repositories? HOT 3
- Package name must be formatted as %{EPOCH}:%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}, not 'String'. HOT 2
- CentOS Stream9 support
- RHEL8, epel-modular is installed with the wrong repo-name
- Use of puppetlabs-yumrepo_core HOT 1
- [RFE] arguments for defined types (versionlock/post_transaction_actions)
- dnf install yum-utils fails on RHEL8 when modifying baseurl and metalink => absent HOT 2
- unnecessary whitespace in gpg key file paths
- GPG key for EPEL repository isn't getting installed before Package resource that requires EPEL repository. HOT 4
- Redhat yum repo certificates have expired
- yum_updates fact: too slow HOT 1
- Revert #258 that added purge_unmanaged_repos
- Exclude versionlocked updates in fact yum_package_updates/yum_has_updates HOT 1
- Add support for Sangoma HOT 1
- Failed to call refresh: '/usr/bin/package-cleanup --oldkernels --count=2 -y' returned 1 instead of one of [0] HOT 4
- `init.pp` does not support `group` param, so `yum::group` in hiera does nothing
- Support dnf module management
- CI tests fail for OracleLinux 7 HOT 1
- The first element of the merge has wrong type, expects a Hash value, got String
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from puppet-yum.