-
Notifications
You must be signed in to change notification settings - Fork 246
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 for systemd instantiated services when enabled via ignition #934
Conversation
Can one of the admins verify this patch? |
Since we need to combine all instantiated units of a given service into one line (i.e. |
388f6a1
to
d5c274b
Compare
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.
Also, overarching question: why use strings.Builder
over a list of strings? It seems like you're treating them at as space-delimited lists anyways.
d5c274b
to
220dc8b
Compare
220dc8b
to
34efbb6
Compare
Seems like it would be a heck of a lot easier to update systemd to accept the Thanks for working on this! |
8c7f536
to
d0c5135
Compare
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.
A few comments inline in the code. In general I think we can collapse a lot of logic if we structure our data differently. We could build up a presets
map using a new Preset
type and hold all the information we need I think. Something like the following map/Type:
package main
import "fmt"
type Preset struct {
unit string
enabled bool
instantiateable bool
instances []string
}
func main() {
presets := make(map[string]*Preset)
presets["sshd.service"] = &Preset{"sshd.service", true, false, []string{}}
presets["chronyd.service"] = &Preset{"chronyd.service", false, false, []string{}}
presets["[email protected]"] = &Preset{"[email protected]", true, true, []string{"foo"}}
presets["[email protected]"].instances = append(presets["[email protected]"].instances, "bar")
for _, value := range presets {
fmt.Println()
fmt.Println("unit:", value.unit)
fmt.Println("enabled:", value.enabled)
fmt.Println("instantiateable:", value.instantiateable)
if value.instantiateable {
fmt.Println("instances:", value.instances)
}
}
}
d0c5135
to
8af11b4
Compare
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.
Nice work.. Some new comments
965dd1e
to
5e1ccd2
Compare
5e1ccd2
to
c59233c
Compare
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.
new comments
9fef655
to
d064bdf
Compare
d064bdf
to
9bfdd36
Compare
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.
Generally looks pretty good. Just some nits.
In your commit message:
Code to fix the systemd instatiated services when enabled/disabled via ignition
Code to
is obvious, as is via ignition
. What about Fix enabling systemd instantiated services
, with a link to the original issue?
29493ff
to
cb3f64f
Compare
26f83c1
to
9c5eaf6
Compare
0e83fc3
to
849ba84
Compare
849ba84
to
842010c
Compare
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.
The Code LGTM - Nice work @sohankunkerkar
Fixes #586