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

Update AL endpoint based on user account not working for testing use cases #103

Open
raghavkarol opened this issue Oct 26, 2021 · 4 comments
Assignees

Comments

@raghavkarol
Copy link
Contributor

Description

Updating the url based on customer residency does not work for test use cases. For example,

$ cat ~/.alertlogic/config

[aetuner_int]
access_key_id=skip
secret_key=skip
global_endpoint=localhost3001

$ cat api/aetuner.v1.yaml

...
servers:
  - url: 'https://aetuner.mdr.global.alertlogic.com'
    x-alertlogic-global-endpoint: production
    description: production
  - url: 'https://aetuner.mdr.product.dev.alertlogic.com'
    x-alertlogic-global-endpoint: integration
    description: integration
  - url: 'http://localhost:3000'
    x-alertlogic-global-endpoint: localhost3000
    description: localhost on port 3000
...

$  _venv/bin/alcli --profile aetuner_int aetuner get_analytic --account_id $account_id --path ngx/SuspConfCng/AwsPacu --enable_new=1

Traceback (most recent call last):
  File "/Users/rkarol-admin/github/alertlogic/aetuner/_venv/lib/python3.7/site-packages/alcli/alertlogic_cli.py", line 116, in main
    return services[parsed_args.service](remaining, parsed_args)
  File "/Users/rkarol-admin/github/alertlogic/aetuner/_venv/lib/python3.7/site-packages/alcli/alertlogic_cli.py", line 199, in __call__
    res = operation(**op_args)
  File "/Users/rkarol-admin/github/alertlogic/aetuner/_venv/lib/python3.7/site-packages/almdrlib/client.py", line 619, in __call__
    return self._call(*args, **kwargs)
  File "/Users/rkarol-admin/github/alertlogic/aetuner/_venv/lib/python3.7/site-packages/almdrlib/client.py", line 586, in f
    self._server.update_url(account_id)
  File "/Users/rkarol-admin/github/alertlogic/aetuner/_venv/lib/python3.7/site-packages/almdrlib/client.py", line 52, in update_url
    self._url = self._session.get_url(self._service_name, account_id)
  File "/Users/rkarol-admin/github/alertlogic/aetuner/_venv/lib/python3.7/site-packages/almdrlib/session.py", line 260, in get_url
    self.residency),
  File "/Users/rkarol-admin/github/alertlogic/aetuner/_venv/lib/python3.7/site-packages/almdrlib/session.py", line 304, in request
    **kwargs)
  File "/Users/rkarol-admin/github/alertlogic/aetuner/_venv/lib/python3.7/site-packages/requests/sessions.py", line 528, in request
    prep = self.prepare_request(req)
  File "/Users/rkarol-admin/github/alertlogic/aetuner/_venv/lib/python3.7/site-packages/requests/sessions.py", line 466, in prepare_request
    hooks=merge_hooks(request.hooks, self.hooks),
  File "/Users/rkarol-admin/github/alertlogic/aetuner/_venv/lib/python3.7/site-packages/requests/models.py", line 316, in prepare
    self.prepare_url(url, params)
  File "/Users/rkarol-admin/github/alertlogic/aetuner/_venv/lib/python3.7/site-packages/requests/models.py", line 390, in prepare_url
    raise MissingSchema(error)
requests.exceptions.MissingSchema: Invalid URL 'localhost3001/endpoints/v1/134255110/residency/default/services/aetuner/endpoint': No schema supplied. Perhaps you meant http://localhost3001/endpoints/v1/134255110/residency/default/services/aetuner/endpoint?

In these cases update_url here should not update the URL based on the customer residency.

@anton-b anton-b self-assigned this Oct 27, 2021
@raghavkarol
Copy link
Contributor Author

@anton-b have you had a chance to look into this issue? we currently have a workaround for it which involves monkey patching of files but would like to get rid of it?

@anton-b
Copy link
Contributor

anton-b commented Nov 29, 2021

hey, haven't had a chance to look into it, will try to find time soon

@motobob motobob assigned carlisom and pavel-puchkin and unassigned anton-b Aug 4, 2022
@motobob
Copy link
Contributor

motobob commented Aug 4, 2022

@carlisom
Copy link
Contributor

@raghavkarol, would the solution used in #61 work for you? Adding in the local service URLs via a map file?

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

No branches or pull requests

5 participants