mirror of
https://github.com/containers/podman.git
synced 2025-07-15 03:02:52 +08:00
Merge pull request #16785 from vrothberg/fix-14531
health check: ignore dependencies of transient systemd units/timers
This commit is contained in:
@ -111,7 +111,7 @@ func (c *Container) removeTransientFiles(ctx context.Context, isStartup bool) er
|
|||||||
// fire after the service is stopped.
|
// fire after the service is stopped.
|
||||||
timerChan := make(chan string)
|
timerChan := make(chan string)
|
||||||
timerFile := fmt.Sprintf("%s.timer", c.hcUnitName(isStartup))
|
timerFile := fmt.Sprintf("%s.timer", c.hcUnitName(isStartup))
|
||||||
if _, err := conn.StopUnitContext(ctx, timerFile, "fail", timerChan); err != nil {
|
if _, err := conn.StopUnitContext(ctx, timerFile, "ignore-dependencies", timerChan); err != nil {
|
||||||
if !strings.HasSuffix(err.Error(), ".timer not loaded.") {
|
if !strings.HasSuffix(err.Error(), ".timer not loaded.") {
|
||||||
stopErrors = append(stopErrors, fmt.Errorf("removing health-check timer %q: %w", timerFile, err))
|
stopErrors = append(stopErrors, fmt.Errorf("removing health-check timer %q: %w", timerFile, err))
|
||||||
}
|
}
|
||||||
@ -126,7 +126,7 @@ func (c *Container) removeTransientFiles(ctx context.Context, isStartup bool) er
|
|||||||
if err := conn.ResetFailedUnitContext(ctx, serviceFile); err != nil {
|
if err := conn.ResetFailedUnitContext(ctx, serviceFile); err != nil {
|
||||||
logrus.Debugf("Failed to reset unit file: %q", err)
|
logrus.Debugf("Failed to reset unit file: %q", err)
|
||||||
}
|
}
|
||||||
if _, err := conn.StopUnitContext(ctx, serviceFile, "fail", serviceChan); err != nil {
|
if _, err := conn.StopUnitContext(ctx, serviceFile, "ignore-dependencies", serviceChan); err != nil {
|
||||||
if !strings.HasSuffix(err.Error(), ".service not loaded.") {
|
if !strings.HasSuffix(err.Error(), ".service not loaded.") {
|
||||||
stopErrors = append(stopErrors, fmt.Errorf("removing health-check service %q: %w", serviceFile, err))
|
stopErrors = append(stopErrors, fmt.Errorf("removing health-check service %q: %w", serviceFile, err))
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user