-
Notifications
You must be signed in to change notification settings - Fork 664
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[db-migrator] Fix hwsku match for 6100 and add errors when hwsku is None #2821
Conversation
@@ -989,7 +992,7 @@ def common_migration_ops(self): | |||
# removed together with calling to migrate_copp_table function. | |||
if self.asic_type != "mellanox": | |||
self.migrate_copp_table() | |||
if self.asic_type == "broadcom" and 'Force10-S6100' in self.hwsku: | |||
if self.asic_type == "broadcom" and 'Force10-S6100' in str(self.hwsku): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need to protect the possibility that self.hwsku is none?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If self.hwsku
is None
then str(None)
will convert None to a string and in
check will still work.
Alternative is (as we want to ensure self.hwsku is always a string:
if self.asic_type == "broadcom" and type(self.hwsku) = str and 'Force10-S6100' in str(self.hwsku):
can you add ado? |
@vaibhavhd This commit could not be cleanly cherry-picked to 202012. Please submit another PR. |
…one (#2821) * Fix hwsku match for 6100 and add errors when hwsku is None * Asic type fix
@vaibhavhd , please create manually cherry-pick PR to 202012, if this PR not required for 202012, please remove 'Request for 202012 branch' label |
…sku is None (#2896) Cherry pick of #2821 MSFT ADO: 17972494 Fix errors in db migration when hwsku is not detected. This PR is adds a better-error-handling fix for the issue that is fixed by: sonic-net/sonic-buildimage#14933 May 2 20:35:04 sonic database.sh[649]: Creating new database container May 2 20:35:04 sonic database.sh[663]: 99e8edba01ed0c7581f0d61dd2fa78374fa4f23e636a957004dd03a6f68eea86 May 2 20:35:04 sonic root: Starting database service... May 2 20:35:06 sonic database.sh[690]: database May 2 20:35:10 sonic database.sh[926]: True May 2 20:35:10 sonic database.sh[928]: File "/usr/local/bin/db_migrator.py", line 714, in common_migration_ops May 2 20:35:10 sonic database.sh[928]: File "/usr/local/bin/db_migrator.py", line 741, in migrate May 2 20:35:10 sonic database.sh[928]: File "/usr/local/bin/db_migrator.py", line 782, in main May 2 20:35:10 sonic database.sh[928]: Traceback (most recent call last): May 2 20:35:10 sonic database.sh[928]: TypeError: argument of type 'NoneType' is not iterable May 2 20:35:10 sonic database.sh[928]: argument of type 'NoneType' is not iterable May 2 20:35:10 sonic database.sh[928]: optional arguments: May 2 20:35:10 sonic database.sh[928]: usage: db_migrator.py [-h] [-o operation migrate, set_version, get_version] May 2 20:35:10 sonic db_migrator: :- operator(): DB '{APPL_DB}' is empty with pattern 'COPP_TABLE:*'! May 2 20:35:10 sonic db_migrator: :- operator(): DB '{APPL_DB}' is empty with pattern 'INTF_TABLE:*'! May 2 20:35:10 sonic db_migrator: :- operator(): Key 'BUFFER_MAX_PARAM_TABLE|global' field 'mmu_size' unavailable in database 'STATE_DB' May 2 20:35:10 sonic db_migrator: :- operator(): Key 'WARM_RESTART_ENABLE_TABLE|system' field 'enable' unavailable in database 'STATE_DB' May 2 20:35:10 sonic db_migrator: Caught exception: argument of type 'NoneType' is not iterable May 2 20:35:11 sonic config-setup[935]: Copying SONiC configuration minigraph.xml ... May 2 20:35:11 sonic config-setup[935]: Reloading minigraph... May 2 20:35:11 sonic config-setup[935]: Use minigraph.xml from old system... May 2 20:35:11 sonic root: Started database service... How I did it Convert hwsku's type to str before checking substring. Add error logs when hwsku and asic type information is not obtained. How to verify it Tested on a physical device
…one (sonic-net#2821) * Fix hwsku match for 6100 and add errors when hwsku is None * Asic type fix
What I did
MSFT ADO: 17972494
Fix errors in db migration when hwsku is not detected.
This PR is adds a better-error-handling fix for the issue that is fixed by: sonic-net/sonic-buildimage#14933
How I did it
Convert hwsku's type to
str
before checking substring.Add error logs when hwsku and asic type information is not obtained.
How to verify it
Tested on a physical device
Previous command output (if the output of a command-line utility has changed)
New command output (if the output of a command-line utility has changed)