-----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. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) Comment: Using GnuPG with Red Hat - http://enigmail.mozdev.org iD8DBQFIoS8whmd3WOiFct4RCm+PAJ9O9lrJrTHKNCJvFuJIQmdy2gRy6gCfV9Lf cYd6hC99b0Ius19Tvt30YPA= =Uvvh -----END PGP SIGNATURE----- _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list