def merge_configs()

in clouddq-migration/lib.py [0:0]


def merge_configs(config, new_config) -> dict:
    """"
        Method to merge configs

        return: final_config
    """
    # Copy original config to avoid modifying it directly
    final_config = config.copy()

    # Update the final config with the new config
    for key, value in new_config.items():
        if isinstance(value, dict) and key in final_config:
            # Recursively update dictionary if the key exists and both are dictionaries
            final_config[key] = merge_configs(final_config.get(key, {}), value)
        else:
            # Otherwise, update or add the key
            final_config[key] = value

    return final_config

def validate_task(task)-> None:
    """
        Method to validate the format for tasks ids