-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512
Good afternoon list, I've seen people asking for this feature from time to time. The code below comes from the RHEL5 branch but was commented out. Last time I've tested it with RHEL5 it was breaking.
I did some slight modifications to the original code and tested this with F9 and it works for me. As you can see only http(s) and ftp repos are written to config files.
- --- ~ yuminstall.py | 19 +++++++++++++++++++ ~ 1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/yuminstall.py b/yuminstall.py index ad7615a..dcff552 100644 - --- a/yuminstall.py +++ b/yuminstall.py @@ -1952,6 +1952,25 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon ~ f.write("-%s\n" % pkg)
~ def writeConfiguration(self): + emptyRepoConf = yum.config.RepoConf() + compulsorySettings = [ 'enabled', 'cost' ] + for repo in self.ayum.repos.listEnabled(): + for url in repo.urls: + if url.startswith('http://') or url.startswith('https://') or url.startswith('ftp://'): + fn = "%s/etc/yum.repos.d/%s.repo" % (self.instPath, repo.id) + f = open(fn , 'w') + f.write('[%s]\n' % (repo.id,)) + for k, v in emptyRepoConf.iteritems(): + repoval = repo.getAttribute(k) + if not (k in compulsorySettings): + if not repoval or (repoval == v): + # continue the k, v loop + continue + val = emptyRepoConf.optionobj(k).tostring(repoval) + f.write("%s=%s\n" % (k,val)) + f.close() + # break out of the urls loop + break ~ return
~ def getRequiredMedia(self):
Thanks, Alexander.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512
Alexander Todorov wrote: | Good afternoon list, | I've seen people asking for this feature from time to time. The code | below comes | from the RHEL5 branch but was commented out. Last time I've | tested it with RHEL5 it was breaking. | | I did some slight modifications to the original code and tested this | with F9 and | it works for me. As you can see only http(s) and ftp repos are written | to config | files. |
Good morning, anyone to review and comment on this patch please?
| --- | ~ yuminstall.py | 19 +++++++++++++++++++ | ~ 1 files changed, 19 insertions(+), 0 deletions(-) | | diff --git a/yuminstall.py b/yuminstall.py | index ad7615a..dcff552 100644 | --- a/yuminstall.py | +++ b/yuminstall.py | @@ -1952,6 +1952,25 @@ | reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon | | ~ f.write("-%s\n" % pkg) | | ~ def writeConfiguration(self): | + emptyRepoConf = yum.config.RepoConf() | + compulsorySettings = [ 'enabled', 'cost' ] | + for repo in self.ayum.repos.listEnabled(): | + for url in repo.urls: | + if url.startswith('http://') or | url.startswith('https://') or | url.startswith('ftp://'): | + fn = "%s/etc/yum.repos.d/%s.repo" % (self.instPath, | repo.id) | + f = open(fn , 'w') | + f.write('[%s]\n' % (repo.id,)) | + for k, v in emptyRepoConf.iteritems(): | + repoval = repo.getAttribute(k) | + if not (k in compulsorySettings): | + if not repoval or (repoval == v): | + # continue the k, v loop | + continue | + val = emptyRepoConf.optionobj(k).tostring(repoval) | + f.write("%s=%s\n" % (k,val)) | + f.close() | + # break out of the urls loop | + break | ~ return | | ~ def getRequiredMedia(self): | | |
Thanks, Alexander.
Hi,
Good morning, anyone to review and comment on this patch please?
The patch seems OK to me, but the policy of preference of repos after installation should be thought about. I think that the added install repos shouldn't be the preferred one - I'd rather even disable it by default because disabled repo wouldn't do any harm, and yet it could be useful.
Option of controlling the preference with values of 'cost' seems too fragile to me in this case. (Maybe we could let(force) the user set the preference by a new (ks) option if he wants to have the repo enabled after install.)
My view is based only on wild guesses about typical install scenarios.
Radek
On Mon, 2008-08-25 at 16:26 +0200, Radek Vykydal wrote:
Hi,
Good morning, anyone to review and comment on this patch please?
The patch seems OK to me, but the policy of preference of repos after installation should be thought about. I think that the added install repos shouldn't be the preferred one - I'd rather even disable it by default because disabled repo wouldn't do any harm, and yet it could be useful.
Option of controlling the preference with values of 'cost' seems too fragile to me in this case. (Maybe we could let(force) the user set the preference by a new (ks) option if he wants to have the repo enabled after install.)
My view is based only on wild guesses about typical install scenarios.
Why would you add a repo to your ks.cfg unless you wanted it to be preferred?
-sv
On Mon, 2008-08-25 at 10:52 -0400, Seth Vidal wrote:
On Mon, 2008-08-25 at 16:26 +0200, Radek Vykydal wrote:
Hi,
Good morning, anyone to review and comment on this patch please?
The patch seems OK to me, but the policy of preference of repos after installation should be thought about. I think that the added install repos shouldn't be the preferred one - I'd rather even disable it by default because disabled repo wouldn't do any harm, and yet it could be useful.
Option of controlling the preference with values of 'cost' seems too fragile to me in this case. (Maybe we could let(force) the user set the preference by a new (ks) option if he wants to have the repo enabled after install.)
My view is based only on wild guesses about typical install scenarios.
Why would you add a repo to your ks.cfg unless you wanted it to be preferred?
My concerns above was regarding the install tree repo (with baseurl of install method url) which is (for http/https/ftp methods) added to /etc/yum.repos.d by the patch, not repos added with "repo" to ks.cfg.
-sv
Anaconda-devel-list mailing list Anaconda-devel-list@redhat.com https://www.redhat.com/mailman/listinfo/anaconda-devel-list
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512
Radek Vykydal wrote: |>> My view is based only on wild guesses about typical install scenarios. |>>
A common use case I encounter often is: boot from any media and use local http server to install from. It's quicker than any other method and even quicker from mirrors since bits go over the LAN. However after install is completed one will have to configure the local repo once again.
|> Why would you add a repo to your ks.cfg unless you wanted it to be |> preferred? |> | | My concerns above was regarding the install tree repo (with baseurl of | install method url) which is (for http/https/ftp methods) added | to /etc/yum.repos.d by the patch, not repos added with "repo" to ks.cfg. |
~From the code text: ~ for url in repo.urls:
I haven't tested it explicitly with adding additional repos in ks.cfg but IMO this will iterate over all available repositories (install source, additional repos from ks.cfg, etc).
- -- Alexander.
On Tue, 2008-08-26 at 09:07 +0300, Alexander Todorov wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512
Radek Vykydal wrote: |>> My view is based only on wild guesses about typical install scenarios. |>>
A common use case I encounter often is: boot from any media and use local http server to install from. It's quicker than any other method and even quicker from mirrors since bits go over the LAN. However after install is completed one will have to configure the local repo once again.
If you think that staying with install repo as default after installation is better, OK. I just thought that it should be done explicitly by user action (by enabling it), but perhaps there is no valid reason.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512
Radek Vykydal wrote: | If you think that staying with install repo as default after | installation is better, OK. I just thought that it should be done | explicitly by user action (by enabling it), but perhaps there | is no valid reason. |
hmm, what means default in this context? I can see repo(s) with low cost which are preferred and then the stock repos (which point to mirrorlist). Both sets of repos are enabled by default. If the local (install) one fails for some reason (network failure, missing package) then yum will pick up the next repo and try to work with it. In the case other repos (i.e. not the install ones) have newer packages then yum will use them automatically. I don't see how both types of repos we're discussing conflict with each other. Please point me to a conflicting use case if you're aware of such.
Thanks, Alexander.
On Tue, 2008-08-26 at 10:37 +0300, Alexander Todorov wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512
Radek Vykydal wrote: | If you think that staying with install repo as default after | installation is better, OK. I just thought that it should be done | explicitly by user action (by enabling it), but perhaps there | is no valid reason. |
hmm, what means default in this context? I can see repo(s) with low cost which are preferred and then the stock repos (which point to mirrorlist). Both sets of repos are enabled by default. If the local (install) one fails for some reason (network failure, missing package) then yum will pick up the next repo and try to work with it. In the case other repos (i.e. not the install ones) have newer packages then yum will use them automatically.
Didn't know this, sorry for my ignorance.
I don't see how both types of repos we're discussing conflict with each other. Please point me to a conflicting use case if you're aware of such.
Then I don't have such and I'm OK with the patch.
Radek
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512
Radek Vykydal wrote: | Option of controlling the preference with values of 'cost' seems too | fragile to me in this case.
hmmm, wasn't the 'cost' invented to do exactly the same thing ?
On Tue, 2008-08-26 at 09:08 +0300, Alexander Todorov wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512
Radek Vykydal wrote: | Option of controlling the preference with values of 'cost' seems too | fragile to me in this case.
hmmm, wasn't the 'cost' invented to do exactly the same thing ?
I meant controlling the preference in this exact case (supposing 'cost' can be used also elsewhere) - i.e. if we change the cost values of repos installed to /etc/yum.repos.d from fedora-release package, or the value in media.repo for whatever reasons (but now it seems there are no such), we would have to bear in mind that it can change the behavior (preferred repo) after install. Again, probably baseless concerns from my side...
Radek
On Mon, 2008-08-25 at 16:26 +0200, Radek Vykydal wrote:
Good morning, anyone to review and comment on this patch please?
The patch seems OK to me, but the policy of preference of repos after installation should be thought about. I think that the added install repos shouldn't be the preferred one - I'd rather even disable it by default because disabled repo wouldn't do any harm, and yet it could be useful.
Actually, I thought that this all became moot with Chris's changes to use the repo files, etc in git master? The "default" case is you end up using one of the repos from a repo file. If you disable/add a repo/etc, then we were going to carry that over into the installed system iirc.
Jeremy
anaconda-devel@lists.stg.fedoraproject.org