[apparmor] [PATCH 3/8] utils: Add confdir env variable to aa.py for in-tree testing

Tyler Hicks tyhicks at canonical.com
Thu Feb 9 16:11:18 UTC 2017


On 02/08/2017 06:00 PM, Seth Arnold wrote:
> On Wed, Feb 08, 2017 at 10:01:40PM +0000, Tyler Hicks wrote:
>> --- a/utils/apparmor/aa.py
>> +++ b/utils/apparmor/aa.py
>> @@ -73,7 +73,7 @@ _ = init_translation()
>>  # Setup logging incase of debugging is enabled
>>  debug_logger = DebugLogger('aa')
>>  
>> -CONFDIR = '/etc/apparmor'
>> +CONFDIR = os.getenv('APPARMOR_PY_CONFDIR', '/etc/apparmor')
>>  
> 
>>  check: __libapparmor
>> +	export PYTHONPATH=$(PYTHONPATH) LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) LC_ALL=C APPARMOR_PY_CONFDIR=$(CONFDIR) ; $(foreach test, $(wildcard test-*.py), echo ; echo === $(test) === ; $(call pyalldo, $(test)))
>>  
> 
> Note that it's possible for the variable to be set, but not to a value;
> os.getenv() won't return the fallback in this spot:
> 
> $ export SARS= ; python3 -c 'import os; print(os.getenv("SARNOLD", "NOT SET"))'
> NOT SET
> $ export SARS= ; python3 -c 'import os; print(os.getenv("SARS", "NOT SET"))'
> 
> $ 
> 
> 

Good catch! I'll change the line to:

CONFDIR = os.getenv('APPARMOR_PY_CONFDIR') or '/etc/apparmor'

Let me know if you'd like me to send a v2 of the patch.

Tyler

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20170209/679b4b84/attachment.pgp>


More information about the AppArmor mailing list