tfenv icon indicating copy to clipboard operation
tfenv copied to clipboard

Latest alpha unable to find version file in tfenv root under upstart script

Open nwalke opened this issue 6 years ago • 2 comments

I've got the tfenv repo checked out at /opt/tfenv. I symlinked tfenv and terraform from the bin dir to /usr/bin/tfenv and /usr/bin/terraform. I have an upstart (Amazon linux 1 :( ) process that simply does terraform -v. On system start, I have a script that runs tfenv install latest so that the "system" wide Terraform is whatever the latest version is. Users running terraform -v works fine, but my upstart script results in this output with the latest alpha:

/opt/tfenv/libexec/tfenv-version-file: line 83: HOME: unbound variable
Failed to retrieve TFENV_VERSION_FILE from tfenv-version-file

If I switch /opt/tfenv back to 1.0.2 (after running tfenv install latest so that /opt/tfenv/version is generated), I get the desired output of:

Terraform v0.12.18

It would appear that however the alpha is determining paths to the tfenv root is broken when run under a script like this.

nwalke avatar Dec 14 '19 19:12 nwalke

Hmm ottomh I'm guessing we've not provided a default for HOME leaving it unbound if unset. Will look to fix this shortly. I would imagine it will be a s/${HOME}/${HOME:-/}/

Zordrak avatar Dec 14 '19 20:12 Zordrak

Has this issue been solved? I think the changes to fix it are done.

Zordrak avatar May 27 '20 10:05 Zordrak