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

Seth Arnold seth.arnold at canonical.com
Tue Jan 17 21:04:05 UTC 2017


On Sun, Jan 15, 2017 at 04:25:57PM +0100, Christian Boltz wrote:
> 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 ]

I'm really not a fan of how the local parameter 'log_dict' now shadows the
global variable 'log_dict'. This is a recipe for future trouble.

Thanks

> 
> --- 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
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20170117/1c184ac8/attachment.pgp>


More information about the AppArmor mailing list