Git Product home page Git Product logo

Comments (6)

TJM avatar TJM commented on July 30, 2024

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.

dhoppe avatar dhoppe commented on July 30, 2024

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.

TJM avatar TJM commented on July 30, 2024

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.

TJM avatar TJM commented on July 30, 2024

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.

TJM avatar TJM commented on July 30, 2024

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.

TJM avatar TJM commented on July 30, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.