summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormdehaan@mdehaan.rdu.redhat.com <>2007-02-14 12:24:42 -0500
committerJim Meyering <jim@meyering.net>2007-02-14 12:24:42 -0500
commit09c6c7cc22dddc4354082b82d5eda447a0bdfb03 (patch)
tree90344cb74ad36d6c7b0a2e062ad3ef8ce88ee56b
parentd5971f58acb88a3c379debf18c30fe3afe98e09f (diff)
downloadthird_party-cobbler-09c6c7cc22dddc4354082b82d5eda447a0bdfb03.tar.gz
third_party-cobbler-09c6c7cc22dddc4354082b82d5eda447a0bdfb03.tar.xz
third_party-cobbler-09c6c7cc22dddc4354082b82d5eda447a0bdfb03.zip
Run check in post to ensure cobbler tree setup, such that distros/systems/profiles can be added immediately, without the need to run "sync" to create the base directories.
-rw-r--r--cobbler.pod12
-rw-r--r--cobbler.spec2
-rw-r--r--cobbler/action_check.py10
-rw-r--r--cobbler/action_sync.py49
4 files changed, 43 insertions, 30 deletions
diff --git a/cobbler.pod b/cobbler.pod
index 2b4abb9..07c2e96 100644
--- a/cobbler.pod
+++ b/cobbler.pod
@@ -252,11 +252,13 @@ B<cobbler system remove --name=string>
B<cobbler remove repo --name=string>
-=head2 APPLYING CONFIGURATIONS
+=head2 REBUILDING CONFIGURATIONS
B<cobbler sync>
-Cobbler sync must be run after changing /var/lib/cobbler/settings or manually editing kickstart templates or other internal files in /var/lib/cobbler. Cobbler sync's job is to make sure that the provisionable entities and the cobbler internal configuration are in sync.
+Cobbler sync is used to repair or rebuild the contents /tftpboot or /var/www/cobbler when something has changed behind the scenes. It brings the filesystem up to date with the configuration as understood by cobbler.
+
+Sync should be run whenever files in /var/www/cobbler are manually edited or when making changes to kickstart files. In practice, this should not happen often, though running sync too many times does not cause any adverse effects.
=head1 EXAMPLES
@@ -308,8 +310,6 @@ B<cobbler system add --name=AA:BB:CC:DD:EE:FE --profile=rhel4u3-dbservers>
B<cobbler report>
-B<cobbler sync>
-
=head2 REPOSITORY MIRRORING WORKFLOW
The following example shows how to set up a repo mirror for two repositories, and create a profile
@@ -327,8 +327,6 @@ B<cobbler reposync>
B<cobbler profile add --name=p1 --distro=existing_distro_name --kickstart=/etc/cobbler/kickstart_fc6.ks --repos="magicfooi386 magicbari386">
-B<cobbler sync>
-
See the expanded description towards the bottom of this manpage for further information about
repo management.
@@ -497,6 +495,8 @@ Enterprising users can edit the files in /var/lib/cobbler directly versus using
mechanism for user error here is to delete the files in /var/lib/cobbler. There are also a few configuration
files in /etc/cobbler that can be edited.
+Running "cobbler sync" is required to apply any changes that are made manually.
+
=head2 API
Cobbler also makes itself available as a Python API for use by higher level management software.
diff --git a/cobbler.spec b/cobbler.spec
index 5696e50..d529c74 100644
--- a/cobbler.spec
+++ b/cobbler.spec
@@ -46,7 +46,7 @@ test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT
%{__python} setup.py install --optimize=1 --root=$RPM_BUILD_ROOT
%post
-cobbler sync >/dev/null 2>/dev/null
+cobbler check >/dev/null 2>/dev/null
/sbin/chkconfig --add cobblersyslogd
diff --git a/cobbler/action_check.py b/cobbler/action_check.py
index 499f667..0fd9d3a 100644
--- a/cobbler/action_check.py
+++ b/cobbler/action_check.py
@@ -16,6 +16,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
import os
import re
import cobbler_msg
+import action_sync
class BootCheck:
@@ -41,6 +42,15 @@ class BootCheck:
self.check_tftpd_conf(status)
self.check_dhcpd_conf(status)
self.check_httpd(status)
+
+ # run just the earliest parts of the sync command here. The purpose of this is to
+ # allow "cobbler check" to be run initially by the RPM, creating initial directories
+ # that do not require cobbler sync to be run prior to add commands when using
+ # the minimize_syncs feature. A bit obscure, but useful...
+
+ syncer = action_sync.BootSync(self.config)
+ syncer.run(initial_only=True)
+
return status
def check_name(self,status):
diff --git a/cobbler/action_sync.py b/cobbler/action_sync.py
index 80fb90e..6fa1531 100644
--- a/cobbler/action_sync.py
+++ b/cobbler/action_sync.py
@@ -50,7 +50,7 @@ class BootSync:
self.settings = config.settings()
self.repos = config.repos()
- def run(self):
+ def run(self,initial_only=False):
"""
Syncs the current configuration file with the config tree.
Using the Check().run_ functions previously is recommended
@@ -59,17 +59,18 @@ class BootSync:
raise cexceptions.CobblerException("no_dir",self.settings.tftpboot)
# not having a /var/www/cobbler is ok, the app will create it since
# no other package has to own it.
- self.clean_trees()
+ self.clean_trees(no_deletes=initial_only)
self.copy_koan()
self.copy_bootloaders()
+ self.configure_httpd()
+ if initial_only:
+ return True
self.copy_distros()
self.validate_kickstarts()
- self.configure_httpd()
self.build_trees()
if self.settings.manage_dhcp:
- self.write_dhcp_file()
- self.restart_dhcp()
- # self.consider_restarting_apache()
+ self.write_dhcp_file()
+ self.restart_dhcp()
return True
def restart_dhcp(self):
@@ -249,9 +250,10 @@ class BootSync:
self.service("httpd", "reload")
- def clean_trees(self):
+ def clean_trees(self,no_deletes=False):
"""
- Delete any previously built pxelinux.cfg tree and virt tree info.
+ Delete any previously built pxelinux.cfg tree and virt tree info and then create
+ directories.
Note: for SELinux reasons, some information goes in /tftpboot, some in /var/www/cobbler
and some must be duplicated in both. This is because PXE needs tftp, and auto-kickstart
@@ -261,21 +263,22 @@ class BootSync:
"""
# clean out all of /tftpboot
- for x in os.listdir(self.settings.webdir):
- path = os.path.join(self.settings.webdir,x)
- if os.path.isfile(path):
- if not x.endswith(".py"):
- self.rmfile(path)
- if os.path.isdir(path):
- if not x in ["localmirror","repo_mirror","ks_mirror"] :
- # new versions of cobbler use repo_mirror for repos and ks_mirror for
- # basic kickstart tree core data. older versions just used "local_mirror" so we
- # do have to leave the "localmirror" in there to avoid breaking users on upgrades
- self.rmtree(path)
- self.rmtree(os.path.join(self.settings.tftpboot, "pxelinux.cfg"))
- self.rmtree(os.path.join(self.settings.tftpboot, "images"))
- self.rmfile(os.path.join(self.settings.tftpboot, "pxelinux.0"))
- self.rmfile(os.path.join(self.settings.tftpboot, "elilo-3.6-ia64.efi"))
+ if not no_deletes:
+ for x in os.listdir(self.settings.webdir):
+ path = os.path.join(self.settings.webdir,x)
+ if os.path.isfile(path):
+ if not x.endswith(".py"):
+ self.rmfile(path)
+ if os.path.isdir(path):
+ if not x in ["localmirror","repo_mirror","ks_mirror"] :
+ # new versions of cobbler use repo_mirror for repos and ks_mirror for
+ # basic kickstart tree core data. older versions just used "local_mirror" so we
+ # do have to leave the "localmirror" in there to avoid breaking users on upgrades
+ self.rmtree(path)
+ self.rmtree(os.path.join(self.settings.tftpboot, "pxelinux.cfg"))
+ self.rmtree(os.path.join(self.settings.tftpboot, "images"))
+ self.rmfile(os.path.join(self.settings.tftpboot, "pxelinux.0"))
+ self.rmfile(os.path.join(self.settings.tftpboot, "elilo-3.6-ia64.efi"))
# make some directories in /tftpboot
for x in ["pxelinux.cfg","images"]: