From 7b28537c905d9f72142b56f9a2fd757f93c1d5eb Mon Sep 17 00:00:00 2001 From: Bin Qian Date: Mon, 18 Nov 2024 17:06:02 +0000 Subject: [PATCH] Remove 199-update-sysinv-motd script The script is no longer required for stx-9 to stx-10 upgrade. Story: 2010676 Task: 51368 TCs: passed: AIO-DX upgrade completed. Change-Id: I34f21ad08c6a2010b17595c6e618aee1c241c255 Signed-off-by: Bin Qian --- .../upgrade-scripts/199-update-sysinv-motd.py | 87 ------------------- 1 file changed, 87 deletions(-) delete mode 100755 controllerconfig/controllerconfig/upgrade-scripts/199-update-sysinv-motd.py diff --git a/controllerconfig/controllerconfig/upgrade-scripts/199-update-sysinv-motd.py b/controllerconfig/controllerconfig/upgrade-scripts/199-update-sysinv-motd.py deleted file mode 100755 index 0ed7433d28..0000000000 --- a/controllerconfig/controllerconfig/upgrade-scripts/199-update-sysinv-motd.py +++ /dev/null @@ -1,87 +0,0 @@ -#!/usr/bin/env python -# Copyright (c) 2023-2024 Wind River Systems, Inc. -# -# SPDX-License-Identifier: Apache-2.0 -# -# This script create the motd message in all hosts -# - -import argparse -import logging as LOG -import os -import sys -from sysinv.conductor import rpcapiproxy as conductor_rpcapi -from cgtsclient import client as cgts_client -from oslo_config import cfg -from oslo_context import context -from sysinv.common import constants - -CONF = cfg.CONF - - -class CgtsClient(object): - SYSINV_API_VERSION = "1" - - def __init__(self): - self._sysinv_client = None - - @property - def sysinv(self): - if not self._sysinv_client: - self._sysinv_client = cgts_client.get_client( - self.SYSINV_API_VERSION, - os_auth_token=os.environ.get("OS_AUTH_TOKEN"), - system_url=os.environ.get("SYSTEM_URL"), - ) - return self._sysinv_client - - -def main(): - parser = argparse.ArgumentParser() - parser.add_argument("from_release", type=str) - parser.add_argument("to_release", type=str) - parser.add_argument("action", type=str) - if len(sys.argv) == 5: - parser.add_argument("postgres_port", type=int) - args = parser.parse_args() - - if len(sys.argv) not in [4, 5]: - print("Invalid option {}".format(sys.arg)) - return 1 - if args.action == "activate": - log_format = ('%(asctime)s: ' + '[%(process)s]: ' - '%(filename)s(%(lineno)s): %(levelname)s: %(message)s') - LOG.basicConfig(filename="/var/log/software.log", - format=log_format, level=LOG.INFO, datefmt="%FT%T") - LOG.info( - "{} invoked with from_release = {} " - "to_release = {} " - "action = {}".format( - sys.argv[0], args.from_release, args.to_release, args.action - ) - ) - try: - client = CgtsClient() - system_data = client.sysinv.isystem.list()[0] - - # Without this configuration, the system tries - # to connect to ZeroMQ using the localhost address - # and doesn't accept connections. By changing the bind_ip - # to the controller hostname, the connection works. - CONF.rpc_zeromq_conductor_bind_ip = constants.CONTROLLER_HOSTNAME - - conductor = conductor_rpcapi.ConductorAPI() - conductor.configure_isystemname( - context.get_admin_context(), system_data.name - ) - except Exception as e: - # This prevents breaking the upgrade in case of failure - # since the update motd had no impact in system functionality - LOG.error("Error on update sysinv motd - {}".format(e)) - return 0 - else: - LOG.info("Nothing to do on {}".format(args.action)) - - -if __name__ == "__main__": - sys.exit(main())