• Tyler Hicks's avatar
    utils: Require apparmor.aa users to call init_aa() · ea0732be
    Tyler Hicks authored
    Introduce an apparmor.aa.init_aa() method and move the initialization
    code of the apparmor.aa module into it. Note that this change will break
    any external users of apparmor.aa because global variables that were
    previously initialized when importing apparmor.aa will not be
    initialized unless a call to the new apparmor.aa.init_aa() method is
    made.
    
    The main purpose of this change is to allow the utils tests to be able
    to set a non-default location for configuration files. Instead of
    hard-coding the location of logprof.conf and other utils related
    configuration files to /etc/apparmor/, this patch allows it to be
    configured by calling apparmor.aa.init_aa(confdir=PATH).
    
    This allows for the make check target to use the in-tree config file,
    profiles, and parser by default. A helper method, setup_aa(), is added
    to common_test.py that checks for an environment variable containing a
    non-default configuration directory path prior to calling
    apparmor.aa.init_aa(). All test scripts that use apparmor.aa are updated
    to call setup_aa().
    Signed-off-by: Tyler Hicks's avatarTyler Hicks <tyhicks@canonical.com>
    Suggested-by: Christian Boltz's avatarChristian Boltz <apparmor@cboltz.de>
    Acked-by: 's avatarSeth Arnold <seth.arnold@canonical.com>
    Acked-by: Christian Boltz's avatarChristian Boltz <apparmor@cboltz.de>
    ea0732be
aa-unconfined 6 KB