Bug 1654160

Summary: undefined method medium_uri in AutoYaST default iPXE template
Product: Red Hat Satellite Reporter: Ales Dujicek <adujicek>
Component: Provisioning TemplatesAssignee: Shimon Shtein <sshtein>
Status: CLOSED ERRATA QA Contact: Roman Plevka <rplevka>
Severity: medium Docs Contact:
Priority: unspecified    
Version: UnspecifiedCC: bbuckingham, egolov, mhulan, rplevka, sshtein
Target Milestone: 6.5.0Keywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: foreman-1.20.1.28-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-05-14 12:39:09 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

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 pm-sat@redhat.com 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