From a2c07f0526496678ce69949143bb99c79bc6a536 Mon Sep 17 00:00:00 2001 From: Lukas Bezdicka Date: Thu, 8 Jun 2023 09:30:34 +0200 Subject: [PATCH] [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 --- .../tripleo-packages-baremetal-puppet.yaml | 16 ++++++++++++++++ ...eapp-pre-reboot-command-7d7040d80ff132e4.yaml | 8 ++++++++ 2 files changed, 24 insertions(+) create mode 100644 releasenotes/notes/leapp-pre-reboot-command-7d7040d80ff132e4.yaml diff --git a/deployment/tripleo-packages/tripleo-packages-baremetal-puppet.yaml b/deployment/tripleo-packages/tripleo-packages-baremetal-puppet.yaml index 94a48c4ee7..ff4c9f6117 100644 --- a/deployment/tripleo-packages/tripleo-packages-baremetal-puppet.yaml +++ b/deployment/tripleo-packages/tripleo-packages-baremetal-puppet.yaml @@ -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}}" diff --git a/releasenotes/notes/leapp-pre-reboot-command-7d7040d80ff132e4.yaml b/releasenotes/notes/leapp-pre-reboot-command-7d7040d80ff132e4.yaml new file mode 100644 index 0000000000..16f013c906 --- /dev/null +++ b/releasenotes/notes/leapp-pre-reboot-command-7d7040d80ff132e4.yaml @@ -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.