forked from sonic-net/sonic-buildimage
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[docker-mgmt-framework]: update mgmt framework docker to support soni…
…c-cli cmd (sonic-net#6148) - Why I did it migrate to python3 support add dependent packages for Klish allow login as non-root user - How I did it update sonic-cli script to start Klish with user name, system name and timeout update the Dockerfile.j2 to resolve dependent packages add python3-dev for Klish use - How to verify it Incremental buster build with sonic-net/sonic-mgmt-framework#76 and verify the sonic-cli - Description for the changelog Migrate to python3.7 support, update sonic-cli script and resolve package dependencies
- Loading branch information
Showing
3 changed files
with
26 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 19 additions & 2 deletions
21
dockers/docker-sonic-mgmt-framework/base_image_files/sonic-cli
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters