blob: fc5961a62704b53a3eadeeb6d8eb1aa196408bbb [file] [log] [blame]
Alex265f45e2019-04-23 18:51:23 -05001import sys
2
3from cfg_checker.common import config, logger, logger_cli
4from cfg_checker.helpers.args_utils import MyParser
5
6from command import execute_command
7
8
9def init_reclass_parser(_parser):
10 # reclass subparsers
11 reclass_subparsers = _parser.add_subparsers(dest='type')
12 reclass_list_parser = reclass_subparsers.add_parser(
13 'list',
14 help="List models available to compare"
15 )
16 reclass_list_parser.add_argument(
17 "-p",
18 "--models-path",
19 default="/srv/salt/",
20 help="Global path to search models in"
21 )
22
23 reclass_diff_parser = reclass_subparsers.add_parser(
24 'diff',
25 help="List models available to compare"
26 )
27 reclass_diff_parser.add_argument(
28 "--model1",
29 required=True,
30 help="Model A <path>. Model name is the folder name"
31 )
32 reclass_diff_parser.add_argument(
33 "--model2",
34 required=True,
35 help="Model B <path>. Model name is the folder name"
36 )
37 reclass_diff_parser.add_argument(
38 '--html',
39 metavar='reclass_html_filename',
40 help="HTML filename to save report"
41 )
42
43 return _parser
44
45
46def cli_reclass():
47 net_parser = MyParser("# Mirantis Cloud Reclass comparer")
48 init_reclass_parser(net_parser)
49
50 # parse arguments
51 try:
52 args = net_parser.parse_args()
53 except TypeError:
54 logger_cli.info("\n# Please, check arguments")
55 sys.exit(0)
56
57 # force use of sudo
58 config.ssh_uses_sudo = True
59
60 # Execute the command
61 result = execute_command(args, 'reclass')
62 logger.debug(result)
63 sys.exit(result)
64
Alex Savatieievc9055712019-03-01 14:43:56 -060065
66if __name__ == "__main__":
Alex265f45e2019-04-23 18:51:23 -050067 cli_reclass()