Skip to content

Commit

Permalink
Merge pull request #87 from microsoft/add-check-for-yq-version
Browse files Browse the repository at this point in the history
adding yq removal script
  • Loading branch information
bradarm authored Jul 26, 2024
2 parents 5c6601e + f960ad6 commit a1aeab0
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions modules/m_30_app_prereqs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,25 @@ function _app_prereqs_validate() {
is_cmd_available "cfssljson" has_cfssljson_cmd
is_cmd_available "helm" has_helm_cmd

if [[ $has_yq_cmd == true ]]; then
debug_log "yq is installed. Checking version..."
run_a_script "yq --version" yq_version
if [[ "${yq_version}" == *"${VER_YQ}"* ]]; then
debug_log "yq version is correct. (${VER_YQ})"
else
debug_log "yq version is incorrect. Expected: ${VER_YQ}. Found: ${yq_version}. Removing previous to trigger reinstall"
run_a_script "which -a yq" yq_paths
for yq_path in $yq_paths; do
if [[ -f "$yq_path" ]]; then
debug_log "Removing yq at $yq_path"
run_a_script "sudo rm -f $yq_path"
debug_log "...successfull removed old version of yq at $yq_path"
fi
done
debug_log "Successfully removed previous versions of yq"
has_yq_cmd=false
fi
fi

if [[ $has_yq_cmd == true ]] && [[ $has_jq_cmd == true ]] && [[ $has_regctl_cmd == true ]] && [[ $has_cfssl_cmd == true ]] && [[ $has_cfssljson_cmd == true ]] && [[ $has_helm_cmd == true ]]; then
info_log "All third party apps are installed and available."
Expand Down

0 comments on commit a1aeab0

Please sign in to comment.