Skip to content

fix: ask for the management token through the workload's proxy - #69

Open
nsklikas wants to merge 1 commit into
mainfrom
token-request-through-proxy
Open

nsklikas wants to merge 1 commit into
mainfrom
token-request-through-proxy

Conversation

@nsklikas

Copy link
Copy Markdown
Collaborator

Problem

The actions ask Hydra for the management token from the charm container, with requests, with no proxy and no timeout. Juju gives the model's proxy settings to the charm as JUJU_CHARM_*_PROXY, which requests does not read. In a model whose only way out is an HTTP proxy, the request waits until the kernel's connect timeout (about two minutes), _get_management_token() returns None, and the CLI runs with --token no-token. The action then fails with invalid token. Fixes #68.

Change

  • The token request uses the proxy the operator already gives the workload: the https_proxy option, or http_proxy for an http endpoint. When no_proxy names the endpoint's host, it goes without the proxy.
  • The token request has a timeout of 10 seconds.
  • CharmConfig.get_proxy_config() returns the three options for the charm's own requests.

With the options unset, nothing changes but the timeout.

Tests

  • tests/unit/test_clients.py (new): the request goes through the proxy, or not when no_proxy names the host, and has the timeout.
  • tests/unit/test_configs.py: get_proxy_config().
  • Unit tests and lint locally. Three tests of test_charm.py fail on main as they are (InconsistentScenarioError, the pebble-ready container), with and without this change.

@nsklikas
nsklikas requested a review from a team as a code owner October 16, 2026 11:35
@nsklikas
nsklikas force-pushed the token-request-through-proxy branch from c54a5c8 to 3e3e5c2 Compare November 19, 2026 13:59
The actions asked Hydra for their token from the charm container with no
proxy and no timeout. Where the only way out is a proxy, the request hung
until the kernel's connect timeout and the CLI then ran with no token.
The request now goes through the http_proxy and https_proxy options,
unless no_proxy names the endpoint's host, and has a timeout of 10 s.

Fixes #68
@nsklikas
nsklikas force-pushed the token-request-through-proxy branch from 3e3e5c2 to ae1b4a6 Compare November 23, 2026 14:37
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.

Actions fail behind an HTTP proxy: the management token request ignores the model's proxy settings

1 participant