Skip to content
This repository was archived by the owner on Jun 28, 2022. It is now read-only.

Commit 7e49bc6

Browse files
committed
Install awscli without python/pip
This avoids the need to install python or use pip to install v1 of the cli. This recently became important because after pypa/pip#9189, pip no longer runs with many distros default python 2.7.
1 parent 3774f86 commit 7e49bc6

File tree

2 files changed

+12
-19
lines changed

2 files changed

+12
-19
lines changed

assets/terraform/gce/bootstrap/sles.sh

+5-16
Original file line numberDiff line numberDiff line change
@@ -81,23 +81,12 @@ mkdir -p $etcd_dir /var/lib/data
8181
secure-ssh
8282
setup-user
8383

84-
function install-aws-cli {
85-
# suse-cloud/sles-15-sp1-v20200415 has no python, but offers python3.
86-
# suse-cloud/sles-12-sp5-v20200227 has both, but it's python3 < 3.5 and is
87-
# incompatible with awscli.
88-
if command -v python; then
89-
local python=$(command -v python)
90-
elif command -v python3; then
91-
local python=$(command -v python3)
92-
else
93-
echo "No python available."
94-
exit 2
95-
fi
96-
curl https://bootstrap.pypa.io/get-pip.py | $python -
97-
$python -m pip install --upgrade awscli
98-
}
84+
if ! /usr/local/bin/aws --version; then
85+
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64-2.0.30.zip" -o "awscliv2.zip"
86+
unzip awscliv2.zip
87+
./aws/install
88+
fi
9989

100-
install-aws-cli
10190

10291
mkdir -p /var/lib/gravity/planet/etcd /var/lib/data
10392

assets/terraform/gce/bootstrap/ubuntu.sh

+7-3
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,14 @@ setup-user
9494
echo "APT::Acquire::Retries \"10\";" > /etc/apt/apt.conf.d/80-retries
9595

9696
apt-get update
97-
apt-get install -y chrony lvm2 curl wget thin-provisioning-tools python
97+
apt-get install -y chrony lvm2 curl wget thin-provisioning-tools
9898

99-
curl https://bootstrap.pypa.io/get-pip.py | python -
100-
pip install --upgrade awscli
99+
if ! /usr/local/bin/aws --version; then
100+
apt-get install -y unzip
101+
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64-2.0.30.zip" -o "awscliv2.zip"
102+
unzip awscliv2.zip
103+
./aws/install
104+
fi
101105

102106
if ! grep -qs "$etcd_dir" /proc/mounts; then
103107
mkfs.ext4 -F /dev/$etcd_device_name

0 commit comments

Comments
 (0)