From 13ff7b38d52f4afb98dc4a560f1599fcb441146c Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Thu, 5 Nov 2020 11:23:00 -0800 Subject: [PATCH] [docker-wait-any] Convert to Python 3, install dependency in host OS (#5784) - Convert docker-wait-any script to Python 3 - Install Python 3 Docker Engine API in host OS --- build_debian.sh | 8 +++++--- files/image_config/misc/docker-wait-any | 5 ++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/build_debian.sh b/build_debian.sh index 2bb284182d..2cea52e9e4 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -413,13 +413,15 @@ done < files/image_config/sysctl/sysctl-net.conf sudo augtool --autosave "$sysctl_net_cmd_string" -r $FILESYSTEM_ROOT -## docker Python API package is needed by Ansible docker module -sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip install 'docker==4.1.0' +# docker Python API package is needed by Ansible docker module as well as some SONiC applications +sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip2 install 'docker==4.1.0' +sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install 'docker==4.3.1' + ## Note: keep pip installed for maintainance purpose ## Get gcc and python dev pkgs sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install gcc libpython2.7-dev -sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip install 'netifaces==0.10.7' +sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip2 install 'netifaces==0.10.7' ## Create /var/run/redis folder for docker-database to mount sudo mkdir -p $FILESYSTEM_ROOT/var/run/redis diff --git a/files/image_config/misc/docker-wait-any b/files/image_config/misc/docker-wait-any index d006aec47a..8d98e1f36a 100755 --- a/files/image_config/misc/docker-wait-any +++ b/files/image_config/misc/docker-wait-any @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ docker-wait-any @@ -23,7 +23,7 @@ cases where we need the dependent container to be warm-restarted without affecting other services (eg: warm restart of teamd service) - NOTE: This script is written against docker Python package 4.1.0. Newer + NOTE: This script is written against docker Python package 4.3.1. Newer versions of docker may have a different API. """ import argparse @@ -68,7 +68,6 @@ def main(): docker_client = APIClient(base_url='unix://var/run/docker.sock') parser = argparse.ArgumentParser(description='Wait for dependent docker services', - version='1.0.0', formatter_class=argparse.RawTextHelpFormatter, epilog=""" Examples: