From 2274dfb942f20b87c342d8ab258a47b56efac163 Mon Sep 17 00:00:00 2001 From: Jagatguru Prasad Mishra Date: Tue, 5 Mar 2024 05:53:36 -0500 Subject: [PATCH] Migration script to delete encrypted-fs attribute MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previous release contains attribute ’encrypted-fs’ in the ’platform config’ service parameter, which is used to enable and disable the luks file system. Upgrade activity need to delete this unused attribute from the database. This change adds a new migration script to delete 'encrypted-fs' attribute. The script will run only when from release is 22.12 and during upgrade-activate. Test Plan: PASS: build-pkgs -c controllerconfig PASS: build-image PASS: AIO-SX upgrade to 24.xx from previous release with luks file system disabled. After upgrade activate encrypted-fs attribute should be deleted from DB. PASS: AIO-SX upgrade to 24.xx from previous release with luks file system enabled. After upgrade activate encrypted-fs attribute should be deleted from DB. PASS: AIO-DX upgrade to 24.xx from previous release with luks file system disabled. After upgrading controller-1(upgraded/ active controller), script execution should delete encrypted-fs attribute from the DB. Story: 2010873 Task: 49663 Change-Id: I96ed9bf572f20e64419763eb285f4997c37ddf9b Signed-off-by: Jagatguru Prasad Mishra --- ...7-delete-encrypted-fs-service-parameter.sh | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 controllerconfig/controllerconfig/upgrade-scripts/07-delete-encrypted-fs-service-parameter.sh diff --git a/controllerconfig/controllerconfig/upgrade-scripts/07-delete-encrypted-fs-service-parameter.sh b/controllerconfig/controllerconfig/upgrade-scripts/07-delete-encrypted-fs-service-parameter.sh new file mode 100644 index 0000000000..261532132a --- /dev/null +++ b/controllerconfig/controllerconfig/upgrade-scripts/07-delete-encrypted-fs-service-parameter.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# +# Copyright (c) 2024 Wind River Systems, Inc. +# +# SPDX-License-Identifier: Apache-2.0 +# +# +# This migration script is used for deleting the encrypted-fs attribute +# of 'platform config' service parameter during the activate stage of +# platform upgrade if it is present. + + +# The migration scripts are passed these parameters: +NAME=$(basename $0) +FROM_RELEASE=$1 +TO_RELEASE=$2 +ACTION=$3 + +# This will log to /var/log/platform.log +function log { + logger -p local1.info $1 +} + +# Only run this script during upgrade-activate and from release 22.12 +if [[ "$ACTION" != "activate" || "$FROM_RELEASE" != "22.12" ]]; then + log "$NAME: skipping encryption-fs service parameter deletion." + exit 0 +fi + +source /etc/platform/openrc + +# Get the UUID of the encrypted-fs attribute +ENCRYPTED_FS_UUID=$( system service-parameter-list --service platform --section config | grep " encrypted-fs " | awk -F '|' '{print $2}'| xargs ); + +# Check if ENCRYPTED_FS_UUID is not empty +if [ -n "$ENCRYPTED_FS_UUID" ]; then + # If ENCRYPTED_FS_UUID is not empty, delete the parameter + system service-parameter-delete $ENCRYPTED_FS_UUID +fi