blob: 8fc65a535ba5f7b3fa5b1ad7a3ec923d70f3a289 [file] [log] [blame]
Alex Savatieievc9055712019-03-01 14:43:56 -06001import os
2
3from cfg_checker.common import logger_cli
4
Alex3ebc5632019-04-18 16:47:18 -05005
Alex Savatieievc9055712019-03-01 14:43:56 -06006def 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)
Alex3ebc5632019-04-18 16:47:18 -050024
Alex Savatieievc9055712019-03-01 14:43:56 -060025 logger_cli.debug("\t-> {}".format(
26 all(_checks)
27 ))
28
29 return all(_checks)