Skip to content

Commit 2ac15ec

Browse files
committed
ff
1 parent 94299c6 commit 2ac15ec

File tree

1 file changed

+35
-33
lines changed

1 file changed

+35
-33
lines changed

parts/linux/cloud-init/artifacts/cse_install.sh

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -149,44 +149,46 @@ installFixedCNI() {
149149
return
150150
fi
151151
#always just use what is listed in components.json so we don't have to sync.
152-
cniPackage=$(jq ".Packages" "$COMPONENTS_FILEPATH" | jq ".[] | select(.name == \"cni-plugins\")") || exit $ERR_CNI_VERSION_INVALID
152+
if [ -z "$(jq -r '.Packages[] | select(.name == "containernetworking-plugins") | .name' < $COMPONENTS_FILEPATH)" ]; then
153+
cniPackage=$(jq ".Packages" "$COMPONENTS_FILEPATH" | jq ".[] | select(.name == \"cni-plugins\")") || exit $ERR_CNI_VERSION_INVALID
154+
155+
#CNI doesn't really care about this but wanted to reuse updatePackageVersions which requires it.
156+
os=${UBUNTU_OS_NAME}
157+
if [ -z "$UBUNTU_RELEASE" ]; then
158+
os=${OS}
159+
os_version="current"
160+
fi
161+
os_version="${UBUNTU_RELEASE}"
162+
if isMarinerOrAzureLinux "${OS}" && [ "${IS_KATA}" = "true" ]; then
163+
os=${MARINER_KATA_OS_NAME}
164+
fi
165+
updatePackageVersions "${cniPackage}" "${os}" "${os_version}" "${OS_VARIANT}"
153166

154-
#CNI doesn't really care about this but wanted to reuse updatePackageVersions which requires it.
155-
os=${UBUNTU_OS_NAME}
156-
if [ -z "$UBUNTU_RELEASE" ]; then
157-
os=${OS}
158-
os_version="current"
159-
fi
160-
os_version="${UBUNTU_RELEASE}"
161-
if isMarinerOrAzureLinux "${OS}" && [ "${IS_KATA}" = "true" ]; then
162-
os=${MARINER_KATA_OS_NAME}
163-
fi
164-
updatePackageVersions "${cniPackage}" "${os}" "${os_version}" "${OS_VARIANT}"
167+
#should change to ne
168+
# shellcheck disable=SC3010
169+
if [[ ${#PACKAGE_VERSIONS[@]} -gt 1 ]]; then
170+
echo "WARNING: containerd package versions array has more than one element. Installing the last element in the array."
171+
exit $ERR_CONTAINERD_VERSION_INVALID
172+
fi
173+
packageVersion=${PACKAGE_VERSIONS[0]}
165174

166-
#should change to ne
167-
# shellcheck disable=SC3010
168-
if [[ ${#PACKAGE_VERSIONS[@]} -gt 1 ]]; then
169-
echo "WARNING: containerd package versions array has more than one element. Installing the last element in the array."
170-
exit $ERR_CONTAINERD_VERSION_INVALID
171-
fi
172-
packageVersion=${PACKAGE_VERSIONS[0]}
175+
# Is there a ${arch} variable I can use instead of the iff
176+
if [ "$(isARM64)" -eq 1 ]; then
177+
CNI_DIR_TMP="cni-plugins-linux-arm64-v${packageVersion}"
178+
else
179+
CNI_DIR_TMP="cni-plugins-linux-amd64-v${packageVersion}"
180+
fi
173181

174-
# Is there a ${arch} variable I can use instead of the iff
175-
if [ "$(isARM64)" -eq 1 ]; then
176-
CNI_DIR_TMP="cni-plugins-linux-arm64-v${packageVersion}"
177-
else
178-
CNI_DIR_TMP="cni-plugins-linux-amd64-v${packageVersion}"
179-
fi
182+
if [ -d "$CNI_DOWNLOADS_DIR/${CNI_DIR_TMP}" ]; then
183+
#not clear to me when this would ever happen. assume its related to the line above Latest VHD should have the untar, older should have the tgz.
184+
mv ${CNI_DOWNLOADS_DIR}/${CNI_DIR_TMP}/* $CNI_BIN_DIR
185+
else
186+
echo "CNI tarball should already be unzipped by components.json"
187+
exit $ERR_CNI_VERSION_INVALID
188+
fi
180189

181-
if [ -d "$CNI_DOWNLOADS_DIR/${CNI_DIR_TMP}" ]; then
182-
#not clear to me when this would ever happen. assume its related to the line above Latest VHD should have the untar, older should have the tgz.
183-
mv ${CNI_DOWNLOADS_DIR}/${CNI_DIR_TMP}/* $CNI_BIN_DIR
184-
else
185-
echo "CNI tarball should already be unzipped by components.json"
186-
exit $ERR_CNI_VERSION_INVALID
190+
chown -R root:root $CNI_BIN_DIR
187191
fi
188-
189-
chown -R root:root $CNI_BIN_DIR
190192
}
191193

192194
installNetworkPlugin() {

0 commit comments

Comments
 (0)