Closed arrrgi closed 1 year ago
Just a further comment to give context to what I'm trying to achieve:
vlt
by prompting for values when an earlier conditional is true so as not to store creds in codehcpVaultSecrets
config values for vlt
with the same conditionalvlt login
and vlt config init
commands during scripts (and in general any other user inputs in scripts) by having these values already setThere is likely a syntax error in the YAML generated by your config file template.
Check that the output of
chezmoi execute-template --init < ~/.local/share/chezmoi/home/.chezmoi.yaml.tmpl
is valid YAML.
Can see that some of the inputs/keys are being concatenated together, or indented incorrectly. ie
diff:
pager: delta
scriptEnv:
BREW_PATH: "/opt/homebrew/bin/brew"
HCP_CLIENT_ID: What is your Service Principal ID
HCP_CLIENT_SECRET: What is your Service Principal Secret
encryption: age
age:
identity: "/Users/rgillson/.config/age/key.txt"
recipient: "age........"
hcpVaultSecrets:organizationId: What is your Vault Organisation ID
projectId: What is your Vault Project ID
applicationName: chezmoi
data:
target:
darwin: true
debian: false
devcontainer: false
ubuntu: false
wsl: false
function:
hybrid: false
personal: true
work: false
access:
controlled: true
restricted: false
privacy:
private: true
public: false
state:
ephemeral: false
persistent: true
secrets:
apikeys: true
sshkeys: false
storagekeys: true
git:
email: "What is your Git associated email address"
gh_username: "What is your GitHub username"
name: "What is your full name"
I can see it needs the whitespace handling to be fixed, will update and close the ticket if this resolves the issue.
Closed. Needed to trim whitespace before the template functions. Thanks for the pointer again @twpayne 🙂
What exactly are you trying to do?
During
chezmoi init
I am prompting for details to populate into thescriptEnv
andhcpVaultSecrets
config arrays.encryption
,age
andhcpVaultSecrets
if earlier conditions are either evaluated as trueThe
chezmoi init
command returns:I am having difficulty determining what is causing the errors and how I can achieve the outcome to conditionally set a number of chezmoi configuration values. A reproduction is available here: https://github.com/arrrgi/dotfiles/blob/77a5e27ba7ebfb4d3ea6f8ed43996cf5c60eb971/home/.chezmoi.yaml.tmpl
What have you tried so far?
This snippet results in the first error detailed above:
I have also tried re-ordering and writing the
OR
condition for both conditional scenarios and this throws a different error:As an example:
Where else have you checked for solutions?
Output of any commands you've tried with
--verbose
flagOutput of
chezmoi doctor
Additional context
Add any other context about the problem here.