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

Update sonic-cli start script and resolve package dependencies #5920

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion dockers/docker-sonic-mgmt-framework/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are not you moving to Python3 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upgrade to python3.7 in sonic-cli is in progress. A PR will be opened soon after the pending PRs related to Klish parser - sonic-net/sonic-mgmt-framework#72, sonic-net/sonic-mgmt-framework#73 - get merged.


RUN pip install connexion==1.1.15 \
setuptools==21.0.0 \
Expand Down
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 @@ -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
Expand Down