1.11.2 lost few template vars?

Hello, folks!

After upgrading to 1.11.2 from 1.11.1 (for DHCP API performance
improvements), I found that my Foreman provisioning is broken in several
places.

  1. "<% kernel, initrd =
    @host.operatingsystem.boot_files_uri(@host.medium,@host.architecture) -%>
    "
    from PXELinux template used to return these:

KERNEL http://installsvc.domain.com/images/ubuntu/trusty/dists/trusty/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/linux
INITRD http://installsvc.domain.com/images/ubuntu/trusty/dists/trusty/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/initrd.gz

now it complains and gives me this:

There was an error rendering the Ubuntu_PXELinux template: ERF42-8219 [Foreman::Exception]: Invalid medium for Ubuntu 14.04

  1. no @preseed_path or @preseed_server vars populated in neither PXELinux or provisioning templates. They are just empty, but used to be:

http://installsvc.domain.com:80/images/ubuntu/trusty

  1. "<%= @host.os.medium_uri(@host) %>" used in finish script to get this:

http://installsvc.domain.com/images/ubuntu/trusty

now gives me this error:

There was an error rendering the Ubuntu_postinstall template: The snippet 'Ubuntu_repos' threw an error: undefined method `path' for nil:NilClass

Did my upgrade go wrong or what happened, any ideas?

Thanks!

Hello,

I think it might be related to [1]. Could you try reverting the patch to see
if the helps? In such case I'd recommend reporting a new issue with link to
[1].

http://projects.theforeman.org/issues/15009

Hope this helps

··· -- Marek

On Friday 03 of June 2016 19:33:13 ‘Konstantin Orekhov’ via Foreman users wrote:

Hello, folks!

After upgrading to 1.11.2 from 1.11.1 (for DHCP API performance
improvements), I found that my Foreman provisioning is broken in several
places.

  1. "<% kernel, initrd =
    @host.operatingsystem.boot_files_uri(@host.medium,@host.architecture) -%>
    "
    from PXELinux template used to return these:

KERNEL
http://installsvc.domain.com/images/ubuntu/trusty/dists/trusty/main/install
er-amd64/current/images/netboot/ubuntu-installer/amd64/linux INITRD
http://installsvc.domain.com/images/ubuntu/trusty/dists/trusty/main/install
er-amd64/current/images/netboot/ubuntu-installer/amd64/initrd.gz

now it complains and gives me this:

There was an error rendering the Ubuntu_PXELinux template: ERF42-8219
[Foreman::Exception]: Invalid medium for Ubuntu 14.04

  1. no @preseed_path or @preseed_server vars populated in neither PXELinux or
    provisioning templates. They are just empty, but used to be:

http://installsvc.domain.com:80/images/ubuntu/trusty

  1. <%= @host.os.medium_uri(@host) %>” used in finish script to get this:

http://installsvc.domain.com/images/ubuntu/trusty

now gives me this error:

There was an error rendering the Ubuntu_postinstall template: The snippet
’Ubuntu_repos’ threw an error: undefined method `path’ for nil:NilClass

Did my upgrade go wrong or what happened, any ideas?

Thanks!

Unfortunately that did not help at all :frowning: I'm getting the same errors
after moving that definition out of private space…

BTW, after I rolled back to 1.11.2 version and tried to use boot_uri in
PXELinux like this:

<snip>
<% kernel = boot_files_uris[0] -%>
<% initrd = boot_files_uris[1] -%>
KERNEL <%= kernel %>
INITRD <%= initrd %>
<snip>

I've got this error:

There was an error rendering the eBay_Ubuntu_PXELinux template: undefined local variable or method `boot_files_uris' for #<#<Class:0x007f23e963c040>:0x0000000b451c98>

Any other suggestions/ideas?

Thanks!

I checked all commits between 1.11.1 and 1.11.2 but it's not clear to me, what
change could cause it. The error you report in last reply is different from the
original and indicates that boot_files_uris variable is not set, usually it's a
variable that gets set somewhere above in the template. We use it in iPXE
built-in templates. Try adding this above the kernel line in your example

<% boot_files_uris =
@host.operatingsystem.boot_files_uri(@host.medium,@host.architecture) -%>

Hope this helps

··· -- Marek

On Tuesday 07 of June 2016 16:41:14 ‘Konstantin Orekhov’ via Foreman users wrote:

Unfortunately that did not help at all :frowning: I’m getting the same errors
after moving that definition out of private space…

BTW, after I rolled back to 1.11.2 version and tried to use boot_uri in
PXELinux like this:

<% kernel = boot_files_uris[0] -%> <% initrd = boot_files_uris[1] -%> KERNEL <%= kernel %> INITRD <%= initrd %>

I’ve got this error:

There was an error rendering the eBay_Ubuntu_PXELinux template: undefined
local variable or method `boot_files_uris’ for
#<#Class:0x007f23e963c040:0x0000000b451c98>

Any other suggestions/ideas?

Thanks!

Well, *@host.operatingsystem.boot_files_uri(@host.medium,@host.architecture)
*is one of those that stopped working for me. I get this error if I try
to use it after upgrade to from 1.11.1 to 1.11.2:

There was an error rendering the Ubuntu_PXELinux template: ERF42-8219
[Foreman::Exception]: Invalid medium for Ubuntu 14.04

Created Bug #15354: some provisioning templates are broken after upgrade from 1.11.1 to 1.11.2 - Foreman for this