~talkless/apparmor/fix_user_download_nonlatin

« back to all changes in this revision

Viewing changes to utils/apparmor/aa.py

  • Committer: Christian Boltz
  • Date: 2017-03-03 12:14:55 UTC
  • Revision ID: apparmor@cboltz.de-20170303121455-ssjhtkjvw5tb91ha
Fix regressions caused by init_aa()

With the init_aa() patch series commited, minitools_test.py showed
several test failures - which effectively means the -d option of
aa-complain, aa-cleanprof etc. was broken.

These failures were caused by
- calling init_aa() too late in tools.py - _after_ setting the
  profiledir, which then got overwritten by init_aa()
- calling init_aa() twice (because apparmor.aa gets imported in two
  modules used by aa-cleanprof), which overwrote the manually set values
  on the second run

This patch fixes the call order in tools.py and adds a check to
init_aa() so that it only runs once and ignores additional calls.


Acked-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>

Show diffs side-by-side

added added

removed removed

Lines of Context:
3749
3749
    global extra_profile_dir
3750
3750
    global parser
3751
3751
 
 
3752
    if CONFDIR:
 
3753
        return  # config already initialized (and possibly changed afterwards), so don't overwrite the config variables
 
3754
 
3752
3755
    CONFDIR = confdir
3753
3756
    conf = apparmor.config.Config('ini', CONFDIR)
3754
3757
    cfg = conf.read_config('logprof.conf')