Skip to content

Commit fda5d6e

Browse files
authored
[Mellanox] Handle exception during Inotify import (#21469)
- Why I did it During smartswitch initialization, an error is observed during switch bootup. ztp disable runs decode-eeprom. Happens during ztp because, ztp sets DEBUG="" here https://github.com/sonic-net/sonic-ztp/blob/202411/src/etc/default/ztp#L6 - How I did it Fixed the import in inotify - How to verify it Verified by running decode-eeprom during init
1 parent 408e1e3 commit fda5d6e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

platform/mellanox/mlnx-platform-api/sonic_platform/inotify_helper.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#
2-
# Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES.
2+
# SPDX-FileCopyrightText: NVIDIA CORPORATION & AFFILIATES
3+
# Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
34
# Apache-2.0
45
#
56
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -18,6 +19,9 @@
1819
"""Helper code for Inotify Implementation for reading file until timeout"""
1920
import os
2021
import errno
22+
# Inotify causes an exception when DEBUG env variable is set to a non-integer convertible
23+
# https://github.com/dsoprea/PyInotify/blob/0.2.10/inotify/adapters.py#L37
24+
os.environ['DEBUG'] = '0'
2125
import inotify.adapters
2226

2327
try:

0 commit comments

Comments
 (0)