Fix bug: if all containers killed, service stop will throw exception because no redis (#2139)

Signed-off-by: Qi Luo <qiluo-msft@users.noreply.github.com>
This commit is contained in:
Qi Luo 2018-10-12 08:39:06 -07:00 committed by lguohan
parent cd1167d767
commit 7d51f8363f

View File

@ -39,18 +39,18 @@ function postStartAction()
{%- endif %}
}
# Obtain our platform as we will mount directories with these names in each docker
PLATFORM=`sonic-cfggen -H -v DEVICE_METADATA.localhost.platform`
{%- if docker_container_name == "database" %}
# Don't mount HWSKU in {{docker_container_name}} container.
HWSKU=""
{%- else %}
# Obtain our HWSKU as we will mount directories with these names in each docker
HWSKU=`sonic-cfggen -d -v 'DEVICE_METADATA["localhost"]["hwsku"]'`
{%- endif %}
start() {
# Obtain our platform as we will mount directories with these names in each docker
PLATFORM=`sonic-cfggen -H -v DEVICE_METADATA.localhost.platform`
{%- if docker_container_name == "database" %}
# Don't mount HWSKU in {{docker_container_name}} container.
HWSKU=""
{%- else %}
# Obtain our HWSKU as we will mount directories with these names in each docker
HWSKU=`sonic-cfggen -d -v 'DEVICE_METADATA["localhost"]["hwsku"]'`
{%- endif %}
DOCKERCHECK=`docker inspect --type container {{docker_container_name}} 2>/dev/null`
if [ "$?" -eq "0" ]; then
DOCKERMOUNT=`getMountPoint "$DOCKERCHECK"`