[ffwd3] Ability to run scripts before reboot

In some cases depending on the environments we need to run
workarounds right before rebooting into Leapp Upgrade. We
now provide LeappPreRebootCommand which can be fed shell
script do do so.

Example on machine with nonworking console params user can
set in system_upgrade.yaml:
parameter_defaults:
  LeappPreRebootCommand:
    grubby --update-kernel=ALL --remove-args=console=ttyS0,115200n81
    grubby --update-kernel=ALL --remove-args=console=ttyS0

Resolves: rhbz#2196288
Change-Id: I1e30b3c00a56cc244ee1c5730ba22e1e33788bca
This commit is contained in:
Lukas Bezdicka 2023-06-08 09:30:34 +02:00 committed by Sergii Golovatiuk
parent 3c59c354f2
commit a2c07f0526
2 changed files with 24 additions and 0 deletions

View File

@ -120,6 +120,14 @@ parameters:
type: comma_delimited_list
tags:
- role_specific
LeappPreRebootCommand:
type: string
description: |
Command or script snippet to run on all overcloud nodes to
apply any necessary workarounds before rebooting into Leapp.
default: ''
tags:
- role_specific
UpgradeInitCommand:
type: string
description: |
@ -182,6 +190,7 @@ resources:
upgrade_leapp_actors_to_remove: LeappActorsToRemove
upgrade_init_command: UpgradeInitCommand
base_tripleo_packages: BaseTripleoPackages
leapp_pre_reboot_command: LeappPreRebootCommand
- values: {get_param: [RoleParameters]}
- values:
DnfStreams: {get_param: DnfStreams}
@ -190,6 +199,7 @@ resources:
UpgradeLeappToRemove: {get_param: UpgradeLeappToRemove}
UpgradeLeappToInstall: {get_param: UpgradeLeappToInstall}
LeappUnloadKernelDrivers: {get_param: LeappUnloadKernelDrivers}
LeappPreRebootCommand: {get_param: LeappPreRebootCommand}
LeappActorsToRemove: {get_param: LeappActorsToRemove}
UpgradeInitCommand: {get_param: UpgradeInitCommand}
LeappRepoInitCommand: {get_param: LeappRepoInitCommand}
@ -374,6 +384,12 @@ outputs:
- upgrade_leapp_enabled
- "'Undercloud' not in group_names"
block:
- name: Run LeappPreRebootCommand
shell:
list_join:
- ''
- - "#!/bin/bash\n\n"
- {get_attr: [RoleParametersValue, value, 'leapp_pre_reboot_command']}
- name: reboot to perform the upgrade
reboot:
reboot_timeout: "{{upgrade_leapp_reboot_timeout}}"

View File

@ -0,0 +1,8 @@
---
features:
- |
Added LeappPreRebootCommand parameter to the tripleo-packages.
This is a list of commands to be executed just before rebooting the node
to perform the leapp upgrade.
This allows, for example, to remove kernel parameters to avoid affecting
the leapp reboot.