Skip to content

Commit a1aeab0

Browse files
authored
Merge pull request #87 from microsoft/add-check-for-yq-version
adding yq removal script
2 parents 5c6601e + f960ad6 commit a1aeab0

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

modules/m_30_app_prereqs.sh

+19
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,25 @@ function _app_prereqs_validate() {
2121
is_cmd_available "cfssljson" has_cfssljson_cmd
2222
is_cmd_available "helm" has_helm_cmd
2323

24+
if [[ $has_yq_cmd == true ]]; then
25+
debug_log "yq is installed. Checking version..."
26+
run_a_script "yq --version" yq_version
27+
if [[ "${yq_version}" == *"${VER_YQ}"* ]]; then
28+
debug_log "yq version is correct. (${VER_YQ})"
29+
else
30+
debug_log "yq version is incorrect. Expected: ${VER_YQ}. Found: ${yq_version}. Removing previous to trigger reinstall"
31+
run_a_script "which -a yq" yq_paths
32+
for yq_path in $yq_paths; do
33+
if [[ -f "$yq_path" ]]; then
34+
debug_log "Removing yq at $yq_path"
35+
run_a_script "sudo rm -f $yq_path"
36+
debug_log "...successfull removed old version of yq at $yq_path"
37+
fi
38+
done
39+
debug_log "Successfully removed previous versions of yq"
40+
has_yq_cmd=false
41+
fi
42+
fi
2443

2544
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
2645
info_log "All third party apps are installed and available."

0 commit comments

Comments
 (0)