Host.url_for_boot not supported for Debian?

Hello there, folks!

Is there a reason these variables are not supported for Debian PXELinux
template type?

KERNEL <%= @host.url_for_boot(:kernel) %>
INITRD <%= @host.url_for_boot(:initrd) %>

I know this is "not recommended" vars but I really need HTTP instead of
TFTP (my pxelinux does support it).

In Debian PXELinux I get this error:

"There was an error rendering the Ubuntu_PXELinux template: undefined method `url_for_boot' for #<Debian:0x0000000c918398>"

I know Foreman has the HTTP URL to the above as it downloads both kernel
and initrd into TFTP boot dir, so how do I reference those variables? Of
course, it would be ideal if the vars the vars were more consistent.

Above works just fine for RedHat PXELinux templates:

#KERNEL http://installsvc.domain.com/images/redhat/7.1_64/images/pxeboot/vmlinuz
#INITRD http://installsvc.domain.com/images/redhat/7.1_64/images/pxeboot/initrd.img

Suggestions, ideas?

Thanks!

Hi,

··· On Tue, Apr 19, 2016 at 12:17:12PM -0700, 'Konstantin Orekhov' via Foreman users wrote: > I know Foreman has the HTTP URL to the above as it downloads both kernel > and initrd into TFTP boot dir, so how do I reference those variables? Of > course, it would be ideal if the vars the vars were more consistent.

Please see the current iPXE template for preseed:
https://github.com/theforeman/community-templates/blob/develop/preseed/iPXE.erb

This works even in safe mode.

Regards

Michael Moll

Yep, that worked - thanks a lot!

Just one more to follow up - are there some vars available to me in
"finish" template for Debian similar to @preseed_path and @preseed_server
in "preseed" template?

The closest one I see is @host.os.medium_uri(@host) which returns to me all
of the above but co-joined like this
http://<preseed_server>/<preseed_path>/<release_name>

Any way for me to avoid parsing and splitting the above?

Thanks again!

Please see the current iPXE template for preseed:

··· > > https://github.com/theforeman/community-templates/blob/develop/preseed/iPXE.erb >

Hi,

··· On Tue, Apr 19, 2016 at 02:49:36PM -0700, 'Konstantin Orekhov' via Foreman users wrote: > Just one more to follow up - are there some vars available to me in > "finish" template for Debian similar to @preseed_path and @preseed_server > in "preseed" template?

These should be usable also in the finish template just fine.

Regards

Michael Moll

Hmm, they are empty in my finish template. According to the doc, they are
only available in template type "provision" and only for Debian OS.

http://projects.theforeman.org/projects/foreman/wiki/templatewriting

So it is expected behavior, I'm just wondering if there's some undocumented
var(s) maybe.

··· > "finish" template for Debian similar to @preseed_path and @preseed_server > > in "preseed" template? > > These should be usable also in the finish template just fine. >

Hi,

> Hmm, they are empty in my finish template. According to the doc, they are
> only available in template type "provision" and only for Debian OS.

Strange, it works for me with current nightly packages. In the "Preseed
default finish" template I added:

preseed_path: <%= @preseed_path %>

preseed_server: <%= @preseed_server %>

which renders to:

preseed_path: /debian

preseed_server: ftp2.de.debian.org:80

when previewing the template on the respective host page.

Regards

··· On Tue, Apr 19, 2016 at 03:46:45PM -0700, 'Konstantin Orekhov' via Foreman users wrote: -- Michael Moll

I just re-ran it again and does not work in 1.10 for me. Must be a new
thing. Your nightly build is 1.12 or 1.11?

Strange, it works for me with current nightly packages. In the "Preseed

··· > default finish" template I added: > # preseed_path: <%= @preseed_path %> > # preseed_server: <%= @preseed_server %> > > which renders to: > # preseed_path: /debian > # preseed_server: ftp2.de.debian.org:80 > > when previewing the template on the respective host page. >