On 03/27/2015 05:53 PM, Seth Arnold wrote: > On Fri, Mar 27, 2015 at 05:15:25PM -0500, Jamie Strandboge wrote: > > I only noticed two odddities, one small enough to not mention unless the > other oddity is worth fixing, might sa well fix both at once. > > If "warn" is desired below, then: > > Acked-by: Seth Arnold <[email protected]> > > >> - files = [os.path.join(easyp.dirs['templates'], >> options.template)] >> - apparmor.easyprof.print_files(files) >> + sys_t = os.path.join(easyp.dirs['templates'], options.template) >> + inc_t = None >> + if options.include_templates_dir: >> + inc_t = os.path.join(easyp.dirs['templates_include'], >> + options.template) >> + >> + if os.path.exists(sys_t): >> + apparmor.easyprof.print_files([sys_t]) >> + elif os.path.exists(inc_t): >> + apparmor.easyprof.print_files([inc_t]) >> + else: >> + error("Could not find '%s'" % options.template) >> sys.exit(0) >> elif options.list_policy_groups: >> apparmor.easyprof.print_basefilenames(easyp.get_policy_groups()) >> sys.exit(0) >> elif options.policy_groups and options.show_policy_group: >> + files = [] >> for g in options.policy_groups.split(','): >> - files = [os.path.join(easyp.dirs['policygroups'], g)] >> - apparmor.easyprof.print_files(files) >> + sys_g = os.path.join(easyp.dirs['policygroups'], g) >> + inc_g = None >> + if options.include_policy_groups_dir: >> + inc_g = >> os.path.join(easyp.dirs['policygroups_include'], g) >> + >> + if os.path.exists(sys_g): >> + files.append(sys_g) >> + elif os.path.exists(inc_g): >> + files.append(inc_g) >> + else: >> + warn("Could not find '%s'" % g) > > Is this warn() correct? for the similar error of missing templates you're > using exit(). >
I did warn() instead of error() because you can only show one template per invocation whereas you can show multiple groups with just one. The previous behavior was to simply traceback, which is a form of exit I suppose. I don't feel strongly either way so if you have a preference for error(), I'm happy to change it. -- Jamie Strandboge http://www.ubuntu.com/
signature.asc
Description: OpenPGP digital signature
-- AppArmor mailing list [email protected] Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/apparmor
