From 2b4cf6a2d95a668416b7d4fdfe49918bf64d2197 Mon Sep 17 00:00:00 2001 From: Andrii Ostapenko Date: Thu, 2 Jul 2020 18:52:10 -0500 Subject: [PATCH] Completely switch to python3 for developers installation This addresses an issue with using py2 as interpreter while installing required dependencies with py3. Also switch kubeadm-aio image to bionic. Change-Id: I5a9e6678c45fad8288aa6971f57988b46001c665 Signed-off-by: Andrii Ostapenko --- playbooks/vars.yaml | 2 +- roles/deploy-python-pip/tasks/main.yaml | 13 +++++++------ roles/deploy-python/tasks/main.yaml | 4 ++-- tools/image-repo-overides.sh | 2 +- tools/images/kubeadm-aio/Dockerfile | 2 +- .../kubeadm-aio/assets/opt/playbooks/vars.yaml | 1 + tools/images/kubeadm-aio/sources.list | 8 ++++---- 7 files changed, 17 insertions(+), 15 deletions(-) diff --git a/playbooks/vars.yaml b/playbooks/vars.yaml index fc4d71a10..8f6d99e7f 100644 --- a/playbooks/vars.yaml +++ b/playbooks/vars.yaml @@ -13,5 +13,5 @@ # NOTE(portdirect): for use in the dev-deploy scripts, a valid vars.yaml is # required, so provide some nonsense, yet harmless input. --- -dummy_value: "Lorem Ipsum" +ansible_python_interpreter: python3 ... diff --git a/roles/deploy-python-pip/tasks/main.yaml b/roles/deploy-python-pip/tasks/main.yaml index a65c100c2..0be603076 100644 --- a/roles/deploy-python-pip/tasks/main.yaml +++ b/roles/deploy-python-pip/tasks/main.yaml @@ -12,7 +12,7 @@ --- - name: check if pip installed - command: pip --version + command: pip3 --version register: pip_version_output ignore_errors: yes changed_when: false @@ -20,25 +20,25 @@ - name: ensuring python pip package is present for ubuntu when: ( pip_version_output is failed ) and ( ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' ) apt: - name: python-pip + name: python3-pip state: present - name: ensuring python pip package is present for centos when: ( pip_version_output is failed ) and ( ansible_distribution == 'CentOS' or ansible_distribution == 'Red Hat Enterprise Linux' ) block: - - name: ensuring epel-release package is present for centos as python-pip is in the epel repo + - name: ensuring epel-release package is present for centos as python3-pip is in the epel repo yum: name: epel-release state: present - name: ensuring python pip package is present for centos yum: - name: python-pip + name: python3-pip state: present -- name: ensuring python pip package is present for fedora via the python2-pip rpm +- name: ensuring python pip package is present for fedora via the python3-pip rpm when: ( pip_version_output is failed ) and ( ansible_distribution == 'Fedora' ) dnf: - name: python2-pip + name: python3-pip state: present - name: ensuring pip is the latest version @@ -51,4 +51,5 @@ pip: name: pip state: latest + executable: pip3 ... diff --git a/roles/deploy-python/tasks/main.yaml b/roles/deploy-python/tasks/main.yaml index 365ae2807..babce86db 100644 --- a/roles/deploy-python/tasks/main.yaml +++ b/roles/deploy-python/tasks/main.yaml @@ -11,6 +11,6 @@ # limitations under the License. --- -- name: ensuring python2 is present on all hosts - raw: test -e /usr/bin/python || (sudo apt -y update && sudo apt install -y python-minimal) || (sudo yum install -y python) || (sudo dnf install -y python2) +- name: ensuring python3 is present on all hosts + raw: test -e /usr/bin/python3 || (sudo apt -y update && sudo apt install -y python3-minimal) || (sudo yum install -y python3) || (sudo dnf install -y python3) ... diff --git a/tools/image-repo-overides.sh b/tools/image-repo-overides.sh index 565739f56..cba308a72 100755 --- a/tools/image-repo-overides.sh +++ b/tools/image-repo-overides.sh @@ -31,4 +31,4 @@ ALL_IMAGES="${KUBE_IMAGES} ${CHART_IMAGES}" jq -n -c -M \ --arg devclass "$(echo ${ALL_IMAGES})" \ '{"bootstrap": {"preload_images": ($devclass|split(" "))}}' | \ -python -c 'import sys, yaml, json; yaml.safe_dump(json.load(sys.stdin), sys.stdout, default_flow_style=False)' +python3 -c 'import sys, yaml, json; yaml.safe_dump(json.load(sys.stdin), sys.stdout, default_flow_style=False)' diff --git a/tools/images/kubeadm-aio/Dockerfile b/tools/images/kubeadm-aio/Dockerfile index 282ab0c0b..99f299e39 100644 --- a/tools/images/kubeadm-aio/Dockerfile +++ b/tools/images/kubeadm-aio/Dockerfile @@ -10,7 +10,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM docker.io/ubuntu:xenial +FROM docker.io/ubuntu:bionic MAINTAINER pete.birley@att.com ARG UBUNTU_URL=http://archive.ubuntu.com/ubuntu/ diff --git a/tools/images/kubeadm-aio/assets/opt/playbooks/vars.yaml b/tools/images/kubeadm-aio/assets/opt/playbooks/vars.yaml index d06ad267f..78412b150 100644 --- a/tools/images/kubeadm-aio/assets/opt/playbooks/vars.yaml +++ b/tools/images/kubeadm-aio/assets/opt/playbooks/vars.yaml @@ -13,6 +13,7 @@ --- all: vars: + ansible_python_interpreter: python3 my_container_name: null user: uid: null diff --git a/tools/images/kubeadm-aio/sources.list b/tools/images/kubeadm-aio/sources.list index 3fb443fea..ee1f99668 100644 --- a/tools/images/kubeadm-aio/sources.list +++ b/tools/images/kubeadm-aio/sources.list @@ -1,4 +1,4 @@ -deb %%UBUNTU_URL%% xenial main universe -deb %%UBUNTU_URL%% xenial-updates main universe -deb %%UBUNTU_URL%% xenial-backports main universe -deb %%UBUNTU_URL%% xenial-security main universe +deb %%UBUNTU_URL%% bionic main universe +deb %%UBUNTU_URL%% bionic-updates main universe +deb %%UBUNTU_URL%% bionic-backports main universe +deb %%UBUNTU_URL%% bionic-security main universe