-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Removing perl code #15
Conversation
This is a precursor to use aa-status json profile view. Please note, "Configure" option is left hanging which will be filled in the next patch. Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
Handles the profiles using JSON output of aa-status. This replaces the earlier way of handling profiles. Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
src/lib/apparmor/genprof.rb
Outdated
else | ||
Yast::Report.Error(_('Unknown Dialog %s returned by apparmor') % hm['dialog']) | ||
nil | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just nitpick, but for really big case I prefer map for it like
DIALOG_MAPPING = {
'yesno' => YesNoDialog,
'yesnocancel' => YesNoCancelDialog,
...
}
and usage
dialog = hm['dialog']
dialog_class = DIALOG_MAPPING[dialog]
if dialog_class
dialog_class.new(hm)
else
Yast::Report.Error(_('Unknown Dialog %s returned by apparmor') % hm['dialog'])
nil
end
src/lib/apparmor/logprof.rb
Outdated
f.puts r.to_json | ||
f.flush | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for me this part looks quite similar to GenProf, maybe have common ancestor that share it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general it looks good, just few notes how code can be improved, but not required. so if you want to have it this way, just ping me and I will merge it.
Thanks for the comments. I will incorporate these changes. |
The apparmor_ui_dialog communicates with aa-logprof in JSON. Each dialog is converted to a yast dialog for input from the user and returns the actions performed in yast in the form of JSON response. An extra opendialog has been used to indicate the end of the logprof execution. Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
Asks for filename of the program and run aa-genprof --json against the program. Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
The primary reason of this effort is to do away with deprecated apparmor code. Since yast was the major user of the code, we added JSON functionality in apparmor to communicate with yast-apparmor.