diff --git a/plugins/fluentd_telemetry_plugin/src/merge_configuration_files.py b/plugins/fluentd_telemetry_plugin/src/merge_configuration_files.py index a696d0af..a3ff495b 100644 --- a/plugins/fluentd_telemetry_plugin/src/merge_configuration_files.py +++ b/plugins/fluentd_telemetry_plugin/src/merge_configuration_files.py @@ -6,10 +6,10 @@ def merge_ini_files(old_file_path, new_file_path): # Check if files exist if not os.path.isfile(old_file_path): - logging.error(f"file '{old_file_path}' does not exist.") + logging.error(f"file %s does not exist.", old_file_path) sys.exit(1) if not os.path.isfile(new_file_path): - logging.error(f"file '{new_file_path}' does not exist.") + logging.error(f"file %s does not exist.", new_file_path) sys.exit(1) # Create a configparser object @@ -22,7 +22,7 @@ def merge_ini_files(old_file_path, new_file_path): config_new.read(new_file_path) except configparser.Error as e: - logging.error(f"Failed to parse configurations files: {e}") + logging.error(f"Failed to parse configurations files: %s", e) sys.exit(1) # Merge configurations @@ -36,10 +36,10 @@ def merge_ini_files(old_file_path, new_file_path): 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') as configfile: + with open(old_file_path, 'w', encoding="utf-8") as configfile: config_old.write(configfile) - logging.info(f"Configuration has been merged and saved to {old_file_path}") + logging.info(f"Configuration has been merged and saved to %s", old_file_path) if __name__ == "__main__": # Get file paths from command line arguments