(ctx context.Context, target *Target, skew int)
| 495 | } |
| 496 | |
| 497 | func (hc *FetchitConfig) processSystemd(ctx context.Context, target *Target, skew int) { |
| 498 | time.Sleep(time.Duration(skew) * time.Millisecond) |
| 499 | target.mu.Lock() |
| 500 | defer target.mu.Unlock() |
| 501 | |
| 502 | sd := target.Methods.Systemd |
| 503 | if sd.AutoUpdateAll && !sd.initialRun { |
| 504 | return |
| 505 | } |
| 506 | if sd.AutoUpdateAll { |
| 507 | sd.Enable = false |
| 508 | target.Url = "" |
| 509 | sd.Root = true |
| 510 | sd.TargetPath = "" |
| 511 | sd.Restart = false |
| 512 | } |
| 513 | initial := sd.initialRun |
| 514 | mo := &SingleMethodObj{ |
| 515 | Conn: hc.conn, |
| 516 | Method: systemdMethod, |
| 517 | Target: target, |
| 518 | } |
| 519 | tag := []string{".service"} |
| 520 | if sd.Restart { |
| 521 | sd.Enable = true |
| 522 | } |
| 523 | if initial { |
| 524 | if sd.AutoUpdateAll { |
| 525 | if err := hc.EngineMethod(ctx, mo, "", nil); err != nil { |
| 526 | klog.Infof("Failed to start podman-auto-update.service: %v", err) |
| 527 | } |
| 528 | sd.initialRun = false |
| 529 | return |
| 530 | } |
| 531 | err := hc.getClone(target) |
| 532 | if err != nil { |
| 533 | klog.Errorf("Failed to clone repo at %s for target %s: %v", target.Url, target.Name, err) |
| 534 | return |
| 535 | } |
| 536 | } |
| 537 | |
| 538 | latest, err := hc.GetLatest(mo.Target) |
| 539 | if err != nil { |
| 540 | klog.Errorf("Failed to get latest commit: %v", err) |
| 541 | return |
| 542 | } |
| 543 | |
| 544 | current, err := hc.GetCurrent(mo.Target, mo.Method) |
| 545 | if err != nil { |
| 546 | klog.Errorf("Failed to get current commit: %v", err) |
| 547 | return |
| 548 | } |
| 549 | |
| 550 | if latest != current { |
| 551 | err = hc.Apply(ctx, mo, current, latest, mo.Target.Methods.Systemd.TargetPath, &tag) |
| 552 | if err != nil { |
| 553 | klog.Errorf("Failed to apply changes: %v", err) |
| 554 | return |
nothing calls this directly
no test coverage detected