From dceb1910aaef109b33ab4a390db180515dcae1e5 Mon Sep 17 00:00:00 2001 From: Miryam Schwartz Date: Tue, 19 Nov 2024 10:39:37 +0200 Subject: [PATCH] move merge onfigurations files --- .../src/merge_configuration_files.py | 68 ------------------- ufm_sdk_tools | 2 +- 2 files changed, 1 insertion(+), 69 deletions(-) delete mode 100644 plugins/fluentd_telemetry_plugin/src/merge_configuration_files.py diff --git a/plugins/fluentd_telemetry_plugin/src/merge_configuration_files.py b/plugins/fluentd_telemetry_plugin/src/merge_configuration_files.py deleted file mode 100644 index b7e8f928..00000000 --- a/plugins/fluentd_telemetry_plugin/src/merge_configuration_files.py +++ /dev/null @@ -1,68 +0,0 @@ -""" -@copyright: - Copyright (C) Mellanox Technologies Ltd. 2014-2020. ALL RIGHTS RESERVED. - - This software product is a proprietary product of Mellanox Technologies - Ltd. (the "Company") and all right, title, and interest in and to the - software product, including all associated intellectual property rights, - are and shall remain exclusively with the Company. - - This software product is governed by the End User License Agreement - provided with the software product. - -@author: Miryam Schwartz -@date: Oct 14, 2024 -""" -import configparser -import logging -import sys -import os - -def merge_ini_files(old_file_path, new_file_path): - # Check if files exist - if not os.path.isfile(old_file_path): - logging.error("file %s does not exist.", old_file_path) - sys.exit(1) - if not os.path.isfile(new_file_path): - logging.error("file %s does not exist.", new_file_path) - sys.exit(1) - - # Create a configparser object - config_old = configparser.ConfigParser() - config_new = configparser.ConfigParser() - - # Read the old and new files - try: - config_old.read(old_file_path) - config_new.read(new_file_path) - - except configparser.Error as e: - logging.error("Failed to parse configurations files: %s", e) - sys.exit(1) - - # Merge configurations - for section in config_new.sections(): - if not config_old.has_section(section): - config_old.add_section(section) - for option in config_new.options(section): - # If option exists in the old file, retain the old value - if not config_old.has_option(section, option): - # Otherwise, add the new value - config_old.set(section, option, config_new.get(section, option)) - - # Write the merged configuration to the old file path - with open(old_file_path, 'w', encoding="utf-8") as configfile: - config_old.write(configfile) - - logging.info("Configuration has been merged and saved to %s", old_file_path) - -if __name__ == "__main__": - # Get file paths from command line arguments - if len(sys.argv) != 3: - logging.error("Usage: python merge_configuration_files.py ") - sys.exit(1) - - old_file = sys.argv[1] - new_file = sys.argv[2] - - merge_ini_files(old_file, new_file) diff --git a/ufm_sdk_tools b/ufm_sdk_tools index 74980103..a48eceb0 160000 --- a/ufm_sdk_tools +++ b/ufm_sdk_tools @@ -1 +1 @@ -Subproject commit 74980103703b112217d7ca2f2fa5d8adb43fb287 +Subproject commit a48eceb0ee393ef9c8c6e752cee54a1ba3d836df