diff --git a/dockers/docker-sonic-mgmt-framework/Dockerfile.j2 b/dockers/docker-sonic-mgmt-framework/Dockerfile.j2 index 24ae3643b36e..735623aa20ee 100644 --- a/dockers/docker-sonic-mgmt-framework/Dockerfile.j2 +++ b/dockers/docker-sonic-mgmt-framework/Dockerfile.j2 @@ -7,7 +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++ python-dev libxml2 + apt-get install -y g++ python-dev libxml2 libcurl3-gnutls libpython2.7 libcjson-dev RUN pip install connexion==1.1.15 \ setuptools==21.0.0 \ diff --git a/dockers/docker-sonic-mgmt-framework/base_image_files/sonic-cli b/dockers/docker-sonic-mgmt-framework/base_image_files/sonic-cli index 6675e3badbaf..12a22709590d 100755 --- a/dockers/docker-sonic-mgmt-framework/base_image_files/sonic-cli +++ b/dockers/docker-sonic-mgmt-framework/base_image_files/sonic-cli @@ -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 diff --git a/sonic-slave-buster/Dockerfile.j2 b/sonic-slave-buster/Dockerfile.j2 index 03dae31ecd46..7e1290e986a2 100644 --- a/sonic-slave-buster/Dockerfile.j2 +++ b/sonic-slave-buster/Dockerfile.j2 @@ -305,7 +305,9 @@ RUN apt-get update && apt-get install -y \ libxml2-utils \ xsltproc \ python-lxml \ - libexpat1-dev + libexpat1-dev \ + libcurl3-gnutls \ + libcjson-dev ## Config dpkg ## install the configuration file if it’s currently missing