Skip to content
This repository has been archived by the owner on Mar 20, 2023. It is now read-only.

Commit

Permalink
Test python system executable before nodeprep use
Browse files Browse the repository at this point in the history
Because of some operating systems choice to deprecate a named system
executable of just python, this will test for a suitable python3 if
available, otherwise revert to the prior stated command
  • Loading branch information
emattiza committed Mar 31, 2021
1 parent 2cfc07d commit 0e139ec
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion scripts/shipyard_nodeprep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,11 @@ get_vm_size_from_imds() {
return
fi
curl -fSsL -H Metadata:true "http://169.254.169.254/metadata/instance?api-version=${IMDS_VERSION}" > imd.json
vm_size=$(python -c "import json;f=open('imd.json','r');a=json.load(f);print(a['compute']['vmSize']).lower()")
if command -v python3 > /dev/null 2>&1; then
vm_size=$(python3 -c "import json;f=open('imd.json','r');a=json.load(f);print(a['compute']['vmSize'].lower())")
else
vm_size=$(python -c "import json;f=open('imd.json','r');a=json.load(f);print(a['compute']['vmSize'].lower())")
fi
if [[ "$vm_size" =~ ^standard_(((hb|hc)[0-9]+m?rs?(_v[1-9])?)|(nc[0-9]+rs_v3)|(nd[0-9]+rs_v2))$ ]]; then
# SR-IOV RDMA
vm_rdma_type=1
Expand Down

0 comments on commit 0e139ec

Please sign in to comment.