Alex Savatieiev | c905571 | 2019-03-01 14:43:56 -0600 | [diff] [blame] | 1 | import os |
| 2 | |
| 3 | from cfg_checker.common import logger_cli |
| 4 | |
| 5 | def basic_model_validation_by_path(path): |
| 6 | logger_cli.debug("\t...validating '{}' as a model".format(path)) |
| 7 | _checks = [] |
| 8 | _is_folder = os.path.isdir(path) |
| 9 | logger_cli.debug("\t- folder? -> {}".format(_is_folder)) |
| 10 | _checks.append(_is_folder) |
| 11 | _has_classes = os.path.isdir(os.path.join(path, "classes")) |
| 12 | logger_cli.debug("\t- has classes? -> {}".format(_has_classes)) |
| 13 | _checks.append(_has_classes) |
| 14 | _has_cluster = os.path.isdir(os.path.join(path, "classes", "cluster")) |
| 15 | logger_cli.debug("\t- has classes/cluster? -> {}".format(_has_cluster)) |
| 16 | _checks.append(_has_cluster) |
| 17 | _has_system = os.path.isdir(os.path.join(path, "classes", "system")) |
| 18 | logger_cli.debug("\t- has classes/system? -> {}".format(_has_system)) |
| 19 | _checks.append(_has_system) |
| 20 | _has_nodes = os.path.isdir(os.path.join(path, "nodes")) |
| 21 | logger_cli.debug("\t- has nodes? -> {}".format(_has_nodes)) |
| 22 | _checks.append(_has_nodes) |
| 23 | |
| 24 | logger_cli.debug("\t-> {}".format( |
| 25 | all(_checks) |
| 26 | )) |
| 27 | |
| 28 | return all(_checks) |