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

(PUP-2916) yumrepo fails to honour custom reposdir #3227

Merged

Conversation

dnlsng
Copy link

@dnlsng dnlsng commented Oct 22, 2014

The yum.conf file wasn't being parsed for the reposdir which was causing the yumrepo provider to ignore the setting and just place the repo files into the default directory. Yum is then not seeing these repos as it has been configured to read files from the custom directory.

Also, self.repofiles was enumerating files from all directories that exist, i.e. the defaults directory and the custom directory. This created issues for puppet when the same repo existed in both directories. In reality, yum only parses the files in the custom directory if specified and ignores any files in the default directory.

@puppetcla
Copy link

Waiting for CLA signature by @dnlsng

@dnlsng - We require a Contributor License Agreement (CLA) for people who contribute to Puppet, but we have an easy click-through license with instructions, which is available at https://cla.puppetlabs.com/

Note: if your contribution is trivial and you think it may be exempt from the CLA, please post a short reply to this comment with details. http://docs.puppetlabs.com/community/trivial_patch_exemption.html

@puppetcla
Copy link

CLA signed by all contributors.

@dnlsng dnlsng changed the title (PUP 2916) yumrepo fails to honour custom reposdir (PUP-2916) yumrepo fails to honour custom reposdir Oct 24, 2014
Dir.glob("#{dir}/*.repo").each do |file|
files << file
end
Dir.glob("#{reposdir.last}/*.repo").each do |file|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A comment is needed here that explains the behavior - the code raises the question why "grabbing the resposdir.last" is the correct thing to do.

@hlindberg
Copy link
Contributor

Triage Notes:

  • This needs investigation regarding what the correct yum behavior is
  • @dnisng can you elaborate on this?
  • @ffrank to open ticket about spec tests mocking too much (not finding issue fixed in this PR)

@ffrank
Copy link
Contributor

ffrank commented Nov 13, 2014

Opened PUP-3667.

Not sure if this will help the situation with this particular issue, but it will make the tests more worthwhile.

@joshcooper
Copy link
Contributor

@dnlsng we had some concerns about why reposdir.last is used? Should the last repo directory always take precedence like that?

@jhoblitt
Copy link
Contributor

The handling of reposdir(s) in this PR is inconsistent with yum's behavior, which is to use .repo file(s) from all reposdir(s).

From the yum.conf(5) manpage:

              reposdir  A  list of directories where yum should look for .repo files which define repositories to use. Default is `/etc/yum.repos.d'. Each
              file in this directory should contain one or more repository sections as documented in [repository] options below. These will be merged with
              the repositories defined in /etc/yum.conf to form the complete set of repositories that yum will use.

I suspect the desired feature here is to be able to specify the directory in which the yumrepo resource is flushed? In that scenario, conflicting repo declarations that are active repodir(s) would need to be removed.

@jhoblitt
Copy link
Contributor

Note that repos declared directly in yum.conf will still be active.

@dnlsng
Copy link
Author

dnlsng commented Nov 26, 2014

Apologies for not getting back to these comments sooner as I haven't had a chance to look at this again until now. I was not aware that the reposdir setting could be a list of directories and it looks like that wouldn't even work with the current implementation.

Currently, self.reposdir returns an array with the value of reposdir (if it exists) and the default repo directory (/etc/yum.repos.d or /etc/yum/repos.d). In reality, the directory set in yum.conf for reposdir should replace the default reposdir. This patch just got around that by picking the last entry in the array, but I see that it is probably better to fix self.reposdir instead of changing self.repofiles.

I will have a look at this now and will update the PR.

@peterhuene
Copy link
Contributor

PR triage notes: waiting for update from contributor for feedback made in previous triage.

@dnlsng Thanks again for your contribution. Have there been any updates to this PR?

@MikaelSmith
Copy link
Contributor

PR triage notes: no changes noted.

@kylog kylog added the Unix label Jan 5, 2015
@joshcooper
Copy link
Contributor

@dnlsng Thank you for your contribution. I was wondering if you've had a change this review and update this PR?

@dnlsng dnlsng force-pushed the bug/stable/PUP-2916-fix-custom-reposdir branch from 1255f83 to 59724c3 Compare January 29, 2015 19:12
@dnlsng
Copy link
Author

dnlsng commented Jan 29, 2015

I finally had some time today to get around and updated this PR.

Rather than appending the reposdir directories to the default directories, it should replace them.

@puppetcla
Copy link

CLA signed by all contributors.

traylenator added a commit to cernops/puppet that referenced this pull request Feb 2, 2015
@ScottGarman
Copy link
Contributor

Hi @dnlsng - it looks like there are some unrelated commits in this PR that need to be rebased?

@MikaelSmith
Copy link
Contributor

In particular, you seem to have based your branch off stable and be targetting it against master.

@dnlsng dnlsng force-pushed the bug/stable/PUP-2916-fix-custom-reposdir branch from 59724c3 to 622bf0d Compare February 2, 2015 23:47
Daniel Sung added 2 commits February 2, 2015 23:49
Previously, find_conf_value was always returning nil, therefore the
custom reposdir setting was never appended onto the reposdir array.
…d of appending

When a custom reposdir is present in the yum.conf file, yum will only
read files from that directory/directories (plus yum.conf).

Previously, the yumrepo provider was reading all files from all
directories in the reposdir array including the default directory, even
though they would have been ignored by yum. This was an issue if the
same repo existed in both the default directory and the custom
directory. This change just replaces the default directories instead of
appending to them if reposdir is set.
@dnlsng dnlsng force-pushed the bug/stable/PUP-2916-fix-custom-reposdir branch from 622bf0d to c461f98 Compare February 2, 2015 23:50
@dnlsng
Copy link
Author

dnlsng commented Feb 2, 2015

Oops, how did I not notice that? I actually wanted to target stable as I would prefer that this fix be in place in 3.x but no matter, I have rebased it to master now.

@ScottGarman
Copy link
Contributor

Alright, I can give this my 👍

@traylenator
Copy link
Contributor

This is working well for us.

ScottGarman added a commit that referenced this pull request Feb 3, 2015
…eposdir

(PUP-2916) yumrepo fails to honour custom reposdir
@ScottGarman ScottGarman merged commit 649213e into puppetlabs:master Feb 3, 2015
@ScottGarman
Copy link
Contributor

@dnlsng Since this bug was reported as a regression, it should go into the stable branch as well. I'll create a separate PR for that.

@ScottGarman
Copy link
Contributor

PR-3585 has been created to get this fix into stable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.