chezmoi: Possible race condition when using .chezmoiexternal to source vlt binary needed for template functions

What exactly are you trying to do?

On a Linux server that I do not have root/sudo access to, I am fetching the vlt binary with .chezmoiexternal.yaml as so:

{{- $vltVersion := "0.2.2" -}}
".local/bin/vlt":
  type: archive-file
  url: "https://releases.hashicorp.com/vlt/{{ $vltVersion }}/vlt_{{ $vltVersion }}_{{ .chezmoi.os }}_{{ .chezmoi.arch }}.zip"
  executable: true

When I run chezmoi init username --apply I get a chezmoi error

$ chezmoi init arrrgi --apply --branch=feature/setup-scripts --verbose
chezmoi: .local/bin/vlt: missing path

Before running the command above, chezmoi doctor reports that vlt is not found in $PATH.

This obviously comes down to the Application Order that has been raised in previous issues but I’m struggling to find another way to make this scenario work without manually installing vlt before chezmoi.

What have you tried so far?

Describe what you have tried so far.

Where else have you checked for solutions?

Output of chezmoi doctor

$ chezmoi doctor

Additional context

Add any other context about the problem here.

About this issue

  • Original URL
  • State: closed
  • Created 9 months ago
  • Comments: 17 (4 by maintainers)

Most upvoted comments

Works, albeit with a couple of new issues which I’ll open. ie.

  • vlt secrets are no longer fetched and populated in templates in first apply
  • unexpected call to read-source-state when running chezmoi data

Otherwise, this is fantastic and really closed that gap for installation of password managers, etc required for templates. Feel free to refer to the shell script I created https://github.com/arrrgi/dotfiles/blob/719c26d4ba0c10636d7d091e2e27338f4785f746/home/.hooks/.install-hcp-vlt.sh

Closing.