From ef5f21231f97277b253d7eb10370a8549848344d Mon Sep 17 00:00:00 2001 From: PJHsieh <49477291+PJHsieh@users.noreply.github.com> Date: Tue, 3 Nov 2020 02:57:05 +0800 Subject: [PATCH] [sfputil] Display 'N/A' for non-SFP ports (#1078) Currently, "Not Present" will be shown at non-sfp ports. This enhancement will show "N/A" instead of "Not Present" at non-sfp ports. --- sfputil/main.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sfputil/main.py b/sfputil/main.py index f86c5043f2..e745081459 100644 --- a/sfputil/main.py +++ b/sfputil/main.py @@ -412,10 +412,11 @@ def presence(port): click.echo("This functionality is currently not implemented for this platform") sys.exit(5) - if presence: - output_table.append([port_name, "Present"]) + if platform_sfputil._is_valid_port(physical_port): + status_string = "Present" if presence else "Not present" + output_table.append([port_name, status_string]) else: - output_table.append([port_name, "Not present"]) + output_table.append([port_name, "N/A"]) i += 1