Skip to content

Commit

Permalink
Merge pull request tfutils#258 from reegnz/fix_auto_install
Browse files Browse the repository at this point in the history
Perform auto-install of exact versions even if version folder is missing
  • Loading branch information
Zordrak authored Aug 14, 2021
2 parents 1ba4b20 + 4a6d76e commit f7d918f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions libexec/tfenv-version-name
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ fi;
for dir in libexec bin; do
case ":${PATH}:" in
*:${TFENV_ROOT}/${dir}:*) log 'debug' "\$PATH already contains '${TFENV_ROOT}/${dir}', not adding it again";;
*)
*)
log 'debug' "\$PATH does not contain '${TFENV_ROOT}/${dir}', prepending and exporting it now";
export PATH="${TFENV_ROOT}/${dir}:${PATH}";
;;
Expand All @@ -60,9 +60,6 @@ done;
# Begin Script Body #
#####################

[ -d "${TFENV_CONFIG_DIR}/versions" ] \
|| log 'error' 'No versions of terraform installed. Please install one with: tfenv install';

if [ -z "${TFENV_TERRAFORM_VERSION:-""}" ]; then
TFENV_VERSION_FILE="$(tfenv-version-file)" \
&& log 'debug' "TFENV_VERSION_FILE retrieved from tfenv-version-file: ${TFENV_VERSION_FILE}" \
Expand All @@ -82,6 +79,9 @@ fi
if [[ "${TFENV_VERSION}" =~ ^latest.*$ ]]; then
log 'debug' "TFENV_VERSION uses 'latest' keyword: ${TFENV_VERSION}";

[ -d "${TFENV_CONFIG_DIR}/versions" ] \
|| log 'error' 'No versions of terraform installed. Please install one with: tfenv install';

if [[ "${TFENV_VERSION}" =~ ^latest\:.*$ ]]; then
regex="${TFENV_VERSION##*\:}";
log 'debug' "'latest' keyword uses regex: ${regex}";
Expand Down Expand Up @@ -114,4 +114,4 @@ if [ ! -d "${TFENV_CONFIG_DIR}/versions/${TFENV_VERSION}" ]; then
log 'debug' "version '${TFENV_VERSION}' is not installed (set by ${TFENV_VERSION_SOURCE})";
fi;

echo "${TFENV_VERSION}";
echo "${TFENV_VERSION}";

0 comments on commit f7d918f

Please sign in to comment.