From 779cfbf55dbf080db3635f9f8f5b0860f19feea5 Mon Sep 17 00:00:00 2001 From: "Gareth J. Greenaway" Date: Thu, 13 Apr 2023 18:58:29 -0700 Subject: [PATCH] first pass at parsing the repo.json for Mac when using onedir and latest. --- bootstrap-salt.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 40bae4b..a429804 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -8453,6 +8453,22 @@ __macosx_get_packagesite() { SALTPKGCONFURL="https://${_REPO_URL}/osx/${PKG}" } +__parse_repo_json_python() { + + # Using latest, grab the right + # version from the repo.json + _ONEDIR_REV=$(python - <<-EOF +import json, urllib.request +url = "https://repo.saltproject.io/salt/py3/macos/repo.json" +response = urllib.request.urlopen(url) +data = json.loads(response.read()) +version = data['latest'][list(data['latest'].keys())[0]]['version'] +print(version) +EOF +) + +} + __macosx_get_packagesite_onedir() { DARWIN_ARCH="x86_64" @@ -8470,6 +8486,9 @@ __macosx_get_packagesite_onedir() { else UNSIGNED="" fi + if [ "$(echo "$_ONEDIR_REV" | grep -E '^(latest)$')" != "" ]; then + __parse_repo_json_python || return 1 + fi PKG="salt-${_ONEDIR_REV}-${__PY_VERSION_REPO}-${DARWIN_ARCH}${UNSIGNED}.pkg" SALTPKGCONFURL="https://${_REPO_URL}/${ONEDIR_REV}/${PKG}" fi