From 8f2d458ce1ebccea66b2ebc4994f88e8a56ae15d Mon Sep 17 00:00:00 2001 From: Walt Della Date: Wed, 27 Jan 2021 04:05:41 +0000 Subject: [PATCH] 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 https://github.com/pypa/pip/pull/9189, pip no longer runs with many distros default python 2.7. (cherry picked from commit 684f823152988cd69dd2a7cdd09829366cde9190) --- assets/terraform/gce/bootstrap/sles.sh | 21 +++++---------------- assets/terraform/gce/bootstrap/ubuntu.sh | 10 +++++++--- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/assets/terraform/gce/bootstrap/sles.sh b/assets/terraform/gce/bootstrap/sles.sh index 6f175d8c..22ee1be5 100644 --- a/assets/terraform/gce/bootstrap/sles.sh +++ b/assets/terraform/gce/bootstrap/sles.sh @@ -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 diff --git a/assets/terraform/gce/bootstrap/ubuntu.sh b/assets/terraform/gce/bootstrap/ubuntu.sh index 7278fd00..b99b8de1 100644 --- a/assets/terraform/gce/bootstrap/ubuntu.sh +++ b/assets/terraform/gce/bootstrap/ubuntu.sh @@ -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