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

[pcieutil] Remove the warning message and change the config file location #1362

Merged
merged 4 commits into from
Feb 9, 2021
Merged
Changes from 1 commit
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
19 changes: 7 additions & 12 deletions pcieutil/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,17 @@ def print_result(name, result):

def load_platform_pcieutil():
global platform_pcieutil
global platform_plugins_path
global platform_path

# Load platform module from source
try:
platform_path, _ = device_info.get_paths_to_platform_and_hwsku_dirs()
platform_plugins_path = os.path.join(platform_path, "plugins")
sys.path.append(os.path.abspath(platform_plugins_path))
from pcieutil import PcieUtil
sys.path.append(os.path.abspath(platform_path))
jleveque marked this conversation as resolved.
Show resolved Hide resolved
from sonic_platform_base.sonic_pcie.pcie_common import PcieUtil
platform_pcieutil = PcieUtil(platform_path)
except ImportError as e:
log.log_warning("Failed to load platform-specific PcieUtil module. Falling back to the common implementation")
try:
from sonic_platform_base.sonic_pcie.pcie_common import PcieUtil
platform_pcieutil = PcieUtil(platform_plugins_path)
except ImportError as e:
log.log_error("Failed to load default PcieUtil module. Error : {}".format(str(e)), True)
raise e
log.log_error("Failed to load default PcieUtil module. Error : {}".format(str(e)), True)
raise e


# ==================== CLI commands and groups ====================
Expand Down Expand Up @@ -131,7 +126,7 @@ def check():
def generate():
'''Generate config file with current pci device'''
platform_pcieutil.dump_conf_yaml()
click.echo("Generate config file pcie.yaml under path %s" % platform_plugins_path)
click.echo("Generate config file pcie.yaml under path %s" % platform_path)
jleveque marked this conversation as resolved.
Show resolved Hide resolved


if __name__ == '__main__':
Expand Down