-
Notifications
You must be signed in to change notification settings - Fork 27
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
Fix RPM Systemd Artifact Support #310
Fix RPM Systemd Artifact Support #310
Conversation
frontend/rpm/template.go
Outdated
@@ -317,6 +325,22 @@ func (w *specWrapper) PreUn() fmt.Stringer { | |||
return b | |||
} | |||
|
|||
func systemdPostScript(unitName string, cfg dalec.SystemdUnitConfig) string { | |||
verb := "disable" |
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 should take into account the default value and do nothing.
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.
Actually thinking about it we should probably only ever enable and do nothing when false.
I wrote up that other PR to make it a *bool
with the idea that we have these preset files but I'm thinking maybe we don't need that?
basically
if !cfg.Enable {
return ""
}
// systemctl enable
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.
Yeah that seems reasonable. Because I believe systemctl disable
is essentially a no-op unless the service is already enabled, right?
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.
And also potentially something we don't want to do willy-nilly.
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.
So this should be fixed. It does actually complicate things a bit though, because if we aren't explicitly disabling units, then we don't necessarily need a %post
section or %post
systemd dependency if no enabled units have been specified in the spec. I've added some logic to account for this
Can you add a revert of #307 since given this change I don't think we need it? |
…roperly include systemd as a %post dependency
This reverts commit 4551246.
fd0e806
to
5f6f703
Compare
This is done! |
What this PR does / why we need it:
Fixes #301. It is not good practice to include
.preset
files in an RPM package so this PR changes the%post
section of dalec-generated RPM Specs to enable/disable systemd units manually.Additionally, I discovered in the course of changing this behavior that systemd was not actually marked as a
post
,preun
andpostun
dependency, meaning that prost, preun, and postun scripts using thesystemd_*
macros were actually broken to begin with. This PR fixes that issue as well.Which issue(s) this PR fixes (optional, using
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when the PR gets merged):Fixes #
Special notes for your reviewer: