diff --git a/README.md b/README.md index b82dbc5..be82ef0 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,14 @@ # salt-vm-tools -The VMTools salt integration script installs, removes, or checks the status of a Salt minion -(`salt-minion`) in a VMware controlled Virtual Machine environment. +The VMTools salt integration script installs, removes, or checks the status of +a Salt minion (`salt-minion`) in a VMware controlled Virtual Machine environment. This script operates as a BASH script in Linux environments and a PowerShell script in Windows environments. -The Salt minion is a [Tiamat](https://gitlab.com/saltstack/pop/tiamat) based -Python 3 Salt minion leveraging [PyInstaller's](https://www.pyinstaller.org/) -onedir option internally. The Salt minion is fully self-contained and requires -no additional dependencies. +The Salt minion is a Onedir architecture based Python 3 Salt minion leveraging +relenv (https://github.com/saltstack/relenv) onedir option internally. +The Salt minion is fully self-contained and requires no additional dependencies. The script can install, remove, and check the status of an installed Salt minion either using a direct command line option or via VMware's use of Guest Variables, diff --git a/linux/svtminion.sh b/linux/svtminion.sh index da5687a..37d5ac8 100755 --- a/linux/svtminion.sh +++ b/linux/svtminion.sh @@ -31,11 +31,6 @@ salt_url_version="${default_salt_url_version}" salt_specific_version="" readonly salt_name="salt" -# DGM TBD to be replaced -## DGM readonly repo_json_file="repo.json" -## DGM pre_3006_base_url="https://repo.saltproject.io/salt/vmware-tools-onedir" -## DGM # Release -## DGM post_3005_base_url="https://repo.saltproject.io/salt/py3/onedir" base_url="" # Broadcom infrastructure @@ -212,10 +207,6 @@ LOG_LEVEL=${LOG_LEVELS_ARY[warning]} SOURCE_FLAG=0 SOURCE_PARAMS="" -# Flag for pre_3006 and post_3005, 0 => pre_3006, 1 => post_3005 -## DGM TBD POST_3005_FLAG=0 -## DGM TBD POST_3005_MAJOR_VER_FLAG=0 - # helper functions @@ -425,10 +416,12 @@ _set_log_level() { # for example: currently major version 3006 implies 3006.9 # the latest version of Salt 3006.x # -# if an unsupported version is input, for example: 3004.2, it will default to installing the latest version +# if an unsupported version is input, for example: 3004.2 +# it will default to installing the latest version # # Input: -# directory contains directory list of current available Salt versions, 3006.x - 3007.1 +# directory contains directory list of current available +# Salt versions, 3006.x - 3007.1 # # Results: # Returns with exit code @@ -443,17 +436,18 @@ _get_desired_salt_version_fn() { "specifying the location for directories containing versions Salt" fi - _info_log "$0:${FUNCNAME[0]} processing getting desired Salt version '$salt_url_version' for "\ - "salt-minion to install, input directory $1" + _info_log "$0:${FUNCNAME[0]} processing getting desired Salt version "\ + "'$salt_url_version' for salt-minion to install, input directory $1" generic_versions_tmpdir="$1" curr_pwd=$(pwd) cd ${generic_versions_tmpdir} || return 1 - # something werid is happening with tail, that does not fail in test programs getting failures inside tail hence use bash loop + # something werid is happening with tail, that does not fail in test + # programs getting failures inside tail hence use bash loop if [ "$salt_url_version" = "latest" ]; then # shellcheck disable=SC2010,SC2012 - ## ## _GENERIC_PKG_VERSION=$(ls ./. | grep -v 'index.html' | sort -V -u | tail -n 1) + ## _GENERIC_PKG_VERSION=$(ls ./. | grep -v 'index.html' | sort -V -u | tail -n 1) test_dir=$(ls ./. | grep -v 'index.html' | sort -V -u) for idx in $test_dir do @@ -470,11 +464,13 @@ _get_desired_salt_version_fn() { do _GENERIC_PKG_VERSION="$idx" done - _debug_log "$0:${FUNCNAME[0]} input $salt_url_version found version '${_GENERIC_PKG_VERSION}'" + _debug_log "$0:${FUNCNAME[0]} input $salt_url_version found "\ + "version '${_GENERIC_PKG_VERSION}'" elif [ "$(echo "$salt_url_version" | grep -E '^([3-9][0-5]{2}[6-9](\.[0-9]*)?)')" != "" ]; then # Minor version Salt, want specific minor version - # if old style VMTools version 3004.2-1 is used, defaults to else and install latest + # if old style VMTools version 3004.2-1 is used + # defaults to else and install latest _GENERIC_PKG_VERSION="$salt_url_version" else # default to latest version Salt @@ -509,7 +505,8 @@ _get_desired_salt_version_fn() { # for example: 3006.8 # # Results: -# Sets salt_url_version to latest or specified input Salt version, 3007, 3006, 3006.x +# Sets salt_url_version to latest or specified input +# Salt version, 3007, 3006, 3006.x # Returns with exit code # @@ -543,55 +540,6 @@ _set_install_minion_version_fn() { return 0 } -## DGM TBD this to be removed -# -# _set_post_3005_flags_from_version -# -# Sets the POST_3005_FLAG and POST_3005_MAJOR_VER_FLAG -# from the version currently present in salt_url_version -# -# Will also set base_url if not already defined by --source option -# -# Results: -# Returns with exit code -# -## DGM _set_post_3005_flags_from_version() { -## DGM _info_log "$0:${FUNCNAME[0]} setting POST_3005_FLAG and "\ -## DGM "POST_3005_MAJOR_VER_FLAG from Salt version '${salt_url_version}'" -## DGM -## DGM if [[ "latest" = "${salt_url_version}" ]]; then -## DGM POST_3005_FLAG=1 -## DGM POST_3005_MAJOR_VER_FLAG=1 -## DGM base_url="${post_3005_base_url}" -## DGM # done, already have url for latest & major versions -## DGM _debug_log "$0:${FUNCNAME[0]} post-3005 install, using latest "\ -## DGM "base_url '${base_url}'" -## DGM else -## DGM ver_chk=$(echo "${salt_url_version}" | cut -d '.' -f 1) -## DGM if [[ ${ver_chk} -ge 3006 ]]; then -## DGM POST_3005_FLAG=1 -## DGM ver_chk_major=$(echo "${salt_url_version}" | cut -d '.' -f 1) -## DGM ver_chk_minor=$(echo "${salt_url_version}" | cut -d '.' -f 2) -## DGM _debug_log "$0:${FUNCNAME[0]} post-3005 install, checking "\ -## DGM "for major version only '${ver_chk_major}', minor "\ -## DGM "'${ver_chk_minor}'" -## DGM if [[ "${ver_chk_major}" = "${ver_chk_minor}" ]]; then -## DGM POST_3005_MAJOR_VER_FLAG=1 -## DGM base_url="${post_3005_base_url}" -## DGM else -## DGM base_url="${post_3005_base_url}/minor" -## DGM fi -## DGM _debug_log "$0:${FUNCNAME[0]} post-3005 install, for "\ -## DGM "'${salt_url_version}' using base_url '${base_url}'" -## DGM else -## DGM # install pre-3006, use older url -## DGM base_url="${pre_3006_base_url}" -## DGM _debug_log "$0:${FUNCNAME[0]} pre-3006 install, for "\ -## DGM "'${salt_url_version}' using base_url '${base_url}'" -## DGM fi -## DGM fi -## DGM } - # # _update_minion_conf_ary @@ -943,135 +891,6 @@ _fetch_vmtools_salt_minion_conf() { ## DGM return 0 ## DGM } -## DGM TBD to be removed -## # -## # _parse_json_specd_ver -## # -## # Retrieve the salt-minion from Salt repository -## # -## # Results: -## # Echos string containing colon separated version, name and sha512 -## # from parsed input repo json file -## # Echos empty '' if 'salt_url_version' is not found in repo json file -## # -## # Note: salt_url_version defaults to 'latest' unless set to a specific -## # Salt minion version, for example: 3004.1-1 -## # -## -## _parse_json_specd_ver() { -## local file_name="$1" -## 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="" -## local machine_arch_chk="${MACHINE_ARCH}" -## declare -A rdict -## -## _info_log "$0:${FUNCNAME[0]} parsing of repo json file '${file_name}'" -## -## if [[ ${POST_3005_FLAG} -eq 0 ]]; then -## machine_arch_chk="amd64" # pre_3006 used amd64 -## fi -## -## 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 -## _debug_log "$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" \ -## && "${rdict['arch']}" = "${machine_arch_chk}" ]]; then -## # have linux values for specd_ver -## _debug_log "$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 -## if [[ ${POST_3005_FLAG} -eq 1 \ -## && ${POST_3005_MAJOR_VER_FLAG} -eq 1 ]]; then -## # doing major version check -## line_major_key=$(echo "${line}" | cut -d ':' -f 1 | cut -d '-' -f 2 | cut -d '.' -f 1 |xargs) -## line_key=$(echo "${line}" | cut -d ':' -f 1 | xargs) -## line_value=$(echo "${line}" | cut -d ':' -f 2 | xargs) -## _debug_log "$0:${FUNCNAME[0]} check line_major_key "\ -## "'${line_major_key}' again salt_url_version "\ -## "'${salt_url_version}', line_key '${line_key}', "\ -## "line_value '${line_value}'" -## if [[ "${line_major_key}" = "${salt_url_version}" ]]; then -## # blk_count encountered 'specd_ver', closing brace check -## specd_ver_flag=1 -## specd_ver_blk_count=${blk_count} -## (( specd_ver_blk_count++ )) -## _debug_log "$0:${FUNCNAME[0]} found specd version, "\ -## "version '${salt_url_version}' and line_major_key "\ -## "'${line_major_key}', line_key '${line_key}' "\ -## "specd_ver_blk_count '${specd_ver_blk_count}'" -## else -## rdict["${line_key}"]="${line_value}" -## _debug_log "$0:${FUNCNAME[0]} updated dictionary for "\ -## "major version with line_key '${line_key}' and "\ -## "line_value '${line_value}'" -## fi -## else -## line_key=$(echo "${line}" | cut -d ':' -f 1 | xargs) -## line_value=$(echo "${line}" | cut -d ':' -f 2 | xargs) -## _debug_log "$0:${FUNCNAME[0]} check line_key '${line_key}' "\ -## "again salt_url_version '${salt_url_version}', "\ -## "line_value '${line_value}'" -## if [[ "${line_key}" = "${salt_url_version}" ]]; then -## # blk_count encountered 'specd_ver', closing brace check -## specd_ver_flag=1 -## specd_ver_blk_count=${blk_count} -## (( specd_ver_blk_count++ )) -## _debug_log "$0:${FUNCNAME[0]} found specd version, "\ -## "version '${salt_url_version}' and line_key "\ -## "'${line_key}' and specd_ver_blk_count "\ -## "'${specd_ver_blk_count}'" -## else -## rdict["${line_key}"]="${line_value}" -## _debug_log "$0:${FUNCNAME[0]} updated dictionary with "\ -## "line_key '${line_key}' and line_value '${line_value}'" -## fi -## fi -## fi -## done <<< "${var2}" -## -## if [[ ${found_specd_ver_linux} -eq 1 ]]; then -## echo "${rdict['version']}:${rdict['name']}:${rdict['SHA512']}" -## else -## _error_log "$0:${FUNCNAME[0]} unable to parse version, name and "\ -## "sha512 from repo json file '${file_name}'" -## # echo "" -## fi -## return 0 -## } - # # _fetch_salt_minion @@ -1153,7 +972,6 @@ _fetch_salt_minion() { # local absolute path # and allow for Linux handling multiple slashes - ## DGM TBD need to adjust # use defaults # directory with onedir files and retrieve files from it salt_url="${local_base_url}" @@ -1163,11 +981,12 @@ _fetch_salt_minion() { # get desired specific version of Salt _get_desired_salt_version_fn "${salt_url}" cd "${salt_url}" || return 1 - salt_pkg_name=$(ls "${salt_specific_version}/${salt_name}-${salt_specific_version}-onedir-linux-${sys_arch}.tar.xz") + cd "${salt_specific_version}" || return 1 + salt_pkg_name=$(ls "${salt_name}-${salt_specific_version}-onedir-linux-${sys_arch}.tar.xz") cd "${curr_dir}" || return 1 - + cp -a "${salt_url}/${salt_specific_version}/${salt_pkg_name}" ${salt_pkg_name} _debug_log "$0:${FUNCNAME[0]} successfully copied tarball from "\ - "'${salt_url}' file '${salt_pkg_name}'" + "'${salt_url}/${salt_specific_version}' to file '${salt_pkg_name}'" else # assume use curl for local or remote URI # directory with onedir files and retrieve files from it @@ -1204,32 +1023,38 @@ _fetch_salt_minion() { salt_pkg_sha=$(echo "${salt_pkg_metadata}" | grep -w "sha256" | sort | uniq) if [[ -n "${salt_pkg_sha}" ]]; then # have package metadata to process - salt_pkg_shakey=$(echo "${salt_pkg_sha}" | awk -F ':' '{print $1}') - salt_pkg_sha256=$(echo "${salt_pkg_sha}" | awk -F ':' '{print $2}') + salt_pkg_shakey=$(echo "${salt_pkg_sha}" | awk -F ':' '{print $1}' | awk -F '"' '{print $2}') + salt_pkg_sha256=$(echo "${salt_pkg_sha}" | awk -F ':' '{print $2}' | awk -F '"' '{print $2}') + + _debug_log "$0:${FUNCNAME[0]} found information for file "\ + "'${salt_pkg_name}', shakey '${salt_pkg_shakey}', "\ + "sha256value '${salt_pkg_sha256}'" if [[ "${salt_pkg_shakey}" = "sha256" ]]; then # Found sha256 salt_pkg_sha256_found=1 - _debug_log "$0:${FUNCNAME[0]} successfully found sha256 information on file '${salt_pkg_name}'" + _debug_log "$0:${FUNCNAME[0]} successfully found sha256 "\ + "information on file '${salt_pkg_name}'" else # sanity check for sha256 key not found CURRENT_STATUS=${STATUS_CODES_ARY[installing]} - _warning_log "$0:${FUNCNAME[0]} failed to find sha256 information for "\ - "downloaded file '${salt_pkg_name}', error '${salt_pkg_sha256}'" + _warning_log "$0:${FUNCNAME[0]} failed to find sha256 "\ + "information for downloaded file '${salt_pkg_name}', "\ + "error '${salt_pkg_sha256}'" fi fi if [[ ${salt_pkg_sha256_found} -eq 1 ]]; then # Have sha256 information to check against - calc_sha256sum=$(sha256sum "${salt_pkg_name}" --quiet) - if [[ ${calc_sha256sum} -eq 0 ]]; then - CURRENT_STATUS=${STATUS_CODES_ARY[installing]} - _warning_log "$0:${FUNCNAME[0]} failed to generate checksum for downloaded file '${salt_pkg_name}'" - elif [[ "${calc_sha256sum}" != "${salt_pkg_sha256}" ]]; then + calc_sha256sum=$(sha256sum "${salt_pkg_name}" | awk -F ' ' '{print $1}') + if [[ "${calc_sha256sum}" != "${salt_pkg_sha256}" ]]; then CURRENT_STATUS=${STATUS_CODES_ARY[installFailed]} - _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}'" + _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}'" else - _debug_log "$0:${FUNCNAME[0]} downloaded file '${salt_pkg_name}' matched checksum retrieved from repository" + _debug_log "$0:${FUNCNAME[0]} downloaded file "\ + "'${salt_pkg_name}' matched checksum retrieved from repository" fi fi fi diff --git a/tests/classic/3005.repo b/tests/classic/3005.repo new file mode 100644 index 0000000..2199138 --- /dev/null +++ b/tests/classic/3005.repo @@ -0,0 +1,11 @@ +[salt-repo] +name=Salt repo for RHEL/CentOS 9 PY3 +## baseurl=https://repo.saltproject.io/salt/py3/redhat/9/x86_64/3005 +## baseurl=file:///testarea/classic +skip_if_unavailable=True +priority=10 +enabled=1 +enabled_metadata=1 +gpgcheck=1 +## gpgkey=https://repo.saltproject.io/salt/py3/redhat/9/x86_64/3005/SALTSTACK-GPG-KEY2.pub +## gpgkey=file:///testarea/classic/SALTSTACK-GPG-KEY2.pub diff --git a/tests/classic/repodata/357f3ecd84cb206c4dcda6cf750c84b503097cb065a8996f6d7094821e1c42e4-primary.sqlite.bz2 b/tests/classic/repodata/357f3ecd84cb206c4dcda6cf750c84b503097cb065a8996f6d7094821e1c42e4-primary.sqlite.bz2 new file mode 100644 index 0000000..c6f2f42 Binary files /dev/null and b/tests/classic/repodata/357f3ecd84cb206c4dcda6cf750c84b503097cb065a8996f6d7094821e1c42e4-primary.sqlite.bz2 differ diff --git a/tests/classic/repodata/732c3667da5d18b4d7a60c65d7a1ac3e21de6416d54fcc42a1fd137ff6baad37-filelists.sqlite.bz2 b/tests/classic/repodata/732c3667da5d18b4d7a60c65d7a1ac3e21de6416d54fcc42a1fd137ff6baad37-filelists.sqlite.bz2 new file mode 100644 index 0000000..0c6f528 Binary files /dev/null and b/tests/classic/repodata/732c3667da5d18b4d7a60c65d7a1ac3e21de6416d54fcc42a1fd137ff6baad37-filelists.sqlite.bz2 differ diff --git a/tests/classic/repodata/7e627ecb05c689fa71a37710be55c5517549d1c113f567b1db12cdf359a758c6-other.sqlite.bz2 b/tests/classic/repodata/7e627ecb05c689fa71a37710be55c5517549d1c113f567b1db12cdf359a758c6-other.sqlite.bz2 new file mode 100644 index 0000000..bc23da7 Binary files /dev/null and b/tests/classic/repodata/7e627ecb05c689fa71a37710be55c5517549d1c113f567b1db12cdf359a758c6-other.sqlite.bz2 differ diff --git a/tests/classic/repodata/8683c1116fb5581b1243a6b03e9fddc2946c777d4c609ff202de0e5b43c4b283-other.xml.gz b/tests/classic/repodata/8683c1116fb5581b1243a6b03e9fddc2946c777d4c609ff202de0e5b43c4b283-other.xml.gz new file mode 100644 index 0000000..42085bc Binary files /dev/null and b/tests/classic/repodata/8683c1116fb5581b1243a6b03e9fddc2946c777d4c609ff202de0e5b43c4b283-other.xml.gz differ diff --git a/tests/classic/repodata/d3a079a4c70a032e11f10888785f20c3bd8f45ecd01729e6310ca8782e9df025-primary.xml.gz b/tests/classic/repodata/d3a079a4c70a032e11f10888785f20c3bd8f45ecd01729e6310ca8782e9df025-primary.xml.gz new file mode 100644 index 0000000..ac709f0 Binary files /dev/null and b/tests/classic/repodata/d3a079a4c70a032e11f10888785f20c3bd8f45ecd01729e6310ca8782e9df025-primary.xml.gz differ diff --git a/tests/classic/repodata/f1dea79a80a01020329ae48e70174a3739b5d83e83412350761dd975582aa8e7-filelists.xml.gz b/tests/classic/repodata/f1dea79a80a01020329ae48e70174a3739b5d83e83412350761dd975582aa8e7-filelists.xml.gz new file mode 100644 index 0000000..45a364a Binary files /dev/null and b/tests/classic/repodata/f1dea79a80a01020329ae48e70174a3739b5d83e83412350761dd975582aa8e7-filelists.xml.gz differ diff --git a/tests/classic/repodata/repomd.xml b/tests/classic/repodata/repomd.xml new file mode 100644 index 0000000..de1403d --- /dev/null +++ b/tests/classic/repodata/repomd.xml @@ -0,0 +1,55 @@ + + + 1706636449 + + d3a079a4c70a032e11f10888785f20c3bd8f45ecd01729e6310ca8782e9df025 + 71230d9804cc906d363a02d811d8f3a1dba0defdacbcb4a9cc3aaadafd0c646d + + 1706636448 + 2550 + 15539 + + + f1dea79a80a01020329ae48e70174a3739b5d83e83412350761dd975582aa8e7 + 7bb95e492d87215848b8c36192dfb8c78824cf0b37d456fc635f4a8a4965fc0e + + 1706636448 + 42252 + 498371 + + + 8683c1116fb5581b1243a6b03e9fddc2946c777d4c609ff202de0e5b43c4b283 + b329b95b139221d76c50e7fa6cbd40f1475ddbe8887302fc92b8f163117441c8 + + 1706636448 + 772 + 4649 + + + 357f3ecd84cb206c4dcda6cf750c84b503097cb065a8996f6d7094821e1c42e4 + 9fe73b8a2f3b8bc685073acc4749544aabb18380af8d5eab90b942db3e93e13b + + 1706636448 + 6019 + 114688 + 10 + + + 732c3667da5d18b4d7a60c65d7a1ac3e21de6416d54fcc42a1fd137ff6baad37 + a33dfdfa2cfd6de5f316efda87a46055fa65d4ca4a077f9dbe2f7d01edded9e5 + + 1706636449 + 40445 + 204800 + 10 + + + 7e627ecb05c689fa71a37710be55c5517549d1c113f567b1db12cdf359a758c6 + 3b3096b8d3218e13f0eff1d01b62893bf389adb1590f67142099d0d9a3159a3c + + 1706636448 + 1661 + 24576 + 10 + + diff --git a/tests/classic/salt-3005.5-2.el9.x86_64.rpm b/tests/classic/salt-3005.5-2.el9.x86_64.rpm new file mode 100644 index 0000000..264bd9f Binary files /dev/null and b/tests/classic/salt-3005.5-2.el9.x86_64.rpm differ diff --git a/tests/classic/salt-minion-3005.5-2.el9.x86_64.rpm b/tests/classic/salt-minion-3005.5-2.el9.x86_64.rpm new file mode 100644 index 0000000..136b26c Binary files /dev/null and b/tests/classic/salt-minion-3005.5-2.el9.x86_64.rpm differ diff --git a/tests/linux/test-linux.sh b/tests/linux/test-linux.sh index 802549a..5ef2a1c 100755 --- a/tests/linux/test-linux.sh +++ b/tests/linux/test-linux.sh @@ -97,8 +97,6 @@ ls -l /var/log/vmware-svtminion.sh-status-* ls -l /var/log/vmware-svtminion.sh-status-* | wc -l if [[ 5 -eq $(ls -l /var/log/vmware-svtminion.sh-status-* | wc -l) ]]; then echo "test correct"; else "test failed, should be only 5 status log files"; exit 1; fi ./svtminion.sh --remove || { _retn=$?; echo "test failed, did not uninstall the salt-minion, returned '${_retn}'"; } - -# DGM TBD no more rpeo.json - test source installs with repo.json ./svtminion.sh --source ${oldpwd}/tests/testarea --install master=192.168.0.5 --loglevel debug cat /etc/salt/minion cat /etc/salt/minion | grep 'master:\ 192.168.0.5' 1>/dev/null @@ -117,13 +115,7 @@ sleep 1 cat /etc/salt/minion cat /etc/salt/minion | grep 'master:\ 192.168.0.5' 1>/dev/null ./svtminion.sh --remove || { _retn=$?; echo "test failed, did not uninstall the salt-minion, returned '${_retn}'"; } -./svtminion.sh --install master=192.168.0.5 --loglevel debug --source file:/${oldpwd}/tests/testarea -m "3003.3-1" # DGM FIX -./svtminion.sh --status --loglevel debug || { _retn=$?; if [[ ${_retn} -eq 100 ]]; then echo "test correct"; else echo "test failed, salt-minion should be installed, returned '${_retn}'"; exit 1; fi; } -sleep 1 -cat /etc/salt/minion -cat /etc/salt/minion | grep 'master:\ 192.168.0.5' 1>/dev/null -./svtminion.sh --remove || { _retn=$?; echo "test failed, did not uninstall the salt-minion, returned '${_retn}'"; } -./svtminion.sh --install master=192.168.0.5 --loglevel debug --source https://repo.saltproject.io/salt/vmware-tools-onedir # DGM FIX +./svtminion.sh --install master=192.168.0.5 --loglevel debug --source file:/${oldpwd}/tests/testarea -m "3003.3-1" ./svtminion.sh --status --loglevel debug || { _retn=$?; if [[ ${_retn} -eq 100 ]]; then echo "test correct"; else echo "test failed, salt-minion should be installed, returned '${_retn}'"; exit 1; fi; } sleep 1 cat /etc/salt/minion @@ -137,31 +129,31 @@ cat /etc/salt/minion | grep 'master:\ 192.168.0.5' 1>/dev/null ./svtminion.sh --remove || { _retn=$?; echo "test failed, did not uninstall the salt-minion, returned '${_retn}'"; } ./svtminion.sh --status --loglevel debug || { _retn=$?; if [[ ${_retn} -eq 102 ]]; then echo "test correct"; else echo "test failed, salt-minion should be installed, returned '${_retn}'"; exit 1; fi; } sleep 1 -./svtminion.sh --source ${oldpwd}/tests/testarea --install master=192.168.0.5 --loglevel debug --minionversion 3006 # DGM FIX +./svtminion.sh --source ${oldpwd}/tests/testarea --install master=192.168.0.5 --loglevel debug --minionversion 3006 cat /etc/salt/minion cat /etc/salt/minion | grep 'master:\ 192.168.0.5' 1>/dev/null ./svtminion.sh --remove || { _retn=$?; echo "test failed, did not uninstall the salt-minion, returned '${_retn}'"; } -./svtminion.sh --source ${oldpwd}/tests/testarea --install master=192.168.0.5 --loglevel debug --minionversion 3006.9 # DGM FIX +./svtminion.sh --source ${oldpwd}/tests/testarea --install master=192.168.0.5 --loglevel debug --minionversion 3006.9 ./svtminion.sh --status --loglevel debug || { _retn=$?; if [[ ${_retn} -eq 100 ]]; then echo "test correct"; else echo "test failed, salt-minion should be installed, returned '${_retn}'"; exit 1; fi; } sleep 1 cat /etc/salt/minion cat /etc/salt/minion | grep 'master:\ 192.168.0.5' 1>/dev/null ./svtminion.sh --remove || { _retn=$?; echo "test failed, did not uninstall the salt-minion, returned '${_retn}'"; } -./svtminion.sh --source ${oldpwd}/tests/testarea --install master=192.168.0.5 --loglevel debug --minionversion 3007 # DGM FIX +./svtminion.sh --source ${oldpwd}/tests/testarea --install master=192.168.0.5 --loglevel debug --minionversion 3007 ./svtminion.sh --status --loglevel debug || { _retn=$?; if [[ ${_retn} -eq 100 ]]; then echo "test correct"; else echo "test failed, salt-minion should be installed, returned '${_retn}'"; exit 1; fi; } sleep 1 cat /etc/salt/minion cat /etc/salt/minion | grep 'master:\ 192.168.0.5' 1>/dev/null ## wait for RC with 3008 ## ./svtminion.sh --remove || { _retn=$?; echo "test failed, did not uninstall the salt-minion, returned '${_retn}'"; } -## ./svtminion.sh --install master=192.168.0.5 --loglevel debug --source https://packages.broadcom.com/saltproject-generic/onedir +## ./svtminion.sh --install master=192.168.0.5 --loglevel debug --source https://packages.broadcom.com/artifactory/saltproject-generic/onedir ## ./svtminion.sh --status --loglevel debug || { _retn=$?; if [[ ${_retn} -eq 100 ]]; then echo "test correct"; else echo "test failed, salt-minion should be installed, returned '${_retn}'"; exit 1; fi; } ## sleep 1 cat /etc/salt/minion cat /etc/salt/minion | grep 'master:\ 192.168.0.5' 1>/dev/null ./svtminion.sh --remove || { _retn=$?; echo "test failed, did not uninstall the salt-minion, returned '${_retn}'"; } # test stop and start -./svtminion.sh --install master=192.168.0.5 --loglevel debug --source https://packages.broadcom.com/saltproject-generic/onedir +./svtminion.sh --install master=192.168.0.5 --loglevel debug --source https://packages.broadcom.com/artifactory/saltproject-generic/onedir ./svtminion.sh --status --loglevel debug || { _retn=$?; if [[ ${_retn} -eq 100 ]]; then echo "test correct"; else echo "test failed, salt-minion should be installed, returned '${_retn}'"; exit 1; fi; } sleep 1 cat /etc/salt/minion @@ -187,21 +179,21 @@ systemctl is-active salt-minion # test 3006-3007 and upgrade ./svtminion.sh --remove || { _retn=$?; echo "test failed, did not uninstall the salt-minion, returned '${_retn}'"; } sleep 1 -./svtminion.sh --source ${oldpwd}/tests/testarea --install master=192.168.0.5 id="tup" --loglevel debug --minionversion 3006 # DGM FIX +./svtminion.sh --source ${oldpwd}/tests/testarea --install master=192.168.0.5 id="tup" --loglevel debug --minionversion 3006 cat /etc/salt/minion cat /etc/salt/minion | grep 'master:\ 192.168.0.5' 1>/dev/null cat /etc/salt/minion | grep 'id:\ tup' 1>/dev/null ps -ef | grep salt systemctl is-active salt-minion if [[ $(/usr/bin/salt-call --local test.version --out=pprint | awk '{print $2}' | cut -d "'" -f 2 | awk -F "." '{print $1}') -eq 3006 ]]; then echo "test correct"; else echo "test failed, wrong major version for salt-minion"; exit 1; fi -./svtminion.sh --source ${oldpwd}/tests/testarea --upgrade --install --loglevel debug --minionversion 3007 # DGM FIX +./svtminion.sh --source ${oldpwd}/tests/testarea --upgrade --install --loglevel debug --minionversion 3007 cat /etc/salt/minion cat /etc/salt/minion | grep 'master:\ 192.168.0.5' 1>/dev/null cat /etc/salt/minion | grep 'id:\ tup' 1>/dev/null ps -ef | grep salt systemctl is-active salt-minion if [[ $(/usr/bin/salt-call --local test.version --out=pprint | awk '{print $2}' | cut -d "'" -f 2 | awk -F "." '{print $1}') -eq 3007 ]]; then echo "test correct"; else echo "test failed, wrong major version for salt-minion"; exit 1; fi -./svtminion.sh --source ${oldpwd}/tests/testarea --install master=192.168.0.5 --loglevel debug # DGM FIX +./svtminion.sh --source ${oldpwd}/tests/testarea --install master=192.168.0.5 --loglevel debug cat /etc/salt/minion cat /etc/salt/minion | grep 'master:\ 192.168.0.5' 1>/dev/null ./svtminion.sh --remove || { _retn=$?; echo "test failed, did not uninstall the salt-minion, returned '${_retn}'"; } @@ -210,7 +202,7 @@ cat /etc/salt/minion | grep 'master:\ 192.168.0.5' 1>/dev/null cat /etc/salt/minion cat /etc/salt/minion | grep 'master:\ 192.168.0.5' 1>/dev/null ./svtminion.sh --remove || { _retn=$?; echo "test failed, did not uninstall the salt-minion, returned '${_retn}'"; } -./svtminion.sh --install master=192.168.0.5 --loglevel debug --source https://packages.broadcom.com/saltproject-generic/onedir +./svtminion.sh --install master=192.168.0.5 --loglevel debug --source https://packages.broadcom.com/artifactory/saltproject-generic/onedir ./svtminion.sh --status --loglevel debug || { _retn=$?; if [[ ${_retn} -eq 100 ]]; then echo "test correct"; else echo "test failed, salt-minion should be installed, returned '${_retn}'"; exit 1; fi; } cat /etc/salt/minion cat /etc/salt/minion | grep 'master:\ 192.168.0.5' 1>/dev/null @@ -220,16 +212,23 @@ cat /etc/salt/minion cat /etc/salt/minion | grep 'master:\ 192.168.0.5' 1>/dev/null ./svtminion.sh --status --loglevel debug || { _retn=$?; if [[ ${_retn} -eq 100 ]]; then echo "test correct"; else echo "test failed, salt-minion should be installed, returned '${_retn}'"; exit 1; fi; } ./svtminion.sh --remove || { _retn=$?; echo "test failed, did not uninstall the salt-minion, returned '${_retn}'"; } -bash -x ./svtminion.sh --install master=192.168.0.5 --loglevel debug --source file:/${oldpwd}/tests/testarea -m 3007.1 # DGM FIX +bash -x ./svtminion.sh --install master=192.168.0.5 --loglevel debug --source file:/${oldpwd}/tests/testarea -m 3007.1 cat /etc/salt/minion cat /etc/salt/minion | grep 'master:\ 192.168.0.5' 1>/dev/null ./svtminion.sh --status --loglevel debug || { _retn=$?; if [[ ${_retn} -eq 100 ]]; then echo "test correct"; else echo "test failed, salt-minion should be installed, returned '${_retn}'"; exit 1; fi; } ./svtminion.sh --remove || { _retn=$?; echo "test failed, did not uninstall the salt-minion, returned '${_retn}'"; } + # test with classic package installed -rpm --import https://repo.saltproject.io/py3/redhat/8/x86_64/3005/SALTSTACK-GPG-KEY.pub # DGM FIX -curl -fsSL https://repo.saltproject.io/py3/redhat/8/x86_64/3005.repo | tee /etc/yum.repos.d/salt.repo # DGM FIX +## rpm --import https://repo.saltproject.io/py3/redhat/8/x86_64/3005/SALTSTACK-GPG-KEY.pub # DGM FIX +## curl -fsSL https://repo.saltproject.io/py3/redhat/8/x86_64/3005.repo | tee /etc/yum.repos.d/salt.repo # DGM FIX +# Use 3005 Redhat 9 for Rocky 9 container +rpm --import ${oldpwd}/tests/classic/SALTSTACK-GPG-KEY2.pub +cp -a ${oldpwd}/tests/classic/3005.repo /etc/yum.repos.d/salt.repo +echo "baseurl=file:///${oldpwd}/testarea/classic" >> /etc/yum.repos.d/salt.repo +echo "gpgkey=file:///${oldpwd}/testarea/classic/SALTSTACK-GPG-KEY2.pub" >> /etc/yum.repos.d/salt.repo yum makecache yum -y install salt-minion + ./svtminion.sh --install master=192.168.0.5 --loglevel debug || { _retn=$?; if [[ ${_retn} -eq 106 ]]; then echo "test correct"; else echo "test failed, should fail since be standard salt-minion installed, returned '${_retn}'"; exit 1; fi; } ./svtminion.sh --status --loglevel info || { _retn=$?; if [[ ${_retn} -eq 106 ]]; then echo "test correct"; else echo "test failed, classic salt-minion should be installed and external install detected, returned '${_retn}'"; exit 1; fi; } ./svtminion.sh --remove || { _retn=$?; if [[ ${_retn} -eq 106 ]]; then echo "test correct"; else echo "test failed, should fail since be standard salt-minion installed and script remove not valid, returned '${_retn}'"; exit 1; fi; } diff --git a/tests/testarea/3006.8/salt-3006.8-onedir-linux-x86_64.tar.xz b/tests/testarea/3006.8/salt-3006.8-onedir-linux-x86_64.tar.xz new file mode 100644 index 0000000..668599d Binary files /dev/null and b/tests/testarea/3006.8/salt-3006.8-onedir-linux-x86_64.tar.xz differ diff --git a/tests/testarea/3006.9/salt-3006.9-onedir-linux-x86_64.tar.xz b/tests/testarea/3006.9/salt-3006.9-onedir-linux-x86_64.tar.xz new file mode 100644 index 0000000..4737060 Binary files /dev/null and b/tests/testarea/3006.9/salt-3006.9-onedir-linux-x86_64.tar.xz differ diff --git a/tests/testarea/3007.1/salt-3007.1-onedir-linux-x86_64.tar.xz b/tests/testarea/3007.1/salt-3007.1-onedir-linux-x86_64.tar.xz new file mode 100644 index 0000000..9b2bd5a Binary files /dev/null and b/tests/testarea/3007.1/salt-3007.1-onedir-linux-x86_64.tar.xz differ