172354d36a
Applications running in the host OS can read the platform identifier from /host/machine.conf. When loading configuration, sonic-config-engine *needs* to read the platform identifier from machine.conf, as it it responsible for populating the value in Config DB. When an application is running inside a Docker container, the machine.conf file is not accessible, as the /host directory is not mounted. So we need to retrieve the platform identifier from Config DB if get_platform() is called from inside a Docker container. However, we can't simply check that we're running in a Docker container because the host OS of the SONiC virtual switch is running inside a Docker container. So I refactored `get_platform()` to: 1. Read from the `PLATFORM` environment variable if it exists (which is defined in a virtual switch Docker container) 2. Read from machine.conf if possible (works in the host OS of a standard SONiC image, critical for sonic-config-engine at boot) 3. Read the value from Config DB (needed for Docker containers running in SONiC, as machine.conf is not accessible to them) - Also fix typo in daemon_base.py - Also changes to align `get_hwsku()` with `get_platform()` |
||
---|---|---|
.. | ||
barefoot | ||
broadcom | ||
cavium | ||
centec | ||
generic | ||
innovium | ||
marvell | ||
marvell-arm64 | ||
marvell-armhf | ||
mellanox | ||
nephos | ||
p4 | ||
template | ||
vs |