Skip to content

Commit

Permalink
[docker-wait-any] Convert to Python 3, install dependency in host OS (#…
Browse files Browse the repository at this point in the history
…5784)

- Convert docker-wait-any script to Python 3
- Install Python 3 Docker Engine API in host OS
  • Loading branch information
jleveque authored Nov 5, 2020
1 parent d804598 commit 13ff7b3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
8 changes: 5 additions & 3 deletions build_debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions files/image_config/misc/docker-wait-any
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

"""
docker-wait-any
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 13ff7b3

Please sign in to comment.