From 15fbc7d0bf26573f6001a31989b1fdbbc0d4fce2 Mon Sep 17 00:00:00 2001 From: Andrea Perotti Date: Thu, 17 Aug 2023 19:47:09 +0200 Subject: [PATCH 1/3] fix 36666 - Add support for "channel" parameter 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 --- README.md | 8 ++++++++ .../foreman_leapp/job_templates/leapp_preupgrade.erb | 12 +++++++++++- .../foreman_leapp/job_templates/leapp_upgrade.erb | 11 ++++++++++- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b037973..c4fb6bf 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/app/views/foreman_leapp/job_templates/leapp_preupgrade.erb b/app/views/foreman_leapp/job_templates/leapp_preupgrade.erb index c180435..214c6a2 100644 --- a/app/views/foreman_leapp/job_templates/leapp_preupgrade.erb +++ b/app/views/foreman_leapp/job_templates/leapp_preupgrade.erb @@ -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 diff --git a/app/views/foreman_leapp/job_templates/leapp_upgrade.erb b/app/views/foreman_leapp/job_templates/leapp_upgrade.erb index 47954a8..39e31dd 100644 --- a/app/views/foreman_leapp/job_templates/leapp_upgrade.erb +++ b/app/views/foreman_leapp/job_templates/leapp_upgrade.erb @@ -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 @@ -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: From ce6c8122514b8095e2a93c2b84d8392e421ca6db Mon Sep 17 00:00:00 2001 From: Andrea Perotti Date: Thu, 8 Feb 2024 05:43:36 +0100 Subject: [PATCH 2/3] Update app/views/foreman_leapp/job_templates/leapp_preupgrade.erb Co-authored-by: Leos Stejskal --- app/views/foreman_leapp/job_templates/leapp_preupgrade.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/foreman_leapp/job_templates/leapp_preupgrade.erb b/app/views/foreman_leapp/job_templates/leapp_preupgrade.erb index 214c6a2..5b3ba01 100644 --- a/app/views/foreman_leapp/job_templates/leapp_preupgrade.erb +++ b/app/views/foreman_leapp/job_templates/leapp_preupgrade.erb @@ -8,7 +8,7 @@ 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). + 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" From 9a91d29ab252e9d0d73c804a594ec3abf6bd8a38 Mon Sep 17 00:00:00 2001 From: Andrea Perotti Date: Thu, 8 Feb 2024 05:43:41 +0100 Subject: [PATCH 3/3] Update app/views/foreman_leapp/job_templates/leapp_upgrade.erb Co-authored-by: Leos Stejskal --- app/views/foreman_leapp/job_templates/leapp_upgrade.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/foreman_leapp/job_templates/leapp_upgrade.erb b/app/views/foreman_leapp/job_templates/leapp_upgrade.erb index 39e31dd..3e7d0ee 100644 --- a/app/views/foreman_leapp/job_templates/leapp_upgrade.erb +++ b/app/views/foreman_leapp/job_templates/leapp_upgrade.erb @@ -8,7 +8,7 @@ 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). + 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"