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

HTTP fallback causes 'Invalid Credentials' error to be masqueraded as 'Bad Request' #183

Closed
1 task done
b-abadie opened this issue Apr 22, 2020 · 1 comment · Fixed by #185
Closed
1 task done
Assignees
Labels
module_utils: cv_client cv_client implementation issue state: accepted Issue is part of the development roadmap status: testing PR under testing
Milestone

Comments

@b-abadie
Copy link
Contributor

Issue Type

  • Bug fix (non-breaking change which fixes an issue)

Summary

When explicitly specifying an HTTPS port number, automatic fallback to HTTP in cv_client.py line 303 causes an 'Invalid Credentials' error to be presented as 'Bad Request' to the user, due to an attempt to perform an HTTP request on an HTTPS port.

Note that this is probably the case for more errors, namely all exceptions raised line 328 :

        except (ConnectionError, CvpApiError, CvpRequestError,
                CvpSessionLogOutError, HTTPError, ReadTimeout, Timeout,
                TooManyRedirects) as error:

Role or Module Name

Module name: cv_client

arista.cvp collection and Python libraries version 1.0.6

OS / Environment

Cloudvision version

2018 and 2019

Steps to reproduce

- name: Get latest configlets from CVP
  arista.cvp.cv_facts:
    facts:
      - configlets

With variables :

ansible_connection: httpapi
ansible_network_os: eos
ansible_httpapi_use_ssl: True
ansible_httpapi_validate_certs: False
ansible_user: "user"
ansible_password: "notthecorrectpassword"
ansible_httpapi_host: "192.168.122.2"
ansible_host: "443"
ansible_httpapi_port: "443"

Expected results

TASK [leaf/underlay : Get latest configlets from CVP] ***********************************************************************************************************************************************************
fatal: [host-01]: FAILED! => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python"}, "changed": false, "msg": "\n192.168.122.2: Authenticate: https://192.168.122.2:443/web/login/authenticate.do: Request Error: Invalid credentials\n"}

Actual results

TASK [leaf/underlay : Get latest configlets from CVP] ***********************************************************************************************************************************************************
fatal: [host-01]: FAILED! => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python"}, "changed": false, "msg": "\n192.168.122.2: Authenticate: http://192.168.122.2:443/web/login/authenticate.do: Request Error: Bad Request\n"}

Note the HTTP vs HTTPS on port 443.

The expected result was actually obtained running code from this branch : master...b-abadie:fix-bad-requests
But this is not PR-worthy material. In fact I am not quite sure how to fix, this is why I am only submitting an issue and not a PR.

@b-abadie b-abadie added the status: Triage New incoming issue label Apr 22, 2020
titom73 added a commit that referenced this issue Apr 22, 2020
@titom73 titom73 self-assigned this Apr 22, 2020
@titom73 titom73 added module_utils: cv_client cv_client implementation issue state: accepted Issue is part of the development roadmap status: in-progress Currently under investigation or implementation and removed status: Triage New incoming issue labels Apr 22, 2020
@titom73 titom73 added this to the v1.1 milestone Apr 22, 2020
@titom73 titom73 linked a pull request Apr 23, 2020 that will close this issue
3 tasks
@titom73 titom73 added status: testing PR under testing and removed status: in-progress Currently under investigation or implementation labels Apr 23, 2020
@titom73
Copy link
Contributor

titom73 commented Apr 23, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module_utils: cv_client cv_client implementation issue state: accepted Issue is part of the development roadmap status: testing PR under testing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants