| from cfg_checker.helpers import args_utils |
| |
| 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 |
| |
| :args: - parser arguments |
| :return: - no return value |
| """ |
| _type, _filename = args_utils.get_package_report_type_and_filename(args) |
| |
| # init connection to salt and collect minion data |
| pChecker = checker.CloudPackageChecker() |
| # collect data on installed packages |
| pChecker.collect_installed_packages() |
| # diff installed and candidates |
| pChecker.collect_packages() |
| # report it |
| pChecker.create_report(_filename, rtype=_type, full=args.full) |