Skip to content

Commit

Permalink
fix 36666 - Add support for "channel" parameter
Browse files Browse the repository at this point in the history
This commit introduce the possibility to pass the "channel" parameter to
leapp, so during an upgrade can be targetted release 8.6 EUS, even if
source is 7.9 "plain".

Channels list is take from upstream:
https://github.com/oamg/leapp-repository/blob/84d6ce3073e646e8740b72a5e7edda056c1b324a/commands/preupgrade/__init__.py#L28

ref. https://projects.theforeman.org/issues/36666
  • Loading branch information
andreamtp committed Nov 9, 2023
1 parent acfade5 commit 15fbc7d
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ The plugin will add following jobs:
- Remediation plan
- Run upgrade via Leapp

### Channel

Leapp by default will use the same "channel" (e4s, eus, aus) as the current OS, so if you are using "eus" repositories, the target OS will be on "eus" repositories as well.
But if you are upgrading and want to target a different channel, i.e. from a RHEL 7.9 to a RHEL 8.6 EUS, you can do it by explicitely setting the channel to "eus".

The channel have to be specified in both the preupgrade and upgrade jobs.
Default value of "channel" is "ga" - General availability: regular repositories are used by default.

## Api
- `GET /api/preupgrade_reports` List Preupgrade reports
- `GET /api/preupgrade_reports/:id` Show Preupgrade report
Expand Down
12 changes: 11 additions & 1 deletion app/views/foreman_leapp/job_templates/leapp_preupgrade.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,22 @@ description_format: 'Upgradeability check for RHEL host'
provider_type: SSH
feature: leapp_preupgrade
model: JobTemplate
template_inputs:
- name: Channel
description: Set if the target OS is required to use the General Availability (GA) channel - the default - or a specific channel among: Update Services for SAP Solutions (E4S), Extended Upgrade Support (EUS) or Advanced Update Support (AUS).
input_type: user
required: true
default: "ga"
options: "ga\ne4s\neus\naus"
%>
<%
channel_opts = input('Channel') == 'ga' ? '' : "--channel #{input('Channel')}"
%>
<%= render_template 'Check Leapp' %>

rm -f /var/log/leapp/leapp-report.json
leapp preupgrade
leapp preupgrade <%= channel_opts %>

echo "===leap_upgrade_report_start==="
cat /var/log/leapp/leapp-report.json
11 changes: 10 additions & 1 deletion app/views/foreman_leapp/job_templates/leapp_upgrade.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ provider_type: Ansible
feature: leapp_upgrade
model: JobTemplate
template_inputs:
- name: Channel
description: Set if the target OS is required to use the General Availability (GA) channel - the default - or a specific channel among: Update Services for SAP Solutions (E4S), Extended Upgrade Support (EUS) or Advanced Update Support (AUS).
input_type: user
required: true
default: "ga"
options: "ga\ne4s\neus\naus"
- name: Reboot
description: Reboot the host automaticaly to continue with the upgrade
input_type: user
Expand All @@ -16,9 +22,12 @@ template_inputs:
%>
---
- hosts: all
vars:
- channel_opts: <% input('Channel') == 'ga' ? '' : "--channel #{input('Channel')}" %>
tasks:
- name: Run Leapp Upgrade
command: leapp upgrade
command: leapp upgrade {{ channel_opts }}

<%- if input('Reboot') == "true" -%>
- name: Reboot the machine
reboot:
Expand Down

0 comments on commit 15fbc7d

Please sign in to comment.