mirror of
https://gitlab.com/apparmor/apparmor.git
synced 2025-03-04 08:24:42 +01:00
Merge branch 'cboltz-fix-genprof-json' into 'master'
Fix showing the local inactive profile in json mode See merge request apparmor/apparmor!514 Acked-by: John Johansen <john.johansen@canonical.com> for 2.11..master
This commit is contained in:
commit
986b4f2b72
2 changed files with 10 additions and 8 deletions
|
@ -527,8 +527,7 @@ def get_profile(prof_name):
|
|||
p = profile_hash[options[arg]]
|
||||
q.selected = options.index(options[arg])
|
||||
if ans == 'CMD_VIEW_PROFILE':
|
||||
pager = get_pager()
|
||||
subprocess.call([pager, orig_filename])
|
||||
aaui.UI_ShowFile(uname, orig_filename)
|
||||
elif ans == 'CMD_USE_PROFILE':
|
||||
created.append(prof_name)
|
||||
return p['profile_data']
|
||||
|
|
|
@ -290,14 +290,17 @@ def UI_Changes(oldprofile, newprofile, comments=False):
|
|||
else:
|
||||
difftemp = generate_diff_with_comments(oldprofile, newprofile)
|
||||
header = 'View Changes with comments'
|
||||
if UI_mode == 'json':
|
||||
jsonout = {'dialog': 'changes', 'header': header, 'filename': difftemp.name}
|
||||
write_json(jsonout)
|
||||
json_response('changes')["response"] # wait for response to delay deletion of difftemp (and ignore response content)
|
||||
else:
|
||||
subprocess.call('less %s' % difftemp.name, shell=True)
|
||||
UI_ShowFile(header, difftemp.name)
|
||||
difftemp.close()
|
||||
|
||||
def UI_ShowFile(header, filename):
|
||||
if UI_mode == 'json':
|
||||
jsonout = {'dialog': 'changes', 'header': header, 'filename': filename}
|
||||
write_json(jsonout)
|
||||
json_response('changes')["response"] # wait for response to delay deletion of filename (and ignore response content)
|
||||
else:
|
||||
subprocess.call('less %s' % filename, shell=True)
|
||||
|
||||
|
||||
CMDS = {'CMD_ALLOW': _('(A)llow'),
|
||||
'CMD_OTHER': _('(M)ore'),
|
||||
|
|
Loading…
Add table
Reference in a new issue