From 9a51b4a5e885ec49490318172cbb5bdafe2b7859 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Sat, 17 Mar 2018 00:40:08 +0000 Subject: [PATCH] [base image files] All 'docker exec' wrapper scripts now dynamically adjust their flags depending on whether or not they are run on a terminal --- dockers/docker-database/base_image_files/redis-cli | 9 ++++++++- dockers/docker-fpm-frr/base_image_files/vtysh | 10 +++++++++- dockers/docker-fpm-quagga/base_image_files/vtysh | 10 +++++++++- dockers/docker-lldp-sv2/base_image_files/lldpctl | 10 +++++++++- dockers/docker-orchagent/base_image_files/swssloglevel | 10 +++++++++- .../docker-platform-monitor/base_image_files/sensors | 10 +++++++++- dockers/docker-teamd/base_image_files/teamdctl | 9 ++++++++- 7 files changed, 61 insertions(+), 7 deletions(-) diff --git a/dockers/docker-database/base_image_files/redis-cli b/dockers/docker-database/base_image_files/redis-cli index 103dd9e02536..6ce1951cd4b9 100755 --- a/dockers/docker-database/base_image_files/redis-cli +++ b/dockers/docker-database/base_image_files/redis-cli @@ -1,3 +1,10 @@ #!/bin/bash -docker exec -it database redis-cli "$@" +DOCKER_EXEC_FLAGS="i" + +# Determine whether stdout is on a terminal +if [ -t 1 ] ; then + DOCKER_EXEC_FLAGS+="t" +fi + +docker exec -$DOCKER_EXEC_FLAGS database redis-cli "$@" diff --git a/dockers/docker-fpm-frr/base_image_files/vtysh b/dockers/docker-fpm-frr/base_image_files/vtysh index 18529b7522c7..8f8cb2e67960 100755 --- a/dockers/docker-fpm-frr/base_image_files/vtysh +++ b/dockers/docker-fpm-frr/base_image_files/vtysh @@ -1,2 +1,10 @@ #!/bin/bash -docker exec -it bgp vtysh "$@" + +DOCKER_EXEC_FLAGS="i" + +# Determine whether stdout is on a terminal +if [ -t 1 ] ; then + DOCKER_EXEC_FLAGS+="t" +fi + +docker exec -$DOCKER_EXEC_FLAGS bgp vtysh "$@" diff --git a/dockers/docker-fpm-quagga/base_image_files/vtysh b/dockers/docker-fpm-quagga/base_image_files/vtysh index 18529b7522c7..8f8cb2e67960 100755 --- a/dockers/docker-fpm-quagga/base_image_files/vtysh +++ b/dockers/docker-fpm-quagga/base_image_files/vtysh @@ -1,2 +1,10 @@ #!/bin/bash -docker exec -it bgp vtysh "$@" + +DOCKER_EXEC_FLAGS="i" + +# Determine whether stdout is on a terminal +if [ -t 1 ] ; then + DOCKER_EXEC_FLAGS+="t" +fi + +docker exec -$DOCKER_EXEC_FLAGS bgp vtysh "$@" diff --git a/dockers/docker-lldp-sv2/base_image_files/lldpctl b/dockers/docker-lldp-sv2/base_image_files/lldpctl index 068a6e3b5048..f5b6d8307ee9 100755 --- a/dockers/docker-lldp-sv2/base_image_files/lldpctl +++ b/dockers/docker-lldp-sv2/base_image_files/lldpctl @@ -1,2 +1,10 @@ #!/bin/bash -docker exec -i lldp lldpctl "$@" + +DOCKER_EXEC_FLAGS="i" + +# Determine whether stdout is on a terminal +if [ -t 1 ] ; then + DOCKER_EXEC_FLAGS+="t" +fi + +docker exec -$DOCKER_EXEC_FLAGS lldp lldpctl "$@" diff --git a/dockers/docker-orchagent/base_image_files/swssloglevel b/dockers/docker-orchagent/base_image_files/swssloglevel index 9282470c2645..d03685ed383c 100755 --- a/dockers/docker-orchagent/base_image_files/swssloglevel +++ b/dockers/docker-orchagent/base_image_files/swssloglevel @@ -1,2 +1,10 @@ #!/bin/bash -docker exec -i swss swssloglevel "$@" + +DOCKER_EXEC_FLAGS="i" + +# Determine whether stdout is on a terminal +if [ -t 1 ] ; then + DOCKER_EXEC_FLAGS+="t" +fi + +docker exec -$DOCKER_EXEC_FLAGS swss swssloglevel "$@" diff --git a/dockers/docker-platform-monitor/base_image_files/sensors b/dockers/docker-platform-monitor/base_image_files/sensors index af1e57941861..23a12034f071 100755 --- a/dockers/docker-platform-monitor/base_image_files/sensors +++ b/dockers/docker-platform-monitor/base_image_files/sensors @@ -1,2 +1,10 @@ #!/bin/bash -docker exec -i pmon sensors "$@" + +DOCKER_EXEC_FLAGS="i" + +# Determine whether stdout is on a terminal +if [ -t 1 ] ; then + DOCKER_EXEC_FLAGS+="t" +fi + +docker exec -$DOCKER_EXEC_FLAGS pmon sensors "$@" diff --git a/dockers/docker-teamd/base_image_files/teamdctl b/dockers/docker-teamd/base_image_files/teamdctl index 9dd188d18cba..615bc3d953fa 100755 --- a/dockers/docker-teamd/base_image_files/teamdctl +++ b/dockers/docker-teamd/base_image_files/teamdctl @@ -1,3 +1,10 @@ #!/bin/bash -docker exec -i teamd teamdctl "$@" +DOCKER_EXEC_FLAGS="i" + +# Determine whether stdout is on a terminal +if [ -t 1 ] ; then + DOCKER_EXEC_FLAGS+="t" +fi + +docker exec -$DOCKER_EXEC_FLAGS teamd teamdctl "$@"