Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
gmuloc committed Jun 7, 2024
1 parent 5d50a3b commit 7932fb2
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions anta/cli/get/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,17 @@ def from_cvp(ctx: click.Context, output: Path, host: str, username: str, passwor
TODO - handle get_inventory and get_devices_in_container failure
"""
logger.info("Getting authentication token for user '%s' from CloudVision instance '%s'", username, host)
token = get_cv_token(cvp_ip=host, cvp_username=username, cvp_password=password, verify_cert=not ignore_cert)
is_cvaas = False
# TODO: This is not nice handling of authentication failure nor CVaaS detection
try:
token = get_cv_token(cvp_ip=host, cvp_username=username, cvp_password=password, verify_cert=not ignore_cert)
except Exception:
token = password
is_cvaas = True

clnt = CvpClient()
try:
clnt.connect(nodes=[host], username="", password="", api_token=token)
clnt.connect(nodes=[host], username="", password="", api_token=token, is_cvaas=is_cvaas)
except CvpApiError as error:
logger.error("Error connecting to CloudVision: %s", error)
ctx.exit(ExitCode.USAGE_ERROR)
Expand Down

0 comments on commit 7932fb2

Please sign in to comment.