Foreman didn't delete the tftp host specific config after kickstart

Hi All,

I am currently using foreman 1.6.1 to kickstart a CentOS VM via foreman
tftp smart-proxy, after kickstart, I notice that the host specific tftp
config file under /var/lib/tftpboot/pxelinux.cfg/ was not deleted, from
foreman 1.6 document, it says:

Workflow

This is a rough outline of the steps triggered on the TFTP smart proxy host
when you click on the "Build" link for a host.

  1. Call mkdir -p /var/lib/tftpboot/pxelinux.cfg if it does not already
    exist.
  2. Create a host-specific TFTP configuration file in
    /var/lib/tftpboot/pxelinux.cfg/01-XX-XX-XX-XX-XX-XX, named based off
    of the MAC address, using the associated PXE template.
  3. Call mkdir -p /var/lib/tftpboot/boot if it does not already exist.
  4. Download the OS specific kernel and initrd files using wget.
    1. The download URLs are derived from the installation media path,
      and OS specific log (see app/models/redhat.rb and debian.rb in
      foreman for examples of the gory details).
    2. The debian.rb file tries to guess if you want Ubuntu or Debian,
      based on the Name you give to your OS in the UI. If the name does not
      contain 'ubuntu' or 'debian', it may default to debian, hence fail to fetch
      the kernel/initrd.
    3. cd into /var/lib/tftpboot/boot and check that the filesizes are
      not zero. Check /var/log/foreman-proxy/proxy.log for possible errors.
  5. The exact wget command is

wget --no-check-certificate -nv -c -O ""

  1. At this point, the TFTP state is ready for the installation process.
  2. Once the host has completed installation, the OS specific
    installation script should inform foreman by retrieving the built URL.
  3. The host-specific TFTP configuration file is deleted.
  4. The kernel and initrd are not deleted, but left in place for future
    installs of the same OS and architecture combination. Please note that in
    the unlikely case that these files are modified, the simplistic freshness
    check of wget will likely get confused, corrupting the downloaded versions
    of the files. If this happens, you should simply delete the files and let
    them be re-downloaded from scratch.

Please see item 8, the host-specific tftp configuration file is deleted,
unfortunately, it was not deleted, instead, it was replaced by the content
in "PXELinux default local boot" template.

I have proxy.log when kickstart was finished:

10.241.32.77 - - [06/Nov/2014 16:21:13] "POST /syslinux/00:1a:4a:f1:20:80
HTTP/1.1" 200 - 0.0011

I think it just called an API to update the file instead of delete it.

Can someone please let me know how I can delete it, because once the host
was kickstarted, the tftp configuration file is no longer needed, and we
only need to keep a default tftp config file out there.

Thanks

Sinux

> I have proxy.log when kickstart was finished:
>
> 10.241.32.77 - - [06/Nov/2014 16:21:13] "POST /syslinux/00:1a:4a:f1:20:80
> HTTP/1.1" 200 - 0.0011
>
> I think it just called an API to update the file instead of delete it.
>
> Can someone please let me know how I can delete it, because once the host
> was kickstarted, the tftp configuration file is no longer needed, and we
> only need to keep a default tftp config file out there.

It's a behavior from versions older than 1.3.

We've changed that behavior and what you see is correct and expected
workflow. The change was introduce to support discovery plugin when
unknown hosts are configured to boot into discovery image.

··· -- Later, Lukas #lzap Zapletal

Thanks, Lukas,

I understand this, could you please let me know how I can call an API to
delete this file in the kickstart file.

Thanks
Sinux

··· On Thursday, November 6, 2014 9:43:05 PM UTC+8, Lukas Zapletal wrote: > > > I have proxy.log when kickstart was finished: > > > > 10.241.32.77 - - [06/Nov/2014 16:21:13] "POST > /syslinux/00:1a:4a:f1:20:80 > > HTTP/1.1" 200 - 0.0011 > > > > I think it just called an API to update the file instead of delete it. > > > > Can someone please let me know how I can delete it, because once the > host > > was kickstarted, the tftp configuration file is no longer needed, and we > > only need to keep a default tftp config file out there. > > It's a behavior from versions older than 1.3. > > We've changed that behavior and what you see is correct and expected > workflow. The change was introduce to support discovery plugin when > unknown hosts are configured to boot into discovery image. > > -- > Later, > Lukas #lzap Zapletal >

According to our modules/tftp/tftp_api.rb file, I think it should be
HTTP DELETE /tftp/MAC:ADDRESS:XX:XX:XX

LZ

··· On Thu, Nov 06, 2014 at 05:49:57PM -0800, sinux shen wrote: > > > On Thursday, November 6, 2014 9:43:05 PM UTC+8, Lukas Zapletal wrote: > > > > > I have proxy.log when kickstart was finished: > > > > > > 10.241.32.77 - - [06/Nov/2014 16:21:13] "POST > > /syslinux/00:1a:4a:f1:20:80 > > > HTTP/1.1" 200 - 0.0011 > > > > > > I think it just called an API to update the file instead of delete it. > > > > > > Can someone please let me know how I can delete it, because once the > > host > > > was kickstarted, the tftp configuration file is no longer needed, and we > > > only need to keep a default tftp config file out there. > > > > It's a behavior from versions older than 1.3. > > > > We've changed that behavior and what you see is correct and expected > > workflow. The change was introduce to support discovery plugin when > > unknown hosts are configured to boot into discovery image. > > > > -- > > Later, > > Lukas #lzap Zapletal > > > > Thanks, Lukas, > > I understand this, could you please let me know how I can call an API to > delete this file in the kickstart file. > > Thanks > Sinux


Later,
Lukas #lzap Zapletal