Hello,

Am Montag, 23. Oktober 2017, 12:38:34 CEST schrieb Goldwyn Rodrigues:
> From: Goldwyn Rodrigues <rgold...@suse.com>
> 
> Provides the filename in the json format, which can be
> directly read by Yast. Increased the protocol version; perhaps
> it should go in the next release.
> 
> Signed-off-by: Goldwyn Rodrigues <rgold...@suse.com>
> ---
>  utils/apparmor/ui.py | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/utils/apparmor/ui.py b/utils/apparmor/ui.py
> index be07b28a..2afbd5b1 100644
> --- a/utils/apparmor/ui.py
> +++ b/utils/apparmor/ui.py
> @@ -45,7 +45,7 @@ def write_json(jsonout):
>  def set_json_mode():
>      global UI_mode
>      UI_mode = 'json'
> -    jsonout = {'dialog': 'apparmor-json-version', 'data': '2.12'}
> +    jsonout = {'dialog': 'apparmor-json-version', 'data': '2.13'}
>      write_json(jsonout)
> 
>  # reads the response on command line for json and verifies the
> response @@ -250,9 +250,16 @@ def
> generate_diff_with_comments(oldprofile, newprofile): def
> UI_Changes(oldprofile, newprofile, comments=False):
>      if comments == False:
>        difftemp = generate_diff(oldprofile, newprofile)
> +      header = 'View Changes'
>      else:
>        difftemp = generate_diff_with_comments(oldprofile, newprofile)
> -    subprocess.call('less %s' % difftemp.name, shell=True)
> +      header = 'View Changes with comments'
> +    if UI_mode == 'json':
> +        jsonout = {'dialog': 'changes', 'header':header, 'filename':
> difftemp.name} +        write_json(jsonout)
> +        response = json_response('changes')["response"]

make check  complains:
    apparmor/ui.py:260: local variable 'response' is assigned to but never used

Obviously nobody cares about the response of displaying the diff (but
expecting a response is still a good idea to keep the interface 
consistent). Therefore I'll change this line to

+        json_response('changes')["response"]  # response gets ignored, 
therefore not assigning to a variable

> +    else:
> +      subprocess.call('less %s' % difftemp.name, shell=True)
>      difftemp.close()
> 
>  CMDS = {'CMD_ALLOW': _('(A)llow'),

With the above change:
    Acked-by: Christian Boltz <appar...@cboltz.de>


Regards,

Christian Boltz
-- 
Ja, aber damit wirst Du Glenn nicht zufriedenstellen können. Unser
Baby will ein Edelfläschchen mit frischer, vorgereinigter Milch,
mit feinster Bourbonvanille versetzt und einem Schuss edelstem
Madagaskar-Rum. Garniert in einem Früchtetraum aus Mango, Aprikose
und Maracuja. [Philipp Zacharias in suse-linux]

Attachment: signature.asc
Description: This is a digitally signed message part.

-- 
AppArmor mailing list
AppArmor@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/apparmor

Reply via email to