Skip to content

Commit 46c82ab

Browse files
authored
[db_migrator] Fix parse_xml fails when minigraph has SonicQosProfile (#3972)
This change is to fix #22120 "Bug: [db_migrator] parse_xml fails when minigraph has SonicQosProfile". If there is `SonicQosProfile` in minigraph.xml, parse_xml fails with below error: 2025 Jul 14 06:49:23.590302 vlab-01 ERR db_migrator: Caught exception while trying to parse minigraph: join() argument must be str, bytes, or os.PathLike object, not 'NoneType' It's because select_mmu_profiles needs platform. https://github.com/sonic-net/sonic-buildimage/blob/master/src/sonic-config-engine/minigraph.py#L1925 This change added code to get platform info. While calling `parse_xml`, pass in the `platform` argument. Signed-off-by: Xin Wang <xiwang5@microsoft.com>
1 parent 1c3f789 commit 46c82ab

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

scripts/db_migrator.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ def __init__(self, namespace, socket=None):
6464
self.TABLE_KEY = 'DATABASE'
6565
self.TABLE_FIELD = 'VERSION'
6666

67+
self.platform = device_info.get_platform_info().get('platform')
68+
6769
# Generate config_src_data from minigraph and golden config
6870
self.generate_config_src(namespace)
6971

@@ -135,7 +137,7 @@ def generate_config_src(self, ns):
135137
minigraph_data = None
136138
try:
137139
if os.path.isfile(MINIGRAPH_FILE):
138-
minigraph_data = parse_xml(MINIGRAPH_FILE)
140+
minigraph_data = parse_xml(MINIGRAPH_FILE, platform=self.platform)
139141
except Exception as e:
140142
log.log_error('Caught exception while trying to parse minigraph: ' + str(e))
141143
pass

0 commit comments

Comments
 (0)