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