Skip to content

Commit

Permalink
Removed legacy 'portmap.ini' and fixed LGTM issue
Browse files Browse the repository at this point in the history
Signed-off-by: Sangita Maity <sangitamaity0211@gmail.com>
  • Loading branch information
samaity committed Jun 2, 2020
1 parent e5066af commit 20c212c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/sonic-config-engine/portconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def readJson(filename):
print("Json file does not exist")
data_dict = ast.literal_eval(json.dumps(data))
return data_dict
except:
except Exception as e:
print("error occurred while parsing json:", sys.exc_info()[1])
return None

Expand All @@ -54,7 +54,7 @@ def db_connect_configdb():
return None
try:
config_db.connect()
except:
except Exception as e:
config_db = None
return config_db

Expand Down Expand Up @@ -109,7 +109,7 @@ def get_port_config(hwsku=None, platform=None, port_config_file=None, hwsku_conf
port_alias_map = {}
port_alias_asic_map = {}
for intf_name in ports.keys():
port_alias_map[ports[intf_name]["alias"]]= intf_name
port_alias_map[ports[intf_name]["alias"]] = intf_name
return (ports, port_alias_map, port_alias_asic_map)

if not port_config_file:
Expand Down
6 changes: 1 addition & 5 deletions src/sonic-daemon-base/sonic_daemon_base/daemon_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

# Port config information
PORT_CONFIG = 'port_config.ini'
PORTMAP = 'portmap.ini'
PLATFORM_CAP = 'platform.json'

EEPROM_MODULE_NAME = 'eeprom'
Expand Down Expand Up @@ -159,10 +158,7 @@ def get_path_to_port_config_file(self):
# platform.json doesn't exist. Try loading the legacy 'port_config.ini' file
port_config_file_path = "/".join([hwsku_path, PORT_CONFIG])
if not os.path.isfile(port_config_file_path):
# port_config.ini doesn't exist. Try loading the legacy 'portmap.ini' file
port_config_file_path = "/".join([hwsku_path, PORTMAP])
if not os.path.isfile(port_config_file_path):
raise IOError("Failed to detect port config file: %s" % (port_config_file_path))
raise IOError("Failed to detect port config file: %s" % (port_config_file_path))

return port_config_file_path

Expand Down

0 comments on commit 20c212c

Please sign in to comment.