mirror of
https://github.com/saltstack/salt-bootstrap.git
synced 2025-04-16 17:50:22 +00:00
removing unnecessary code
This commit is contained in:
parent
f097386319
commit
408f5beefb
1 changed files with 0 additions and 137 deletions
|
@ -8225,143 +8225,6 @@ install_macosx_restart_daemons() {
|
|||
#
|
||||
#######################################################################################################################
|
||||
|
||||
#######################################################################################################################
|
||||
#
|
||||
# Begin Tiamat Onedir Install Functions
|
||||
#
|
||||
|
||||
_parse_json_specd_ver() {
|
||||
local file_name="$1"
|
||||
local salt_url_version="$2"
|
||||
local file_value=""
|
||||
local blk_count=0
|
||||
local specd_ver_blk_count=0
|
||||
local specd_ver_flag=0
|
||||
local found_specd_ver_linux=0
|
||||
|
||||
local var1=""
|
||||
local var2=""
|
||||
declare -A rdict
|
||||
|
||||
file_value=$(<"${file_name}")
|
||||
|
||||
# limit 80 cols
|
||||
var1=$(echo "${file_value}" | sed 's/,/,\n/g' | sed 's/{/\n{\n/g')
|
||||
var2=$(echo "${var1}" | sed 's/}/\n}\n/g' | sed 's/,//g' | sed 's/"//g')
|
||||
|
||||
while IFS= read -r line
|
||||
do
|
||||
echodebug "$0:${FUNCNAME[0]} parsing line '${line}'"
|
||||
if [[ -z "${line}" ]]; then
|
||||
continue
|
||||
fi
|
||||
if [[ "${line}" = "{" ]]; then
|
||||
(( blk_count++ ))
|
||||
elif [[ "${line}" = "}" ]]; then
|
||||
# examine directory just read in
|
||||
if [[ ${specd_ver_flag} -eq 1 ]]; then
|
||||
if [[ "${rdict['os']}" = "linux" ]]; then
|
||||
# have linux values for specd_ver
|
||||
echodebug "$0:${FUNCNAME[0]} parsed following linux for"\
|
||||
"specified version '${salt_url_version}' from repo json"\
|
||||
"file '${file_name}', os ${rdict['os']}, version"\
|
||||
"${rdict['version']}, name ${rdict['name']}, SHA512"\
|
||||
"${rdict['SHA512']}"
|
||||
found_specd_ver_linux=1
|
||||
break
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ ${blk_count} -eq ${specd_ver_blk_count} ]]; then
|
||||
specd_ver_flag=0
|
||||
break
|
||||
fi
|
||||
(( blk_count-- ))
|
||||
else
|
||||
line_key=$(echo "${line}" | cut -d ':' -f 1 | xargs)
|
||||
line_value=$(echo "${line}" | cut -d ':' -f 2 | xargs)
|
||||
if [[ "${line_key}" = "${salt_url_version}" ]]; then
|
||||
# note blk_count encountered 'specd_ver', closing brace check
|
||||
specd_ver_flag=1
|
||||
specd_ver_blk_count=${blk_count}
|
||||
(( specd_ver_blk_count++ ))
|
||||
else
|
||||
rdict["${line_key}"]="${line_value}"
|
||||
echodebug "$0:${FUNCNAME[0]} updated dictionary with"\
|
||||
"line_key '${line_key}' and line_value '${line_value}'"
|
||||
fi
|
||||
fi
|
||||
done <<< "${var2}"
|
||||
|
||||
if [[ ${found_specd_ver_linux} -eq 1 ]]; then
|
||||
echo "${rdict['version']}:${rdict['name']}:${rdict['SHA512']}"
|
||||
else
|
||||
echoerr "$0:${FUNCNAME[0]} unable to parse version, name and "\
|
||||
"SHA512 from repo json file '${file_name}'"
|
||||
# echo ""
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
install_tiamat() {
|
||||
echoinfo "Fetching repo.json for Tiamat ${_TIAMAT_TYPE}"
|
||||
|
||||
base_url="https://repo.saltproject.io/salt_rc/"
|
||||
tiamat_type_repo_json_url="${base_url}${_TIAMAT_TYPE}/repo.json"
|
||||
repo_json_file="$(mktemp /tmp/base-json-XXXXXXXX 2>/dev/null)"
|
||||
salt_url="https://repo.saltproject.io/salt_rc/${_TIAMAT_TYPE}"
|
||||
|
||||
if [ -z "$repo_json_file" ]; then
|
||||
echoerror "Failed to create temporary file in /tmp"
|
||||
return 1
|
||||
fi
|
||||
|
||||
__fetch_url "$repo_json_file" "$tiamat_type_repo_json_url" || return 1
|
||||
|
||||
json_version_name_sha=$(_parse_json_specd_ver "${repo_json_file}" "${_TIAMAT_VERSION}")
|
||||
|
||||
echoinfo "json_version_name_sha ${json_version_name_sha}"
|
||||
|
||||
echoinfo "Installing Tiamat ${_TIAMAT_TYPE}"
|
||||
|
||||
rm -f "$repo_json_file"
|
||||
|
||||
salt_json_version=$(\
|
||||
echo "${json_version_name_sha}" | awk -F":" '{print $1}')
|
||||
salt_json_name=$(\
|
||||
echo "${json_version_name_sha}" | awk -F":" '{print $2}')
|
||||
salt_json_sha512=$(\
|
||||
echo "${json_version_name_sha}" | awk -F":" '{print $3}')
|
||||
echodebug "$0:${FUNCNAME[0]} using repo.json values version"\
|
||||
"'${salt_json_version}', name '${salt_json_name}, sha512"\
|
||||
"'${salt_json_sha512}'"
|
||||
|
||||
echoinfo "salt_json_name - ${salt_json_name}"
|
||||
salt_pkg_name="${salt_json_name}"
|
||||
salt_pkg_url="${salt_url}/${salt_json_version}/${salt_pkg_name}"
|
||||
|
||||
echoinfo "salt_pkg_name - ${salt_pkg_name}"
|
||||
tempfile="$(mktemp /tmp/${salt_pkg_name}-XXXXXXXX.tar.gz 2>/dev/null)"
|
||||
|
||||
if [ -z "$tempfile" ]; then
|
||||
echoerror "Failed to create temporary file in /tmp"
|
||||
return 1
|
||||
fi
|
||||
|
||||
__fetch_url "$tempfile" "$salt_pkg_url" || return 1
|
||||
|
||||
#rm -f "$tempfile"
|
||||
|
||||
return 0
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
# Ended Tiamt Onedir Install Functions
|
||||
#
|
||||
#######################################################################################################################
|
||||
|
||||
#######################################################################################################################
|
||||
#
|
||||
# Default minion configuration function. Matches ANY distribution as long as
|
||||
|
|
Loading…
Add table
Reference in a new issue