git-diff version attached.
On Mon, Mar 10, 2008 at 11:10 AM, Bjorn Oglefjorn <[EMAIL PROTECTED]>
wrote:
> If you try currently you get duplicate enabled/gpgcheck lines in
> config.repo.
>
> patch: http://cobbler.pastebin.com/f132a692e
>
> I think the benefits of this small change are obvious. If anyone has a
> better, more pythonic way of doing this, have at. :)
>
> --Vito Laurenza
>
diff --git a/cobbler/action_reposync.py b/cobbler/action_reposync.py
index 32d38bd..c86e0be 100644
--- a/cobbler/action_reposync.py
+++ b/cobbler/action_reposync.py
@@ -235,6 +235,8 @@ class RepoSync:
config_file = open(fname, "w+")
config_file.write("[%s]\n" % repo.name)
config_file.write("name=%s\n" % repo.name)
+ optenabled = False
+ optgpgcheck = False
if output:
line = "baseurl=http://${server}/cobbler/repo_mirror/%s\n" %
(repo.name)
config_file.write(line)
@@ -242,15 +244,21 @@ class RepoSync:
# add them to the file
for x in repo.yumopts:
config_file.write("%s=%s\n" % (x, repo.yumopts[x]))
+ if x == "enabled":
+ optenabled = True
+ if x == "gpgcheck":
+ optgpgcheck = True
else:
line = "baseurl=%s\n" % repo.mirror
http_server = "%s:%s" % (self.settings.server,
self.settings.http_port)
line = line.replace("@@server@@",http_server)
config_file.write(line)
- config_file.write("enabled=1\n")
+ if not optenabled:
+ config_file.write("enabled=1\n")
config_file.write("priority=%s\n" % repo.priority)
# FIXME: potentially might want a way to turn this on/off on a
per-repo basis
- config_file.write("gpgcheck=0\n")
+ if not optgpgcheck:
+ config_file.write("gpgcheck=0\n")
config_file.close()
return fname_______________________________________________
et-mgmt-tools mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/et-mgmt-tools