I noticed that when I replicated from a master to a master and tried to go
in the reverse direction I didn't have all the same distro rsync repos on
the second master so the replication in the reverse direction failed. I
asked on irc and shenson said...
<shenson> need to put link_distro from contrib/cobbler_sync_master into
utils and then call it from both places
Here's a patch that fixed it for me...
# git diff HEAD
diff --git a/cobbler/action_replicate.py b/cobbler/action_replicate.py
index 1b75755..bfdab6f 100644
--- a/cobbler/action_replicate.py
+++ b/cobbler/action_replicate.py
@@ -159,6 +159,7 @@ class Replicate:
if not os.path.isdir(parentdir):
os.makedirs(parentdir)
self.rsync_it("distro-%s"%distro["name"],
dest)
+
self.logger.info("Rsyncing repos")
for repo in self.must_include["repo"].keys():
if self.must_include["repo"][repo] == 1:
@@ -182,6 +183,13 @@ class Replicate:
self.replace_objects_newer_on_remote(what)
+ def link_distros(self):
+
+ for distro in self.api.distros():
+ self.logger.debug("Linking Distro %s" % distro.name)
+ utils.link_distro(self.settings, distro)
+
+
def generate_include_map(self):
self.remote_names = {}
@@ -304,6 +312,7 @@ class Replicate:
self.local.ping()
self.replicate_data()
+ self.link_distros()
self.logger.info("Syncing")
self.api.sync()
self.logger.info("Done")
diff --git a/cobbler/utils.py b/cobbler/utils.py
index 50e0f19..67f243c 100644
--- a/cobbler/utils.py
+++ b/cobbler/utils.py
@@ -1876,6 +1876,24 @@ def dhcpconf_location(api):
else:
return "/etc/dhcp/dhcpd.conf"
+def link_distro(settings, distro):
+ # find the tree location
+ dirname = os.path.dirname(distro.kernel)
+ tokens = dirname.split("/")
+ tokens = tokens[:-2]
+ base = "/".join(tokens)
+ dest_link = os.path.join(settings.webdir, "links", distro.name)
+
+ # create the links directory only if we are mirroring because with
+ # SELinux Apache can't symlink to NFS (without some doing)
+
+ if not os.path.exists(dest_link):
+ try:
+ os.symlink(base, dest_link)
+ except:
+ # this shouldn't happen but I've seen it ... debug ...
+ print _("- symlink creation failed: %(base)s, %(dest)s") % {
"base" : base, "dest" : dest_link }
+
if __name__ == "__main__":
print os_release() # returns 2, not 3