Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docker-mgmt-framework]: update mgmt framework docker to support sonic-cli cmd #6148

Merged
merged 14 commits into from
Jun 3, 2021
22 changes: 4 additions & 18 deletions dockers/docker-sonic-mgmt-framework/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,7 @@ RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%s
ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && \
apt-get install -y g++ python3-dev libxml2

# TODO: Remove these lines once we no longer need Python 2
RUN apt-get install -f -y python-dev python-pip
RUN pip2 install --upgrade 'pip<21'
RUN apt-get purge -y python-pip
RUN pip2 install setuptools==40.8.0
RUN pip2 install wheel==0.35.1
RUN pip2 install connexion==1.1.15 \
setuptools==21.0.0 \
grpcio-tools==1.20.0 \
certifi==2017.4.17 \
python-dateutil==2.6.0 \
six==1.11.0 \
urllib3==1.21.1
apt-get install -y g++ python3-dev libxml2 libcurl3-gnutls libcjson-dev

RUN pip3 install connexion==2.7.0 \
setuptools==21.0.0 \
Expand All @@ -46,11 +32,11 @@ COPY ["start.sh", "rest-server.sh", "/usr/bin/"]
COPY ["mgmt_vars.j2", "/usr/share/sonic/templates/"]
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]

# TODO: Remove this line once we no longer need Python 2
RUN apt-get purge -y python-dev

RUN apt-get remove -y g++ python3-dev
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
RUN rm -rf /debs

RUN ln -sf /host_etc/passwd /etc/passwd
renukamanavalan marked this conversation as resolved.
Show resolved Hide resolved
RUN ln -sf /host_etc/group /etc/group

ENTRYPOINT ["/usr/local/bin/supervisord"]
21 changes: 19 additions & 2 deletions dockers/docker-sonic-mgmt-framework/base_image_files/sonic-cli
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
#!/bin/bash

docker exec -it mgmt-framework /usr/sbin/cli/clish_start "$@"

# Disallow CLI for the root user, since we don't have auth certs for root
if [[ "$(id -u)" == 0 ]]
then
echo "FATAL: root cannot launch CLI" >&2
exit 1
fi
TIMEOUT=605
if [[ "$1" =~ "prompt=" ]]
then
SYSTEM_NAME=`echo $1 | cut -d"=" -f2`
shift
docker exec -e SYSTEM_NAME=$SYSTEM_NAME -e CLI_USER="$USER" -u $(id -u):$(id -g) -it mgmt-framework /usr/sbin/cli/clish_start -t "$TIMEOUT" "$@"
else
docker exec -e CLI_USER="$USER" -e SYSTEM_NAME=$HOSTNAME -u $(id -u):$(id -g) -it mgmt-framework /usr/sbin/cli/clish_start -t "$TIMEOUT" "$@"
fi
ret=$?
if [ $ret -ne 0 ]; then
[[ -e /tmp/fast-reboot-progress || -e /tmp/reboot-progress ]] && sleep infinity
fi
4 changes: 3 additions & 1 deletion sonic-slave-buster/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,9 @@ RUN apt-get update && apt-get install -y \
libxml2-utils \
xsltproc \
python-lxml \
libexpat1-dev
libexpat1-dev \
libcurl3-gnutls \
libcjson-dev

# Build fix for ARMHF buster libsairedis
{%- if CONFIGURED_ARCH == "armhf" %}
Expand Down