(ctx context.Context, target *Target, skew int)
| 446 | } |
| 447 | |
| 448 | func (hc *FetchitConfig) processAnsible(ctx context.Context, target *Target, skew int) { |
| 449 | time.Sleep(time.Duration(skew) * time.Millisecond) |
| 450 | target.mu.Lock() |
| 451 | defer target.mu.Unlock() |
| 452 | |
| 453 | ans := target.Methods.Ansible |
| 454 | initial := ans.initialRun |
| 455 | tag := []string{"yaml", "yml"} |
| 456 | mo := &SingleMethodObj{ |
| 457 | Conn: hc.conn, |
| 458 | Method: ansibleMethod, |
| 459 | Target: target, |
| 460 | } |
| 461 | if initial { |
| 462 | err := hc.getClone(target) |
| 463 | if err != nil { |
| 464 | klog.Errorf("Failed to clone repo at %s for target %s: %v", target.Url, target.Name, err) |
| 465 | return |
| 466 | } |
| 467 | } |
| 468 | |
| 469 | latest, err := hc.GetLatest(mo.Target) |
| 470 | if err != nil { |
| 471 | klog.Errorf("Failed to get latest commit: %v", err) |
| 472 | return |
| 473 | } |
| 474 | |
| 475 | current, err := hc.GetCurrent(mo.Target, mo.Method) |
| 476 | if err != nil { |
| 477 | klog.Errorf("Failed to get current commit: %v", err) |
| 478 | return |
| 479 | } |
| 480 | |
| 481 | if latest != current { |
| 482 | err = hc.Apply(ctx, mo, current, latest, mo.Target.Methods.Ansible.TargetPath, &tag) |
| 483 | if err != nil { |
| 484 | klog.Errorf("Failed to apply changes: %v", err) |
| 485 | return |
| 486 | } |
| 487 | |
| 488 | hc.UpdateCurrent(ctx, target, mo.Method, latest) |
| 489 | klog.Infof("Moved ansible from %s to %s for target %s", current, latest, target.Name) |
| 490 | } else { |
| 491 | klog.Infof("No changes applied to target %s this run, ansible currently at %s", target.Name, current) |
| 492 | } |
| 493 | |
| 494 | ans.initialRun = false |
| 495 | } |
| 496 | |
| 497 | func (hc *FetchitConfig) processSystemd(ctx context.Context, target *Target, skew int) { |
| 498 | time.Sleep(time.Duration(skew) * time.Millisecond) |
nothing calls this directly
no test coverage detected