Unified command execution and unit tests
- All arguments inits moved to own clases
- Added unified way to execute commands
- Unit test structure and very basic tests
- Command line script to test coverage
- Argument parsers moved to corresponding commands
- Automatic parsers and command mapping
Change-Id: Id099d14702d9590729583dfd9574bd57022efac5
Related-PROD: PROD-28199
diff --git a/cfg_checker/modules/packages/__init__.py b/cfg_checker/modules/packages/__init__.py
index 5e717d6..a4a81bd 100644
--- a/cfg_checker/modules/packages/__init__.py
+++ b/cfg_checker/modules/packages/__init__.py
@@ -2,6 +2,35 @@
import checker
+command_help = "Package versions check (Candidate vs Installed)"
+
+
+def init_parser(_parser):
+ # packages subparser
+ pkg_subparsers = _parser.add_subparsers(dest='type')
+
+ pkg_report_parser = pkg_subparsers.add_parser(
+ 'report',
+ help="Report package versions to HTML file"
+ )
+ pkg_report_parser.add_argument(
+ '--full',
+ action="store_true", default=False,
+ help="HTML report will have all of the packages, not just errors"
+ )
+ pkg_report_parser.add_argument(
+ '--html',
+ metavar='packages_html_filename',
+ help="HTML filename to save report"
+ )
+ pkg_report_parser.add_argument(
+ '--csv',
+ metavar='packages_csv_filename',
+ help="CSV filename to save report"
+ )
+
+ return _parser
+
def do_report(args):
"""Create package versions report, HTML
@@ -9,7 +38,7 @@
:args: - parser arguments
:return: - no return value
"""
- _type, _filename = args_utils.get_report_type_and_filename(args)
+ _type, _filename = args_utils.get_package_report_type_and_filename(args)
# init connection to salt and collect minion data
pChecker = checker.CloudPackageChecker()