sonic-buildimage/platform/vs/docker-sonic-vs
Joe LeVeque 172354d36a
[sonic-py-common] get_platform(): Refactor method of retrieving platform identifier (#5094)
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()`
2020-08-04 23:51:35 -07:00
..
50-default.conf [virtualswitch]: build docker-sonic-vs docker based on SAI virtual switch (#1065) 2017-10-23 22:01:42 -07:00
chassis_db.py [vs]: support virtual-chassis setup in vs docker (#4709) 2020-07-29 14:20:31 -07:00
database_config.json [vs]: support virtual-chassis setup in vs docker (#4709) 2020-07-29 14:20:31 -07:00
default_chassis_cfg.json [vs]: support virtual-chassis setup in vs docker (#4709) 2020-07-29 14:20:31 -07:00
Dockerfile.j2 DPB Breakout Cli Test with proper setup (#3910) 2020-08-04 12:07:44 -07:00
hostname.j2 [vs]: support virtual-chassis setup in vs docker (#4709) 2020-07-29 14:20:31 -07:00
hwsku.json DPB Breakout Cli Test with proper setup (#3910) 2020-08-04 12:07:44 -07:00
orchagent.sh [orchagent] Use mac address from config_db instead of from eth0 (#4166) 2020-02-20 19:16:14 -08:00
platform.json DPB Breakout Cli Test with proper setup (#3910) 2020-08-04 12:07:44 -07:00
sonic-dev.gpg.key [vs]: add vlan configuration support in virtual switch (#1200) 2017-11-30 14:59:25 -08:00
start.sh [sonic-py-common] get_platform(): Refactor method of retrieving platform identifier (#5094) 2020-08-04 23:51:35 -07:00
supervisord.conf [vs]: support virtual-chassis setup in vs docker (#4709) 2020-07-29 14:20:31 -07:00