~peter-maloney/bzr/peter

Viewing all changes in revision 2787.

  • Committer: Christian Boltz
  • Date: 2014-11-15 11:51:24 UTC
  • Revision ID: apparmor@cboltz.de-20141115115124-yvuz9ca15b8ici6y
Fix leading whitespace in "(V)iew changes" and cleanup profile writing

The diff displayed by (V)iew changes in aa-logprof lacks leading
whitespace because it bases the whitespace on the indention level of the
closing "}".

Besides that, it uses different values for the indention level for newly
added rule types than for existing rule types. (For example, if a
profile already had a network rule, added network rules will get a
different indention level.) However you won't notice this because
currently it doesn't indent the rules at all ;-)

This patch fixes serialize_profile_from_old_profile() in aa.py so that
it always uses the correct indention level.


Also clean up and simplify how the profile is written in the end (when
matching RE_PROFILE_END) - we already have "write_methods", so we can
just re-use it instead of "manually" calling one write_* function after
the other. Unfortunately dicts don't keep their original order,
therefore I had to introduce "default_write_order".


Finally, add some missing rule types to "segments" to avoid key errors.


Acked-by: Steve Beattie <steve@nxnw.org>

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: