Hello, Am Freitag, 14. November 2014 schrieb Steve Beattie: > On Tue, Nov 11, 2014 at 08:09:35PM +0100, Christian Boltz wrote: > > The updated version adds support for nested lists - for the start of > > each list, print a *. Without that, you get a long list of items > > without an indicator if/when a new parent list starts. > > Acked-by: Steve Beattie <[email protected]>, though maybe instead of just > printing a '*', printing an opening '[' and closing ']', instead?
Good idea, I changed it before commiting. > Also, what do think of the following patch to get rid of output like: > > - <apparmor.rules.Raw_DBUS_Rule object at 0x7fb797813da0> > > when handling any of the raw rules objects (formatting improvements > welcome)? > > Signed-off-by: Steve Beattie <[email protected]> > --- > utils/apparmor/common.py | 3 +++ > utils/apparmor/rules.py | 6 ++++++ > 2 files changed, 9 insertions(+) > > Index: b/utils/apparmor/common.py > =================================================================== > --- a/utils/apparmor/common.py > +++ b/utils/apparmor/common.py > @@ -20,6 +20,7 @@ import subprocess > import sys > import termios > import tty > +import apparmor.rules as rules > > DEBUGGING = False > > @@ -96,6 +97,8 @@ def recursive_print(src, dpth = 0, key = > empty = False > if empty: > print (tabs + '[--- empty ---]') > + elif isinstance(src, rules._Raw_Rule): IMHO we should keep the object type as a "headline", so please add (untested, please adjust if needed) print (tabs + '%s' % src) This will also print the memory address, which can be helpful to find out if you have multiple references to the same object or separate objects. > + src.recursive_print(dpth) > else: > if key: > print (tabs + '%s = %s' % (key, src)) > Index: b/utils/apparmor/rules.py > =================================================================== > --- a/utils/apparmor/rules.py > +++ b/utils/apparmor/rules.py > @@ -56,6 +56,12 @@ class _Raw_Rule(object): > 'deny ' if self.deny else '', > self.rule) > > + def recursive_print(self, depth): > + tabs = ' ' * depth * 4 > + print('%saudit = %s' % (tabs, self.audit)) > + print('%sdeny = %s' % (tabs, self.deny)) > + print('%sraw rule = %s' % (tabs, self.rule)) > + > class Raw_DBUS_Rule(_Raw_Rule): > pass With the "headline" added, Acked-by: Christian Boltz <[email protected]> Regards, Christian Boltz -- <suseROCKs> I hate email <suseROCKs> I hate internet <suseROCKs> I hate computers <suseROCKs> why can't we go back to old fashioned smoke signaling?? [from #opensuse-project] -- AppArmor mailing list [email protected] Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/apparmor
