From 1f97760989eee401456842ef05512a32d2946741 Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Thu, 17 Aug 2017 09:33:57 -0700 Subject: [PATCH] Install python2 on newer Ubuntus Newer Ubuntus like Xenial don't necessary have python2 preinstalled. If on Ubuntu and `python` is not present we install the python package so that pip and ansible are happy later on. Change-Id: Ia81c33b845664f35fba6fa8259bc83f8bcfec0e0 --- install_puppet.sh | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/install_puppet.sh b/install_puppet.sh index decc648c4e..f99388ebe9 100755 --- a/install_puppet.sh +++ b/install_puppet.sh @@ -232,11 +232,6 @@ EOF fi dpkg -i $puppet_deb rm $puppet_deb - - # ansible also requires python2 on the host to run correctly. - # Make sure we have it, as some images come without it - DEBIAN_FRONTEND=noninteractive apt-get --option 'Dpkg::Options::=--force-confold' \ - --assume-yes install python-minimal fi; apt-get update @@ -329,6 +324,16 @@ function setup_pip { pip install -U setuptools } +# Need to install python2 early as pip and ansible need it and it +# isn't necessarily previously installed on newer Ubuntu releases. +if is_ubuntu; then + if ! which python > /dev/null 2<&1 ; then + DEBIAN_FRONTEND=noninteractive apt-get update + DEBIAN_FRONTEND=noninteractive apt-get --option 'Dpkg::Options::=--force-confold' \ + --assume-yes install -y --force-yes python-minimal + fi +fi + if $SETUP_PIP; then setup_pip fi