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

[show] Allow system with no ports in config db run without errors #1697

Closed
wants to merge 2 commits into from
Closed
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
3 changes: 1 addition & 2 deletions utilities_common/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,7 @@ def __init__(self, db=None):
self.port_dict = self.config_db.get_table('PORT')
self.alias_max_length = 0


if not self.port_dict:
if self.port_dict is None:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the get_table API doesn't return None, this check may not be needed and we can remove it altogether. Can you please confirm?

Copy link
Contributor Author

@liorghub liorghub Jul 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. Both get_table() and get_port_table() initialize an empty dictionary which is being returned even if 'PORT' table is empty. I removed this check.

click.echo(message="Warning: failed to retrieve PORT table from ConfigDB!", err=True)
self.port_dict = {}

Expand Down