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

Commit

Permalink
Install awscli without python/pip
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
wadells committed Jan 27, 2021
1 parent 3774f86 commit 7e49bc6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 19 deletions.
21 changes: 5 additions & 16 deletions assets/terraform/gce/bootstrap/sles.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,23 +81,12 @@ mkdir -p $etcd_dir /var/lib/data
secure-ssh
setup-user

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

install-aws-cli

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

Expand Down
10 changes: 7 additions & 3 deletions assets/terraform/gce/bootstrap/ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,14 @@ setup-user
echo "APT::Acquire::Retries \"10\";" > /etc/apt/apt.conf.d/80-retries

apt-get update
apt-get install -y chrony lvm2 curl wget thin-provisioning-tools python
apt-get install -y chrony lvm2 curl wget thin-provisioning-tools

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

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

0 comments on commit 7e49bc6

Please sign in to comment.