From cd14868d4db8eaa7e9421e1d5fe8653294ac1e38 Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Thu, 27 Jun 2013 10:36:17 -0400 Subject: Options: migrated tools to new parser --- tools/upgrade/1.3/migrate_dbstats.py | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'tools/upgrade/1.3/migrate_dbstats.py') diff --git a/tools/upgrade/1.3/migrate_dbstats.py b/tools/upgrade/1.3/migrate_dbstats.py index 07def2ac8..f52ccab08 100755 --- a/tools/upgrade/1.3/migrate_dbstats.py +++ b/tools/upgrade/1.3/migrate_dbstats.py @@ -9,10 +9,9 @@ import logging import time import Bcfg2.Logger import Bcfg2.Options -from django.core.cache import cache from django.db import connection, transaction, backend -from Bcfg2.Server.Admin.Reports import Reports +from Bcfg2.Server.Admin import UpdateReports from Bcfg2.Reporting import models as new_models from Bcfg2.Reporting.utils import BatchFetch from Bcfg2.Server.Reports.reports import models as legacy_models @@ -281,17 +280,10 @@ def _restructure(): if __name__ == '__main__': - Bcfg2.Logger.setup_logging('bcfg2-report-collector', - to_console=logging.INFO, - level=logging.INFO) - - optinfo = dict() - optinfo.update(Bcfg2.Options.CLI_COMMON_OPTIONS) - optinfo.update(Bcfg2.Options.SERVER_COMMON_OPTIONS) - setup = Bcfg2.Options.OptionParser(optinfo) - setup.parse(sys.argv[1:]) - - #sync! - Reports(setup).__call__(['update']) + parser = Bcfg2.Options.get_parser( + description="Migrate from Bcfg2 1.2 DBStats plugin to 1.3 Reporting " + "subsystem", + components=[UpdateReports]) + UpdateReports().run(Bcfg2.Options.setup) _restructure() -- cgit v1.2.3-1-g7c22