MCPcopy Create free account
hub / github.com/containers/fetchit / processRaw

Method processRaw

pkg/engine/fetchit.go:398–446  ·  view source on GitHub ↗
(ctx context.Context, target *Target, skew int)

Source from the content-addressed store, hash-verified

396}
397
398func (hc *FetchitConfig) processRaw(ctx context.Context, target *Target, skew int) {
399 time.Sleep(time.Duration(skew) * time.Millisecond)
400 target.mu.Lock()
401 defer target.mu.Unlock()
402
403 raw := target.Methods.Raw
404 initial := raw.initialRun
405 tag := []string{".json", ".yaml", ".yml"}
406 mo := &SingleMethodObj{
407 Conn: hc.conn,
408 Method: rawMethod,
409 Target: target,
410 }
411
412 if initial {
413 err := hc.getClone(target)
414 if err != nil {
415 klog.Errorf("Failed to clone repo at %s for target %s: %v", target.Url, target.Name, err)
416 return
417 }
418 }
419
420 latest, err := hc.GetLatest(mo.Target)
421 if err != nil {
422 klog.Errorf("Failed to get latest commit: %v", err)
423 return
424 }
425
426 current, err := hc.GetCurrent(mo.Target, mo.Method)
427 if err != nil {
428 klog.Errorf("Failed to get current commit: %v", err)
429 return
430 }
431
432 if latest != current {
433 err = hc.Apply(ctx, mo, current, latest, mo.Target.Methods.Raw.TargetPath, &tag)
434 if err != nil {
435 klog.Errorf("Failed to apply changes: %v", err)
436 return
437 }
438
439 hc.UpdateCurrent(ctx, target, mo.Method, latest)
440 klog.Infof("Moved raw from %s to %s for target %s", current, latest, target.Name)
441 } else {
442 klog.Infof("No changes applied to target %s this run, raw currently at %s", target.Name, current)
443 }
444
445 raw.initialRun = false
446}
447
448func (hc *FetchitConfig) processAnsible(ctx context.Context, target *Target, skew int) {
449 time.Sleep(time.Duration(skew) * time.Millisecond)

Callers

nothing calls this directly

Calls 5

getCloneMethod · 0.95
GetLatestMethod · 0.95
GetCurrentMethod · 0.95
ApplyMethod · 0.95
UpdateCurrentMethod · 0.95

Tested by

no test coverage detected