[apparmor] [patch] [6/7] make log_dict a parameter of ask_the_questions()

Christian Boltz apparmor at cboltz.de
Sun Jan 15 15:25:57 UTC 2017


Hello,

$subject.
This allows to hand over any source instead of the global variable.

Also fix an if condition that would fail if aa[profile][hat] does not
exist (get() defaults to None if the requested item doesn't exist, and
None.get('file') will raise an Exception.


[ 06-ask_the_questions-param.diff ]

--- utils/apparmor/aa.py	2017-01-14 23:53:08.265957663 +0100
+++ utils/apparmor/aa.py	2017-01-15 00:10:20.005751677 +0100
@@ -1486,7 +1486,7 @@
 
     return globs
 
-def ask_the_questions():
+def ask_the_questions(log_dict):
     for aamode in sorted(log_dict.keys()):
         # Describe the type of changes
         if aamode == 'PERMITTING':
@@ -1513,7 +1513,7 @@
 
             for hat in hats:
 
-                if not aa[profile].get(hat).get('file'):
+                if not aa[profile].get(hat, {}).get('file'):
                     if aamode != 'merge':
                         # Ignore log events for a non-existing profile 
or child profile. Such events can occour
                         # after deleting a profile or hat manually, or 
when processing a foreign log.
@@ -1914,7 +1914,7 @@
 
     collapse_log()
 
-    ask_the_questions()
+    ask_the_questions(log_dict)
 
     if aaui.UI_mode == 'yast':
         # To-Do


Regards,

Christian Boltz
-- 
[lange Antwort schreib] [begreif] [lange falsche Antwort lösch]
Genial.
[Ratti in fontlinge-devel]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20170115/67d36a06/attachment.pgp>


More information about the AppArmor mailing list