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

Fixes show commands failure when database is not ready #699

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Kalimuthu-Velappan
Copy link
Contributor

@Kalimuthu-Velappan Kalimuthu-Velappan commented Oct 9, 2019

Change-Id: I3857bd80ab9667f5f2bd93496d0205eb97962246

- What I did
Fixes show commands failure when the database is not ready:

When interface show commands are executed before database service ready, it throws a connection error.

- How I did it

Added try..catch block for the database connection object.

    try:
        config_db = ConfigDBConnector()
         config_db.connect()
    except Exception as e:
         click.echo("Database service is not ready!\n")
        sys.exit(0)

- How to verify it

 Run the show command when the database is not ready.

- Previous command output (if the output of a command-line utility has changed)

- New command output (if the output of a command-line utility has changed)

-->

Change-Id: I3857bd80ab9667f5f2bd93496d0205eb97962246
@Kalimuthu-Velappan Kalimuthu-Velappan marked this pull request as ready for review October 11, 2019 09:28
show/main.py Outdated Show resolved Hide resolved
Copy link
Contributor Author

@Kalimuthu-Velappan Kalimuthu-Velappan left a comment

Choose a reason for hiding this comment

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

Removed the redundant print statement

config_db = ConfigDBConnector()
config_db.connect()
except Exception as e:
click.echo ("System is not ready - Core services are not up")
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove space between echo and opening parenthesis.

try:
config_db = ConfigDBConnector()
config_db.connect()
except Exception as e:
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you provide a more specific Exception(s) here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will add it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants