diff options
author | David Lutterkort <dlutter@redhat.com> | 2006-10-27 17:42:46 -0700 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2006-10-27 17:42:46 -0700 |
commit | 68c6ec5f26e67d578e4629c817dddd187ff40510 (patch) | |
tree | 1f34d8d5a3da9c890ddcf5faacf3a065d6a4b61a | |
parent | 0efafa0d4b88b8975e23ad5315f42a11e578507e (diff) | |
download | third_party-cobbler-68c6ec5f26e67d578e4629c817dddd187ff40510.tar.gz third_party-cobbler-68c6ec5f26e67d578e4629c817dddd187ff40510.tar.xz third_party-cobbler-68c6ec5f26e67d578e4629c817dddd187ff40510.zip |
Add support for default PXE boots via /etc/cobbler/default.pxe; wrap
service reloads/restarts so they don't happen in dryrun mode; allow '-n' as
an alias for '--dryrun' when syncing.
-rw-r--r-- | MANIFEST.in | 1 | ||||
-rw-r--r-- | cobbler.spec | 3 | ||||
-rw-r--r-- | cobbler/action_sync.py | 23 | ||||
-rwxr-xr-x | cobbler/cobbler.py | 2 | ||||
-rw-r--r-- | default.pxe | 10 | ||||
-rw-r--r-- | setup.py | 1 |
6 files changed, 36 insertions, 4 deletions
diff --git a/MANIFEST.in b/MANIFEST.in index d18b423..283fc5b 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -3,5 +3,6 @@ include elilo-3.6-ia64.efi include dhcp.template include kickstart_fc5.ks include default.ks +include default.pxe include cobbler.1.gz include COPYING AUTHORS README CHANGELOG NEWS diff --git a/cobbler.spec b/cobbler.spec index 6f6820f..eaf8fde 100644 --- a/cobbler.spec +++ b/cobbler.spec @@ -39,6 +39,7 @@ test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT %config(noreplace) /etc/cobbler/default.ks %config(noreplace) /etc/cobbler/kickstart_fc5.ks %config(noreplace) /etc/cobbler/dhcp.template +%config(noreplace) /etc/cobbler/default.pxe %dir %{python_sitelib}/cobbler %dir %{python_sitelib}/cobbler/yaml %{python_sitelib}/cobbler/*.py* @@ -52,7 +53,7 @@ test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT %changelog -* Thr Oct 26 2006 Michael DeHaan <mdehaan@redhat.com> - 0.3.2-1 +* Thu Oct 26 2006 Michael DeHaan <mdehaan@redhat.com> - 0.3.2-1 - Upstream changes (see CHANGELOG) * Wed Oct 25 2006 Michael DeHaan <mdehaan@redhat.com> - 0.3.1-1 diff --git a/cobbler/action_sync.py b/cobbler/action_sync.py index fb7697a..60919e7 100644 --- a/cobbler/action_sync.py +++ b/cobbler/action_sync.py @@ -67,7 +67,7 @@ class BootSync: if self.settings.manage_dhcp: self.write_dhcp_file() try: - retcode = sub_process.call("/sbin/service dhcpd restart", shell=True) + retcode = self.service("dhcpd", "restart") if retcode != 0: print >>sys.stderr, "Warning: dhcpd restart failed" except OSError, e: @@ -172,7 +172,7 @@ class BootSync: config_data = config_data.replace("/cobbler_webdir",self.settings.webdir) self.tee(f, config_data) self.close_file(f) - sub_process.call("/sbin/service httpd reload", shell=True) + self.service("httpd", "reload") def clean_trees(self): """ @@ -369,6 +369,13 @@ class BootSync: # yaml file: http only self.write_profile_file(filename,p) + # Copy default PXE file if it exists; if there's none, ignore + # FIXME: Log something inobtrusive ifthe default file is missing + src = "/etc/cobbler/default.pxe" + if os.path.exists(src): + dst = os.path.join(self.settings.tftpboot, "pxelinux.cfg", "default") + self.copyfile(src, dst) + for system in self.systems: profile = self.profiles.find(system.profile) if profile is None: @@ -627,6 +634,18 @@ class BootSync: if not oe.errno == 17: # already exists (no constant for 17?) raise cexceptions.CobblerException("no_create", path) + def service(self, name, action): + """ + Call /sbin/service NAME ACTION, unless its a dryrun + """ + + cmd = "/sbin/service %s %s" % (name, action) + if self.dryrun: + print cmd + return 0 + else: + return sub_process.call(cmd, shell=True) + def blend_options(self, is_for_kernel, list_of_opts): """ Given a list of options, take the values used by the diff --git a/cobbler/cobbler.py b/cobbler/cobbler.py index 1be8e26..90f148d 100755 --- a/cobbler/cobbler.py +++ b/cobbler/cobbler.py @@ -297,7 +297,7 @@ class BootCLI: Sync the config file with the system config: 'cobbler sync [--dryrun]' """ status = None - if args is not None and "--dryrun" in args: + if args is not None and ("--dryrun" in args or "-n" in args): status = self.api.sync(dryrun=True) else: status = self.api.sync(dryrun=False) diff --git a/default.pxe b/default.pxe new file mode 100644 index 0000000..76a172c --- /dev/null +++ b/default.pxe @@ -0,0 +1,10 @@ +# This file is copied into /tftpboot/pxelinux.cfg/default +# and is the default boot file for systems that +# do not have a specific boot configuration. + +# Fall through to local boots +default local +timeout 1 +label local + localboot 0 + @@ -32,6 +32,7 @@ if __name__ == "__main__": (etcpath, ['kickstart_fc5.ks']), (etcpath, ['default.ks']), (etcpath, ['dhcp.template']), + (etcpath, ['default.pxe']), (manpath, ['cobbler.1.gz']) ], description = SHORT_DESC, |