Bug 1654160 - undefined method medium_uri in AutoYaST default iPXE template
Summary: undefined method medium_uri in AutoYaST default iPXE template
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Provisioning Templates
Version: Unspecified
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: 6.5.0
Assignee: Shimon Shtein
QA Contact: Roman Plevka
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-11-28 07:29 UTC by Ales Dujicek
Modified: 2019-11-05 22:40 UTC (History)
5 users (show)

Fixed In Version: foreman-1.20.1.28-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-05-14 12:39:09 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 25650 0 Normal Closed AutoYast Default iPXE Template Broken due to Template Changes 2021-01-28 06:29:13 UTC
Red Hat Product Errata RHSA-2019:1222 0 None None None 2019-05-14 12:39:16 UTC

Description Ales Dujicek 2018-11-28 07:29:04 UTC
Description of problem:

I creates SLES operation system and assigned AutoYaST default iPXE template to it
now if I want to enable build mode of SLES host I get this error:

The following errors may prevent a successful build:
Templates
Failure parsing AutoYaST default iPXE: undefined method `medium_uri' for #<Foreman::Renderer::Scope::Provisioning:0x000000000b3e9418> Did you mean? medium_url media_url. 


This is AutoYaST default iPXE template:

#!gpxe
<%#
kind: iPXE
name: AutoYaST default iPXE
model: ProvisioningTemplate
oses:
- SLES
- OpenSUSE
%>

<% boot_files_uris = @host.operatingsystem.boot_files_uri(medium_provider) -%>
<% kernel = boot_files_uris[0] -%>
<% initrd = boot_files_uris[1] -%>

kernel <%= kernel %> initrd=initrd.img splash=silent install=<%= medium_uri %> autoyast=<%= foreman_url('provision') %> text-mode=1 useDHCP=1
initrd <%= initrd %>
boot

diff of 6.4 and 6.5 version of the template:

--- 6.4	2018-11-28 08:19:36.726269741 +0100
+++ 6.5	2018-11-28 08:19:49.254340534 +0100
@@ -8,10 +8,10 @@
 - OpenSUSE
 %>
 
-<% boot_files_uris = @host.operatingsystem.boot_files_uri(@host.medium,@host.architecture) -%>
+<% boot_files_uris = @host.operatingsystem.boot_files_uri(medium_provider) -%>
 <% kernel = boot_files_uris[0] -%>
 <% initrd = boot_files_uris[1] -%>
 
-kernel <%= kernel %> initrd=initrd.img splash=silent install=<%=@host.os.medium_uri(@host)%> autoyast=<%= foreman_url('provision') %> text-mode=1 useDHCP=1
+kernel <%= kernel %> initrd=initrd.img splash=silent install=<%= medium_uri %> autoyast=<%= foreman_url('provision') %> text-mode=1 useDHCP=1
 initrd <%= initrd %>
 boot



Version-Release number of selected component (if applicable):
Sat 6.5 snap 5

Comment 4 Marek Hulan 2018-12-07 14:22:49 UTC
It seems the support for medium_uri was added by BZ 1447963 and should work. Shim, could you please take a look? A quick workaround may be changing medium_uri to "@host.os.medium_uri(@host)" which has been there before.

Comment 5 Shimon Shtein 2018-12-10 12:56:06 UTC
Connecting redmine issue https://projects.theforeman.org/issues/25650 from this bug

Comment 6 Shimon Shtein 2018-12-10 12:58:44 UTC
It was missing medium_uri macro. Added it upstream. It should fix a lot of templates.

Comment 7 Satellite Program 2018-12-10 17:11:25 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/25650 has been resolved.

Comment 12 Roman Plevka 2019-04-29 14:31:17 UTC
VERIFIED
on sat6.5.0-26

the SUSE host successfully provisioned on libvirt compute resource using AutoYAST templates.

Comment 15 errata-xmlrpc 2019-05-14 12:39:09 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2019:1222


Note You need to log in before you can comment on or make changes to this bug.