MCPcopy Index your code
hub / github.com/coder/coder / checkForLockfile

Method checkForLockfile

cli/templatepush.go:357–375  ·  view source on GitHub ↗
(inv *serpent.Invocation)

Source from the content-addressed store, hash-verified

355}
356
357func (pf *templateUploadFlags) checkForLockfile(inv *serpent.Invocation) error {
358 if pf.stdin(inv) || pf.ignoreLockfile {
359 // Just assume there's a lockfile if reading from stdin.
360 return nil
361 }
362
363 hasLockfile, err := provisionersdk.DirHasLockfile(pf.directory)
364 if err != nil {
365 return xerrors.Errorf("dir has lockfile: %w", err)
366 }
367
368 if !hasLockfile {
369 cliui.Warn(inv.Stdout, "No .terraform.lock.hcl file found",
370 "When provisioning, Coder will be unable to cache providers without a lockfile and must download them from the internet each time.",
371 "Create one by running "+pretty.Sprint(cliui.DefaultStyles.Code, "terraform init")+" in your template directory.",
372 )
373 }
374 return nil
375}
376
377func (pf *templateUploadFlags) templateMessage(inv *serpent.Invocation) string {
378 title := strings.SplitN(pf.message, "\n", 2)[0]

Callers 2

templateCreateMethod · 0.80
templatePushMethod · 0.80

Calls 4

stdinMethod · 0.95
DirHasLockfileFunction · 0.92
WarnFunction · 0.92
ErrorfMethod · 0.45

Tested by

no test coverage detected