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/selinux_baseline.py | 33 +++++---------------------------- 1 file changed, 5 insertions(+), 28 deletions(-) (limited to 'tools/selinux_baseline.py') diff --git a/tools/selinux_baseline.py b/tools/selinux_baseline.py index 507a16f43..ad2a40426 100755 --- a/tools/selinux_baseline.py +++ b/tools/selinux_baseline.py @@ -1,41 +1,18 @@ #!/usr/bin/env python import sys -import logging import lxml.etree - import Bcfg2.Logger import Bcfg2.Options -from Bcfg2.Client.Tools.SELinux import * - -LOGGER = None - -def get_setup(): - global LOGGER - optinfo = Bcfg2.Options.CLIENT_COMMON_OPTIONS - setup = Bcfg2.Options.OptionParser(optinfo) - setup.parse(sys.argv[1:]) +from Bcfg2.Client.Tools.SELinux import SELinux - if setup['args']: - print("selinux_baseline.py takes no arguments, only options") - print(setup.buildHelpMessage()) - raise SystemExit(1) - level = 30 - if setup['verbose']: - level = 20 - if setup['debug']: - level = 0 - Bcfg2.Logger.setup_logging('selinux_base', - to_syslog=False, - level=level, - to_file=setup['logging']) - LOGGER = logging.getLogger('bcfg2') - return setup def main(): - setup = get_setup() + Bcfg2.Options.get_parser( + description="Get a baseline bundle of SELinux entries", + components=[SELinux]).parse() config = lxml.etree.Element("Configuration") - selinux = SELinux(LOGGER, setup, config) + selinux = SELinux(config) baseline = lxml.etree.Element("Bundle", name="selinux_baseline") for etype, handler in selinux.handlers.items(): -- cgit v1.2.3-1-g7c22