[apparmor] [PATCH 2/2] json support for tools (logprof and genprof)

Christian Boltz apparmor at cboltz.de
Fri Apr 14 19:29:42 UTC 2017


Am Freitag, 14. April 2017, 16:20:27 CEST schrieb Goldwyn Rodrigues:
> On 04/13/2017 04:52 PM, Christian Boltz wrote:

> >     jsonout = {'dialog': 'apparmor-json-version', 'data': '2.12'}
> >     write_json(jsonout)
> > 
> > '2.12' obviously matches the next AppArmor release. It will only be
> > changed if the json interface changes, so if it turns out your patch
> > is good enough for the next 50 years, it will stay at '2.12'
> > forever ;-)
> > 
> > If you think a simple number is easier to handle - I'm also fine
> > with version '1' ;-)
> I think apparmor json version makes sense, though aa-status --json
> supplies version as
> "version": "1"
> Would you prefer to be uniform?

Starting with "1" is ok, but note that that the version number of 
aa-status and the profile tools (aa-logprof, aa-genprof, aa-mergeprof) 
might go out of sync if only one of them needs changes to the json 

> I would prefer to update this one. It is best if we have everything
> sorted out before we put this in.


> >> +            'explanation': explanation,
> >> +            'options': options,
> >> +            'menu_items': menu_items,
> >> +	    'default_key': default_key,
> > 
> > The last line has a whitespace issue - tab instead of spaces?
> Yeah, vim setcindent set as default :(

Try something like

    autocmd BufNewFile,BufRead /home/goldwyn/apparmor/utils/* set expandtab

in your ~/.vimrc ;-)

> > BTW: Don't forget to let YaST send the selected option in this
> > dialog, and also make sure it works if more than 9 options are
> > available. Hint: It might be a good idea to provide the response as
> > json {'option': <selected option>, 'menu_item': <pressed button>}
> > in this case. (Again, this could be a follow-up patch.)
> Hmm, that makes sense. I will update this patch, but it will be quite
> a while because I will have to make the other interface as well. But
> I think it is best to get things right.

Indeed ;-)  Just send the new patch whenever it's ready. [1]

I won't complain if you also have some time to write some unittests for
the json interface ;-)


Christian Boltz

[1] The obvious deadline is SLE13 - it would be a bad idea to include 
    the old perl code and/or the old YaST module in it ;-)
Die Frage des besten MUA hat bei mir längst die Vernunftebene verlassen.
Dann wäre ich bei Evolution geblieben.   Ich will diese verfluchte Kiste
in die Knie zwingen, Punkt. Koste es, was es wolle. Also mutt. Den Feind
auf seinem eigenen Territorium besiegen.                         [Ratti]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20170414/71c72db4/attachment.pgp>

More information about the AppArmor mailing list