@@ -31,11 +31,6 @@ salt_url_version="${default_salt_url_version}"
3131salt_specific_version=" "
3232
3333readonly salt_name=" salt"
34- # DGM TBD to be replaced
35- # # DGM readonly repo_json_file="repo.json"
36- # # DGM pre_3006_base_url="https://repo.saltproject.io/salt/vmware-tools-onedir"
37- # # DGM # Release
38- # # DGM post_3005_base_url="https://repo.saltproject.io/salt/py3/onedir"
3934base_url=" "
4035
4136# Broadcom infrastructure
@@ -212,10 +207,6 @@ LOG_LEVEL=${LOG_LEVELS_ARY[warning]}
212207SOURCE_FLAG=0
213208SOURCE_PARAMS=" "
214209
215- # Flag for pre_3006 and post_3005, 0 => pre_3006, 1 => post_3005
216- # # DGM TBD POST_3005_FLAG=0
217- # # DGM TBD POST_3005_MAJOR_VER_FLAG=0
218-
219210
220211# helper functions
221212
@@ -425,10 +416,12 @@ _set_log_level() {
425416# for example: currently major version 3006 implies 3006.9
426417# the latest version of Salt 3006.x
427418#
428- # if an unsupported version is input, for example: 3004.2, it will default to installing the latest version
419+ # if an unsupported version is input, for example: 3004.2
420+ # it will default to installing the latest version
429421#
430422# Input:
431- # directory contains directory list of current available Salt versions, 3006.x - 3007.1
423+ # directory contains directory list of current available
424+ # Salt versions, 3006.x - 3007.1
432425#
433426# Results:
434427# Returns with exit code
@@ -443,17 +436,18 @@ _get_desired_salt_version_fn() {
443436 " specifying the location for directories containing versions Salt"
444437 fi
445438
446- _info_log " $0 :${FUNCNAME[0]} processing getting desired Salt version ' $salt_url_version ' for " \
447- " salt-minion to install, input directory $1 "
439+ _info_log " $0 :${FUNCNAME[0]} processing getting desired Salt version " \
440+ " ' $salt_url_version ' for salt-minion to install, input directory $1 "
448441
449442 generic_versions_tmpdir=" $1 "
450443 curr_pwd=$( pwd)
451444 cd ${generic_versions_tmpdir} || return 1
452445
453- # something werid is happening with tail, that does not fail in test programs getting failures inside tail hence use bash loop
446+ # something werid is happening with tail, that does not fail in test
447+ # programs getting failures inside tail hence use bash loop
454448 if [ " $salt_url_version " = " latest" ]; then
455449 # shellcheck disable=SC2010,SC2012
456- # # ## _GENERIC_PKG_VERSION=$(ls ./. | grep -v 'index.html' | sort -V -u | tail -n 1)
450+ # # _GENERIC_PKG_VERSION=$(ls ./. | grep -v 'index.html' | sort -V -u | tail -n 1)
457451 test_dir=$( ls ./. | grep -v ' index.html' | sort -V -u)
458452 for idx in $test_dir
459453 do
@@ -470,11 +464,13 @@ _get_desired_salt_version_fn() {
470464 do
471465 _GENERIC_PKG_VERSION=" $idx "
472466 done
473- _debug_log " $0 :${FUNCNAME[0]} input $salt_url_version found version '${_GENERIC_PKG_VERSION} '"
467+ _debug_log " $0 :${FUNCNAME[0]} input $salt_url_version found " \
468+ " version '${_GENERIC_PKG_VERSION} '"
474469
475470 elif [ " $( echo " $salt_url_version " | grep -E ' ^([3-9][0-5]{2}[6-9](\.[0-9]*)?)' ) " != " " ]; then
476471 # Minor version Salt, want specific minor version
477- # if old style VMTools version 3004.2-1 is used, defaults to else and install latest
472+ # if old style VMTools version 3004.2-1 is used
473+ # defaults to else and install latest
478474 _GENERIC_PKG_VERSION=" $salt_url_version "
479475 else
480476 # default to latest version Salt
@@ -509,7 +505,8 @@ _get_desired_salt_version_fn() {
509505# for example: 3006.8
510506#
511507# Results:
512- # Sets salt_url_version to latest or specified input Salt version, 3007, 3006, 3006.x
508+ # Sets salt_url_version to latest or specified input
509+ # Salt version, 3007, 3006, 3006.x
513510# Returns with exit code
514511#
515512
@@ -543,55 +540,6 @@ _set_install_minion_version_fn() {
543540 return 0
544541}
545542
546- # # DGM TBD this to be removed
547- #
548- # _set_post_3005_flags_from_version
549- #
550- # Sets the POST_3005_FLAG and POST_3005_MAJOR_VER_FLAG
551- # from the version currently present in salt_url_version
552- #
553- # Will also set base_url if not already defined by --source option
554- #
555- # Results:
556- # Returns with exit code
557- #
558- # # DGM _set_post_3005_flags_from_version() {
559- # # DGM _info_log "$0:${FUNCNAME[0]} setting POST_3005_FLAG and "\
560- # # DGM "POST_3005_MAJOR_VER_FLAG from Salt version '${salt_url_version}'"
561- # # DGM
562- # # DGM if [[ "latest" = "${salt_url_version}" ]]; then
563- # # DGM POST_3005_FLAG=1
564- # # DGM POST_3005_MAJOR_VER_FLAG=1
565- # # DGM base_url="${post_3005_base_url}"
566- # # DGM # done, already have url for latest & major versions
567- # # DGM _debug_log "$0:${FUNCNAME[0]} post-3005 install, using latest "\
568- # # DGM "base_url '${base_url}'"
569- # # DGM else
570- # # DGM ver_chk=$(echo "${salt_url_version}" | cut -d '.' -f 1)
571- # # DGM if [[ ${ver_chk} -ge 3006 ]]; then
572- # # DGM POST_3005_FLAG=1
573- # # DGM ver_chk_major=$(echo "${salt_url_version}" | cut -d '.' -f 1)
574- # # DGM ver_chk_minor=$(echo "${salt_url_version}" | cut -d '.' -f 2)
575- # # DGM _debug_log "$0:${FUNCNAME[0]} post-3005 install, checking "\
576- # # DGM "for major version only '${ver_chk_major}', minor "\
577- # # DGM "'${ver_chk_minor}'"
578- # # DGM if [[ "${ver_chk_major}" = "${ver_chk_minor}" ]]; then
579- # # DGM POST_3005_MAJOR_VER_FLAG=1
580- # # DGM base_url="${post_3005_base_url}"
581- # # DGM else
582- # # DGM base_url="${post_3005_base_url}/minor"
583- # # DGM fi
584- # # DGM _debug_log "$0:${FUNCNAME[0]} post-3005 install, for "\
585- # # DGM "'${salt_url_version}' using base_url '${base_url}'"
586- # # DGM else
587- # # DGM # install pre-3006, use older url
588- # # DGM base_url="${pre_3006_base_url}"
589- # # DGM _debug_log "$0:${FUNCNAME[0]} pre-3006 install, for "\
590- # # DGM "'${salt_url_version}' using base_url '${base_url}'"
591- # # DGM fi
592- # # DGM fi
593- # # DGM }
594-
595543
596544#
597545# _update_minion_conf_ary
@@ -943,135 +891,6 @@ _fetch_vmtools_salt_minion_conf() {
943891# # DGM return 0
944892# # DGM }
945893
946- # # DGM TBD to be removed
947- # # #
948- # # # _parse_json_specd_ver
949- # # #
950- # # # Retrieve the salt-minion from Salt repository
951- # # #
952- # # # Results:
953- # # # Echos string containing colon separated version, name and sha512
954- # # # from parsed input repo json file
955- # # # Echos empty '' if 'salt_url_version' is not found in repo json file
956- # # #
957- # # # Note: salt_url_version defaults to 'latest' unless set to a specific
958- # # # Salt minion version, for example: 3004.1-1
959- # # #
960- # #
961- # # _parse_json_specd_ver() {
962- # # local file_name="$1"
963- # # local file_value=""
964- # # local blk_count=0
965- # # local specd_ver_blk_count=0
966- # # local specd_ver_flag=0
967- # # local found_specd_ver_linux=0
968- # #
969- # # local var1=""
970- # # local var2=""
971- # # local machine_arch_chk="${MACHINE_ARCH}"
972- # # declare -A rdict
973- # #
974- # # _info_log "$0:${FUNCNAME[0]} parsing of repo json file '${file_name}'"
975- # #
976- # # if [[ ${POST_3005_FLAG} -eq 0 ]]; then
977- # # machine_arch_chk="amd64" # pre_3006 used amd64
978- # # fi
979- # #
980- # # file_value=$(<"${file_name}")
981- # #
982- # # # limit 80 cols
983- # # var1=$(echo "${file_value}" | sed 's/,/,\n/g' | sed 's/{/\n{\n/g')
984- # # var2=$(echo "${var1}" | sed 's/}/\n}\n/g' | sed 's/,//g' | sed 's/"//g')
985- # #
986- # # while IFS= read -r line
987- # # do
988- # # _debug_log "$0:${FUNCNAME[0]} parsing line '${line}'"
989- # # if [[ -z "${line}" ]]; then
990- # # continue
991- # # fi
992- # # if [[ "${line}" = "{" ]]; then
993- # # (( blk_count++ ))
994- # # elif [[ "${line}" = "}" ]]; then
995- # # # examine directory just read in
996- # # if [[ ${specd_ver_flag} -eq 1 ]]; then
997- # # if [[ "${rdict['os']}" = "linux" \
998- # # && "${rdict['arch']}" = "${machine_arch_chk}" ]]; then
999- # # # have linux values for specd_ver
1000- # # _debug_log "$0:${FUNCNAME[0]} parsed following linux for "\
1001- # # "specified version '${salt_url_version}' from repo json "\
1002- # # "file '${file_name}', os ${rdict['os']}, version "\
1003- # # "${rdict['version']}, name ${rdict['name']}, sha512 "\
1004- # # "${rdict['SHA512']}"
1005- # # found_specd_ver_linux=1
1006- # # break
1007- # # fi
1008- # # fi
1009- # #
1010- # # if [[ ${blk_count} -eq ${specd_ver_blk_count} ]]; then
1011- # # specd_ver_flag=0
1012- # # ## break
1013- # # fi
1014- # # (( blk_count-- ))
1015- # # else
1016- # # if [[ ${POST_3005_FLAG} -eq 1 \
1017- # # && ${POST_3005_MAJOR_VER_FLAG} -eq 1 ]]; then
1018- # # # doing major version check
1019- # # line_major_key=$(echo "${line}" | cut -d ':' -f 1 | cut -d '-' -f 2 | cut -d '.' -f 1 |xargs)
1020- # # line_key=$(echo "${line}" | cut -d ':' -f 1 | xargs)
1021- # # line_value=$(echo "${line}" | cut -d ':' -f 2 | xargs)
1022- # # _debug_log "$0:${FUNCNAME[0]} check line_major_key "\
1023- # # "'${line_major_key}' again salt_url_version "\
1024- # # "'${salt_url_version}', line_key '${line_key}', "\
1025- # # "line_value '${line_value}'"
1026- # # if [[ "${line_major_key}" = "${salt_url_version}" ]]; then
1027- # # # blk_count encountered 'specd_ver', closing brace check
1028- # # specd_ver_flag=1
1029- # # specd_ver_blk_count=${blk_count}
1030- # # (( specd_ver_blk_count++ ))
1031- # # _debug_log "$0:${FUNCNAME[0]} found specd version, "\
1032- # # "version '${salt_url_version}' and line_major_key "\
1033- # # "'${line_major_key}', line_key '${line_key}' "\
1034- # # "specd_ver_blk_count '${specd_ver_blk_count}'"
1035- # # else
1036- # # rdict["${line_key}"]="${line_value}"
1037- # # _debug_log "$0:${FUNCNAME[0]} updated dictionary for "\
1038- # # "major version with line_key '${line_key}' and "\
1039- # # "line_value '${line_value}'"
1040- # # fi
1041- # # else
1042- # # line_key=$(echo "${line}" | cut -d ':' -f 1 | xargs)
1043- # # line_value=$(echo "${line}" | cut -d ':' -f 2 | xargs)
1044- # # _debug_log "$0:${FUNCNAME[0]} check line_key '${line_key}' "\
1045- # # "again salt_url_version '${salt_url_version}', "\
1046- # # "line_value '${line_value}'"
1047- # # if [[ "${line_key}" = "${salt_url_version}" ]]; then
1048- # # # blk_count encountered 'specd_ver', closing brace check
1049- # # specd_ver_flag=1
1050- # # specd_ver_blk_count=${blk_count}
1051- # # (( specd_ver_blk_count++ ))
1052- # # _debug_log "$0:${FUNCNAME[0]} found specd version, "\
1053- # # "version '${salt_url_version}' and line_key "\
1054- # # "'${line_key}' and specd_ver_blk_count "\
1055- # # "'${specd_ver_blk_count}'"
1056- # # else
1057- # # rdict["${line_key}"]="${line_value}"
1058- # # _debug_log "$0:${FUNCNAME[0]} updated dictionary with "\
1059- # # "line_key '${line_key}' and line_value '${line_value}'"
1060- # # fi
1061- # # fi
1062- # # fi
1063- # # done <<< "${var2}"
1064- # #
1065- # # if [[ ${found_specd_ver_linux} -eq 1 ]]; then
1066- # # echo "${rdict['version']}:${rdict['name']}:${rdict['SHA512']}"
1067- # # else
1068- # # _error_log "$0:${FUNCNAME[0]} unable to parse version, name and "\
1069- # # "sha512 from repo json file '${file_name}'"
1070- # # # echo ""
1071- # # fi
1072- # # return 0
1073- # # }
1074-
1075894
1076895#
1077896# _fetch_salt_minion
@@ -1153,7 +972,6 @@ _fetch_salt_minion() {
1153972 # local absolute path
1154973 # and allow for Linux handling multiple slashes
1155974
1156- # # DGM TBD need to adjust
1157975 # use defaults
1158976 # directory with onedir files and retrieve files from it
1159977 salt_url=" ${local_base_url} "
@@ -1208,17 +1026,21 @@ _fetch_salt_minion() {
12081026 salt_pkg_shakey=$( echo " ${salt_pkg_sha} " | awk -F ' :' ' {print $1}' | awk -F ' "' ' {print $2}' )
12091027 salt_pkg_sha256=$( echo " ${salt_pkg_sha} " | awk -F ' :' ' {print $2}' | awk -F ' "' ' {print $2}' )
12101028
1211- _debug_log " $0 :${FUNCNAME[0]} found information for file '${salt_pkg_name} ', shakey '${salt_pkg_shakey} ', sha256value '${salt_pkg_sha256} '"
1029+ _debug_log " $0 :${FUNCNAME[0]} found information for file " \
1030+ " '${salt_pkg_name} ', shakey '${salt_pkg_shakey} ', " \
1031+ " sha256value '${salt_pkg_sha256} '"
12121032
12131033 if [[ " ${salt_pkg_shakey} " = " sha256" ]]; then
12141034 # Found sha256
12151035 salt_pkg_sha256_found=1
1216- _debug_log " $0 :${FUNCNAME[0]} successfully found sha256 information on file '${salt_pkg_name} '"
1036+ _debug_log " $0 :${FUNCNAME[0]} successfully found sha256 " \
1037+ " information on file '${salt_pkg_name} '"
12171038 else
12181039 # sanity check for sha256 key not found
12191040 CURRENT_STATUS=${STATUS_CODES_ARY[installing]}
1220- _warning_log " $0 :${FUNCNAME[0]} failed to find sha256 information for " \
1221- " downloaded file '${salt_pkg_name} ', error '${salt_pkg_sha256} '"
1041+ _warning_log " $0 :${FUNCNAME[0]} failed to find sha256 " \
1042+ " information for downloaded file '${salt_pkg_name} ', " \
1043+ " error '${salt_pkg_sha256} '"
12221044 fi
12231045 fi
12241046
@@ -1227,9 +1049,12 @@ _fetch_salt_minion() {
12271049 calc_sha256sum=$( sha256sum " ${salt_pkg_name} " | awk -F ' ' ' {print $1}' )
12281050 if [[ " ${calc_sha256sum} " != " ${salt_pkg_sha256} " ]]; then
12291051 CURRENT_STATUS=${STATUS_CODES_ARY[installFailed]}
1230- _error_log " $0 :${FUNCNAME[0]} generated checksum '${calc_sha256sum} ' for downloaded file '${salt_pkg_name} ' does not match that retrieved from repository '${salt_pkg_sha256} '"
1052+ _error_log " $0 :${FUNCNAME[0]} generated checksum " \
1053+ " '${calc_sha256sum} ' for downloaded file '${salt_pkg_name} ' " \
1054+ " does not match that retrieved from repository '${salt_pkg_sha256} '"
12311055 else
1232- _debug_log " $0 :${FUNCNAME[0]} downloaded file '${salt_pkg_name} ' matched checksum retrieved from repository"
1056+ _debug_log " $0 :${FUNCNAME[0]} downloaded file " \
1057+ " '${salt_pkg_name} ' matched checksum retrieved from repository"
12331058 fi
12341059 fi
12351060 fi
0 commit comments