diff --git a/scripts/db_migrator.py b/scripts/db_migrator.py index 3bb6fec122..9fc4b61910 100755 --- a/scripts/db_migrator.py +++ b/scripts/db_migrator.py @@ -71,11 +71,15 @@ def __init__(self, namespace, socket=None): self.stateDB.connect(self.stateDB.STATE_DB) version_info = device_info.get_sonic_version_info() - asic_type = version_info.get('asic_type') - self.asic_type = asic_type + + self.asic_type = version_info.get('asic_type') + if not self.asic_type: + log.log_error("ASIC type information not obtained. DB migration will not be reliable") self.hwsku = device_info.get_hwsku() + if not self.hwsku: + log.log_error("HWSKU information not obtained. DB migration will not be reliable") - if asic_type == "mellanox": + if self.asic_type == "mellanox": from mellanox_buffer_migrator import MellanoxBufferMigrator self.mellanox_buffer_migrator = MellanoxBufferMigrator(self.configDB, self.appDB, self.stateDB) @@ -751,7 +755,7 @@ def common_migration_ops(self): self.configDB.set_entry(init_cfg_table, key, new_cfg) 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): self.migrate_mgmt_ports_on_s6100() else: log.log_notice("Asic Type: {}, Hwsku: {}".format(self.asic_type, self.hwsku))