Bug #27183
closedIterate through all installation media/repos in provisioning templates
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)"