in perfmetrics/scripts/hns_rename_folders_metrics/generate_folders_and_files.py [0:0]
def _check_for_config_file_inconsistency(config) -> (int):
"""
Checks for inconsistencies in the provided configuration.
Args:
config: The configuration dictionary to be checked.
Returns:
0 if no inconsistencies are found, 1 otherwise.
"""
if "name" not in config:
_logmessage("Bucket name not specified",LOG_ERROR)
return 1
if "folders" in config:
if not ("num_folders" in config["folders"] or "folder_structure" in config[
"folders"]):
_logmessage("Key missing for nested folder",LOG_ERROR)
return 1
if config["folders"]["num_folders"] != len(
config["folders"]["folder_structure"]):
_logmessage("Inconsistency in the folder structure",LOG_ERROR)
return 1
if "nested_folders" in config:
if not ("folder_name" in config["nested_folders"] or
"num_folders" in config["nested_folders"] or
"folder_structure" in config["nested_folders"]):
_logmessage("Key missing for nested folder",LOG_ERROR)
return 1
if config["nested_folders"]["num_folders"] != len(
config["nested_folders"]["folder_structure"]):
_logmessage("Inconsistency in the nested folder",LOG_ERROR)
return 1
return 0