1347f29178
- 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 Azure/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
22 lines
688 B
Bash
Executable File
22 lines
688 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# 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
|