When trying to create a new Windows host I get the following error regardless of what I write in my PXELinux template.
Problem:
Unable to render PXELinux template ‘1-Windows PXELinux’: undefined method pxedir' for #<Windows:0x00007ff4aea838b0> Fetch TFTP boot files for test02.lab.lan task failed with the following error: undefined methodpxedir’ for #Windows:0x00007ff4aea838b0
Foreman and Proxy versions:
1.20.2
There is a mention of that error in the end of issue 26036. But it was closed before anyone resolved it.
You are trying to put Windows template content into PXELinux template. The content in the issue seem to be what’s called a finish template, make sure you store your template as “finish” type. PXE is not supported for Windows, thus the error.
I can’t help you with Windows setup tho, this is not something I do. No clue how this is all set up.
It’s the same PXELinux template I used for PXE booting Windows installations on Foreman 1.16.0 a year ago and it worked perfectly then. It’s based on the wimaging_pxelinux template from foreman-wimaging.
Sadly, the templates in foreman-wimaging are no longer compatible with current foreman versions, and the repo appears to be no longer maintained afaict.
If anyone is interested in fixing them, we would be happy to add them to the community templates repository, so that they get shipped with future foreman versions, are updated when something in the foreman templating engine changes, and are tested against new releases. I know @Shimon_Shtein started looking into them with the user who reported that issue, but I’m not sure if they got to a point where there was an actual working template.
I know that the foreman-wimaging templates are no longer compatible. (Becasue the variables have changed from what i heard) I’m now using my own simplified version just to get the template to compile, but without success.
<%#
kind: PXELinux
name: 1-Windows PXELinux
oses:
- Windows Server 2008
- Windows Server 2008 R2
- Windows Server 2012
- Windows Server 2012 R2
- Windows Server 2016
- Windows
%>
DEFAULT menu
LABEL menu
COM32 linux.c32 boot/wimboot
Until the bug is properly fixed, you could try working around it by changing that line (should be under /usr/share/foreman/app/services/medium_providers/default.rb) to:
If we have one, at least a good example, this will be fetched in the core repo and our snapshot test suite will make sure it won’t regress in the future. If you can provide good example of such templates go ahead and file a PR as well.
I’m not sure if this is the right way to go or if the error has a completely different cause or needs a completely different solution. But as a workaround this seems to have worked for the first time.