Project

General

Profile

Actions

Bug #27183

closed

Iterate through all installation media/repos in provisioning templates

Added by Joe Collette almost 5 years ago. Updated almost 4 years ago.

Status:
Resolved
Priority:
High
Assignee:
-
Category:
Templates
Target version:
-
Difficulty:
Triaged:
No
Fixed in Releases:
Found in Releases:

Description

We use to bring in all of our repos within the kickstart file with the following snippet on foreman 1.17.

<% @host.os.media.each do |media| ->
repo --name=<%= media.name > --baseurl=<= @host.os.medium_uri @host, media.path >
< end -
>

Result:
repo --name=rhel-base --baseurl=http://yum.x.com/pulp/repos/rhel/7.4/base/rpms/
repo --name=rhel-epel --baseurl=http://yum.x.com/pulp/repos/epel/7/rpms/
repo --name=rhel-extras --baseurl=http://yum.x.com/pulp/repos/rhel/7/extras/rpms/
..
..

In foreman 1.20, we get a template error on this as it seems some of the variables have changed.

I found some code added by Stephen Benjamin that appeared to address this, but it does not work.
https://github.com/theforeman/community-templates/blob/61b7a984c1512e312ff646146d705b95977f5e2e/provisioning_templates/provision/kickstart_default.erb

<% @additional_media.each do |medium| ->
repo --name <%= medium[:name] > --baseurl <= medium[:url] > <= medium[:install] ? ' --install' : '' >
< end -
>

Error:
"Warning! There was an error rendering the rhel7_repos template: wrong number of arguments (given 2, expected 1)"

Actions #1

Updated by Shimon Shtein almost 5 years ago

In foreman 1.20 we refactored medium providers framework. Now the access to medium URI is through your host:

<% @host.os.media.each do |medium| ->
repo --name=<%= medium.name %> --baseurl=<%= @host.medium_uri(medium.path) %>
<% end -%>
Actions #2

Updated by Tomer Brisker almost 5 years ago

  • Status changed from New to Resolved

Marking as resolved as the change to the template should resolve the issue. please reopen if it doesn't work.

Actions #3

Updated by Sven Vogel almost 4 years ago

seems not to work i opened a new issue #30117

Actions

Also available in: Atom PDF