Skip to content
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

Merged
merged 4 commits into from
Apr 4, 2017
Merged

Systemd Service handling #9

merged 4 commits into from
Apr 4, 2017

Conversation

goldwynr
Copy link
Collaborator

Systemd service handling
Removal of unused notify settings
Change of reload sequence to use apparmor_parser directly

end

def changeAppArmorState(aaEnabled)
error = nil
aaAction = ""
service = Yast::ServiceClass.new
Copy link
Member

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")


if aaEnabled == true
aaAction = "apparmor:enable"
error = service.start("apparmor")
if error == true
Copy link
Member

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

end

error = SCR.Execute(path(".aaconf"), aaAction)

if error != nil && Ops.is_string?(error)
Copy link
Member

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

@@ -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 = ""
Copy link
Member

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.

elsif evnotify == "notinstalled"
evnotify = "disabled"
end
aaEnabled = Yast::ServiceClass.new.Enabled("apparmor")
Copy link
Member

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")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrong indentation

success = Yast::Service.start("apparmor")
if success
success = Yast::Service.enable("apparmor")
end
Copy link
Member

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")

success = Yast::Service.stop("apparmor")
if success
success = Yast::Service.disable("apparmor")
end
Copy link
Member

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")

error = SCR.Execute(path(".aaconf"), aaAction)

if error != nil && Ops.is_string?(error)
if !success
errorMsg = Convert.to_string(error)
Copy link
Member

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.

Copy link
Member

@jreidinger jreidinger left a 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

@jreidinger
Copy link
Member

also please fix spec file, so build passes. You can verify it locally when calling rake osc:build which do rpm build.

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
@jreidinger
Copy link
Member

thanks for patch

@jreidinger jreidinger merged commit 9a1d53f into yast:master Apr 4, 2017
@goldwynr goldwynr deleted the for-next branch September 19, 2017 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants