-
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
Systemd Service handling #9
Conversation
src/include/apparmor/aa-config.rb
Outdated
end | ||
|
||
def changeAppArmorState(aaEnabled) | ||
error = nil | ||
aaAction = "" | ||
service = Yast::ServiceClass.new |
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.
this is not needed, service already contain instance Yast::Service
on which you can do calls like Yast::Service.enable("apparmor")
src/include/apparmor/aa-config.rb
Outdated
|
||
if aaEnabled == true | ||
aaAction = "apparmor:enable" | ||
error = service.start("apparmor") | ||
if error == true |
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.
bad indentation and not needed to test equal to true, so it can be if error
but bigger problem is that it is in fact not error but success to if success
src/include/apparmor/aa-config.rb
Outdated
end | ||
|
||
error = SCR.Execute(path(".aaconf"), aaAction) | ||
|
||
if error != nil && Ops.is_string?(error) |
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.
with new logic this cannot happen anymore as error is true/false and never string
src/include/apparmor/aa-config.rb
Outdated
@@ -33,20 +33,26 @@ def initialize_apparmor_aa_config(include_target) | |||
Yast.import "Label" | |||
Yast.import "Popup" | |||
Yast.import "Wizard" | |||
Yast.import "Service" | |||
end | |||
|
|||
def changeAppArmorState(aaEnabled) | |||
error = nil | |||
aaAction = "" |
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.
both variables no longer needed, as error is written later and aaAction is not used anymore.
src/include/apparmor/aa-config.rb
Outdated
elsif evnotify == "notinstalled" | ||
evnotify = "disabled" | ||
end | ||
aaEnabled = Yast::ServiceClass.new.Enabled("apparmor") |
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.
it can be simple aaEnabled = Yast::Service.Enabled("apparmor")
@@ -1386,7 +1386,7 @@ def DisplayProfileForm(pathname, hat) | |||
"PROFILE_NAME" => pathname | |||
} | |||
result = SCR.Write(path(".apparmor_profiles"), argmap) | |||
result2 = SCR.Write(path(".apparmor_profiles.reload"), "-") | |||
result2 = SCR.Execute(path(".target.bash"), "/sbin/apparmor_parser -r /etc/apparmor.d") |
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.
wrong indentation
src/include/apparmor/aa-config.rb
Outdated
success = Yast::Service.start("apparmor") | ||
if success | ||
success = Yast::Service.enable("apparmor") | ||
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.
you can write it as success = Yast::Service.start("apparmor") && Yast::Service.enable("apparmor")
src/include/apparmor/aa-config.rb
Outdated
success = Yast::Service.stop("apparmor") | ||
if success | ||
success = Yast::Service.disable("apparmor") | ||
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.
same here as success = Yast::Service.stop("apparmor") && Yast::Service.disable("apparmor")
src/include/apparmor/aa-config.rb
Outdated
error = SCR.Execute(path(".aaconf"), aaAction) | ||
|
||
if error != nil && Ops.is_string?(error) | ||
if !success | ||
errorMsg = Convert.to_string(error) |
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.
this is not defined now, please remove this line.
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 last two changes and please add new entry to changes (using osc vc
) and increase version, so it will be auto submitted. Thanks
also please fix spec file, so build passes. You can verify it locally when calling |
Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
This was disabled long ago and has no relevance with modern apparmor. However, some of the features will be restored in the future. Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
The perl library calls the system command to reload the profiles. Instead call the command direcly. This also reduces dependency on the apparmor perl library which will be removed eventually. Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
Removes unused notify.pm
thanks for patch |
Systemd service handling
Removal of unused notify settings
Change of reload sequence to use apparmor_parser directly