Skip to content

Commit

Permalink
Improve robustness of consutil plugin loading (sonic-net#1353)
Browse files Browse the repository at this point in the history
The configuration file does not tolerate a new line.
Enhance the plugin loading by allowing trailing chars.

Signed-off-by: Jing Kan [email protected]
  • Loading branch information
Staphylo authored Jan 26, 2021
1 parent 64aa1b8 commit 47f412b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions consutil/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,8 @@ def init_device_prefix():

if os.path.exists(PLUGIN_PATH):
fp = open(PLUGIN_PATH, 'r')
line = fp.readlines()
SysInfoProvider.DEVICE_PREFIX = "/dev/" + line[0]
lines = fp.readlines()
SysInfoProvider.DEVICE_PREFIX = "/dev/" + lines[0].rstrip()

@staticmethod
def list_console_ttys():
Expand Down

0 comments on commit 47f412b

Please sign in to comment.