mirror of
https://gitlab.com/apparmor/apparmor.git
synced 2025-03-04 08:24:42 +01:00
Merge branch 'cboltz-2.13-genprof-fix-json' into 'apparmor-2.13'
[2.11..2.13] Fix showing the local inactive profile in json mode See merge request apparmor/apparmor!516 Acked-by: Steve Beattie <steve.beattie@canonical.com> for 2.12 and 2.13
This commit is contained in:
commit
eb5185c961
2 changed files with 10 additions and 8 deletions
|
@ -559,8 +559,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':
|
||||
if p['profile_type'] == 'INACTIVE_LOCAL':
|
||||
profile_data = p['profile_data']
|
||||
|
|
|
@ -254,14 +254,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'),
|
||||
'CMD_AUDIT_NEW': _('Audi(t)'),
|
||||
|
|
Loading…
Add table
Reference in a new issue