Files
update/software/scripts/controllers-software-sync
rummadis c2a7f24d61 Increase timeout for sync controller API call
To address timeouts during large patch sync operations,
added a constant `TIMEOUT_SYNC_API_CALL` with a value of 120
seconds. This constant is used in the `call_api` method for
syncing controllers.

Test Plan:
PASS Verify no timeout while software sync with duplex
     subcloud

Closes-Bug: 2091149
Change-Id: If453d13f76825e497b70e3ba6574cf216cb3ddd0
Signed-off-by: rummadis <ramu.ummadishetty@windriver.com>
2024-12-06 05:37:42 -05:00

60 lines
1.6 KiB
Python
Executable File

#!/usr/bin/python3
# -*- encoding: utf-8 -*-
#
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (c) 2023-2024 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
"""
software sync between duplex controllers to be called
after prestaging
"""
import os
import six.moves.configparser as configparser
import software.constants as constants
import sys
import upgrade_utils
KEYSTONE_CONFIG_SECTION = "keystone_authtoken"
CONF = configparser.ConfigParser(interpolation=None)
CONF.optionxform = str
def main():
try:
if not os.path.exists(constants.SOFTWARE_CONFIG_FILE_LOCAL):
raise Exception("Software config file is not found!")
CONF.read(constants.SOFTWARE_CONFIG_FILE_LOCAL)
if not CONF.has_section(KEYSTONE_CONFIG_SECTION):
raise Exception(f"ERROR: {KEYSTONE_CONFIG_SECTION} section does not exist!")
config = dict(CONF.items(KEYSTONE_CONFIG_SECTION))
usm_token, usm_endpoint = \
upgrade_utils.get_token_endpoint(config, service_type="usm")
api_cmd = usm_endpoint + "/deploy/software_sync"
method = 'POST'
output = upgrade_utils.call_api(
usm_token,
method,
api_cmd,
timeout_in_secs=constants.TIMEOUT_SYNC_API_CALL)
result = output.get("result")
if not result:
raise Exception(f"ERROR: Unable to sync subclouds controllers!")
print(result)
except Exception as ex:
print(f"Exception: {str(ex)}")
return -1
if __name__ == "__main__":
sys.exit(main())