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>