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"] + else: + subprocess.call('less %s' % difftemp.name, shell=True) difftemp.close() CMDS = {'CMD_ALLOW': _('(A)llow'), -- 2.14.2 -- AppArmor mailing list AppArmor@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/apparmor