[PATCH 3/3] Fix an issue in the previous pre-existing repo kickstart patch.
Vratislav Podzimek
vpodzime at redhat.com
Mon Jan 19 07:20:57 UTC 2015
On Fri, 2015-01-16 at 12:24 -0500, Chris Lumens wrote:
> The previous patch was intended to allow you to do this:
>
> repo --name=updates
>
> And then anaconda would read the pre-existing updates repo out of /etc
> and enable the repo. This worked, but it had one fatal flaw: because we
> read all the repos off disk, you couldn't then add your own repo with the
> same name as one of those pre-existing ones. This isn't normally a problem
> except for livecd kickstarts, and they do this all over the place.
>
> In yumpayload.py we solve this by letting a new repo delete the definition
> it would conflict with, so we need to do that in dnfpayload.py too.
> ---
> pyanaconda/packaging/dnfpayload.py | 27 ++++++++++++++++++---------
> 1 file changed, 18 insertions(+), 9 deletions(-)
>
> diff --git a/pyanaconda/packaging/dnfpayload.py b/pyanaconda/packaging/dnfpayload.py
> index 21c68b8..214988e 100644
> --- a/pyanaconda/packaging/dnfpayload.py
> +++ b/pyanaconda/packaging/dnfpayload.py
> @@ -227,8 +227,23 @@ class DNFPayload(packaging.PackagePayload):
> if mirrorlist:
> repo.mirrorlist = mirrorlist
> repo.sslverify = not (ksrepo.noverifyssl or flags.noverifyssl)
> - repo.enable()
> - self._base.repos.add(repo)
> +
> + # If this repo is already known, it's one of two things:
> + # (1) The user is trying to do "repo --name=updates" in a kickstart file
> + # and we should just know to enable the already existing on-disk
> + # repo config.
> + # (2) It's a duplicate, and we need to delete the existing definition
> + # and use this new one. The highest profile user of this is livecd
> + # kickstarts.
> + if repo.id in self._base.repos:
> + if not url and not mirrorlist:
> + self._base.repos[repo.id].enable()
> + else:
> + self._base.repos.pop(repo.id)
I must admit I don't understand this line. How does the new repo become
enabled? It's not really obvious and I think it deserves a comment in
the code.
--
Vratislav Podzimek
Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic
More information about the anaconda-patches
mailing list