Skip to content

Commit

Permalink
Try StopPost instead of ExecStopPost for systemd < 237 (for #69)
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalif committed Dec 27, 2023
1 parent a04f1c3 commit 5786485
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/mounter/geesefs.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ func (geesefs *geesefsMounter) Mount(target, volumeID string) error {
}
}
if curPath != target {
// FIXME This may mean that the same bucket&path are used for multiple PVs. Support it somehow
return fmt.Errorf(
"GeeseFS for volume %v is already mounted on host, but"+
" in a different directory. We want %v, but it's in %v",
Expand All @@ -198,6 +199,15 @@ func (geesefs *geesefsMounter) Mount(target, volumeID string) error {
}
}
_, err = conn.StartTransientUnit(unitName, "replace", newProps, nil)
if err != nil && strings.Index(err.Error(), "Cannot set property ExecStopPost") >= 0 {
// Maybe this is an old systemd where it's named StopPost
for i := range newProps {
if newProps[i].Name == "ExecStopPost" {
newProps[i].Name = "StopPost"
}
}
_, err = conn.StartTransientUnit(unitName, "replace", newProps, nil)
}
if err != nil {
return fmt.Errorf("Error starting systemd unit %s on host: %v", unitName, err)
}
Expand Down

0 comments on commit 5786485

Please sign in to comment.