[202211] chassisd: Fix crash on exit on linecard #352
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Set the
config_manager
variable toNone
if we are running on alinecard and thus don't need to set up the config manager.
Motivation and Context
During cleanup, the chassid service tries to clean up the
config_manager
, but theconfig_manager
variable is only everinitialized if we are on the supervisor. Thus, checking if it is
None
is insufficient because this results in anUnboundLocalError
that prevents the cleanup from succeeding on a linecard.
How Has This Been Tested?
This has been tested via both the sonic-mgmt platform_tests test case
for the chassid daemon as well as the updated unit tests in this PR.
Additional Information
This is a cherry-pick of PR #347 to 202211 release branch. Note that
PR #328 is also backported to 202211 in this PR as it is required for the
unit test update to pass.