Skip to content
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

[consutil] Look for udevprefix.conf file under platform dir, not plugins #1431

Merged
merged 1 commit into from
Feb 13, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 12 additions & 14 deletions consutil/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,14 @@
# Helper code for CLI for interacting with switches via console device
#

try:
import click
import re
import subprocess
import pexpect
import sys
import os
from sonic_py_common import device_info
except ImportError as e:
raise ImportError("%s - required module not found" % str(e))
import os
import pexpect
import re
import subprocess
import sys

import click
from sonic_py_common import device_info

ERR_DISABLE = 1
ERR_CMD = 2
Expand Down Expand Up @@ -46,7 +44,7 @@
PICOCOM_READY = "Terminal ready"
PICOCOM_BUSY = "Resource temporarily unavailable"

FILENAME = "udevprefix.conf"
UDEV_PREFIX_CONF_FILENAME = "udevprefix.conf"

TIMEOUT_SEC = 0.2

Expand Down Expand Up @@ -266,10 +264,10 @@ class SysInfoProvider(object):
@staticmethod
def init_device_prefix():
platform_path, _ = device_info.get_paths_to_platform_and_hwsku_dirs()
PLUGIN_PATH = "/".join([platform_path, "plugins", FILENAME])
UDEV_PREFIX_CONF_FILE_PATH = os.path.join(platform_path, UDEV_PREFIX_CONF_FILENAME)

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

Expand Down