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.2/nagiosgen-convert.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'tools/upgrade/1.2/nagiosgen-convert.py') diff --git a/tools/upgrade/1.2/nagiosgen-convert.py b/tools/upgrade/1.2/nagiosgen-convert.py index 2c2142735..eb10cd4ea 100755 --- a/tools/upgrade/1.2/nagiosgen-convert.py +++ b/tools/upgrade/1.2/nagiosgen-convert.py @@ -7,10 +7,13 @@ import lxml.etree import Bcfg2.Options def main(): - opts = {'repo': Bcfg2.Options.SERVER_REPOSITORY} - setup = Bcfg2.Options.OptionParser(opts) - setup.parse(sys.argv[1:]) - repo = setup['repo'] + parser = Bcfg2.Options.get_parser( + description="Migrate from Bcfg2 1.1-style Properties-based NagiosGen " + "configuration to standalone 1.2-style") + parser.add_options([Bcfg2.Options.Common.repository]) + parser.parse() + + repo = Bcfg2.Options.setup.repository oldconfigfile = os.path.join(repo, 'Properties', 'NagiosGen.xml') newconfigpath = os.path.join(repo, 'NagiosGen') newconfigfile = os.path.join(newconfigpath, 'config.xml') @@ -32,11 +35,11 @@ def main(): if host.tag == lxml.etree.Comment: # skip comments continue - + if host.tag == 'default': print("default tag will not be converted; use a suitable Group tag instead") continue - + newhost = lxml.etree.Element("Client", name=host.tag) for opt in host: newopt = lxml.etree.Element("Option", name=opt.tag) -- cgit v1.2.3-1-g7c22