[docker]: get hostname from config db instead of minigraph (#3004)
minigraph may not be always available on the some system configuration. Should use config db as the source of truth.
This commit is contained in:
parent
383fc0fa4b
commit
8f6ae90cba
@ -130,8 +130,8 @@ start() {
|
|||||||
{%- else %}
|
{%- else %}
|
||||||
# Obtain our HWSKU as we will mount directories with these names in each docker
|
# Obtain our HWSKU as we will mount directories with these names in each docker
|
||||||
HWSKU=`sonic-cfggen -d -v 'DEVICE_METADATA["localhost"]["hwsku"]'`
|
HWSKU=`sonic-cfggen -d -v 'DEVICE_METADATA["localhost"]["hwsku"]'`
|
||||||
|
HOSTNAME=`sonic-cfggen -d -v 'DEVICE_METADATA["localhost"]["hostname"]'`
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
HOSTNAME=`sonic-cfggen -m -v 'DEVICE_METADATA["localhost"]["hostname"]'`
|
|
||||||
if [ -z "$HOSTNAME" ] || ! [[ $HOSTNAME =~ ^[a-zA-Z0-9.\-]*$ ]]; then
|
if [ -z "$HOSTNAME" ] || ! [[ $HOSTNAME =~ ^[a-zA-Z0-9.\-]*$ ]]; then
|
||||||
HOSTNAME=`hostname`
|
HOSTNAME=`hostname`
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user