[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
This commit is contained in:
Joe LeVeque 2020-11-05 11:23:00 -08:00 committed by GitHub
parent d8045987a6
commit 13ff7b38d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 6 deletions

View File

@ -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

View File

@ -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: