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

Vnet_route_check TCP socket for DB connection. #3578

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

siqbal1986
Copy link
Contributor

Currently the Vnet_route_check fails if a user calls it witout sudo with the following error.

Traceback (most recent call last):
  File "/usr/local/bin/vnet_route_check.py", line 401, in <module>
    sys.exit(main())
  File "/usr/local/bin/vnet_route_check.py", line 364, in main
    if not check_vnet_cfg():
  File "/usr/local/bin/vnet_route_check.py", line 77, in check_vnet_cfg
    db = swsscommon.DBConnector('APPL_DB', 0)
  File "/usr/lib/python3/dist-packages/swsscommon/swsscommon.py", line 1656, in __init__
    _swsscommon.DBConnector_swiginit(self, _swsscommon.new_DBConnector(*args))
RuntimeError: Unable to connect to redis (unix-socket): Cannot assign requested address

What I did

The route_check script accesses the same DB tables but is able to run without the sudo rights. To solve this problem I have changed the Vnet_route_check to use a TCP socket to connect to the DB as done in route_check. As a result the script doesn't fail with a run time error.

How I did it

How to verify it

create a new user on a T1 device which has no docker or sudoers privilage. run vnet_route check. it should fail.

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

Traceback (most recent call last):
  File "/usr/local/bin/vnet_route_check.py", line 401, in <module>
    sys.exit(main())
  File "/usr/local/bin/vnet_route_check.py", line 364, in main
    if not check_vnet_cfg():
  File "/usr/local/bin/vnet_route_check.py", line 77, in check_vnet_cfg
    db = swsscommon.DBConnector('APPL_DB', 0)
  File "/usr/lib/python3/dist-packages/swsscommon/swsscommon.py", line 1656, in __init__
    _swsscommon.DBConnector_swiginit(self, _swsscommon.new_DBConnector(*args))
RuntimeError: Unable to connect to redis (unix-socket): Cannot assign requested address

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

None

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

Successfully merging this pull request may close these issues.

1 participant