sunbeam-clusterd: requests.exceptions.InvalidURL: Not supported URL scheme http+unix

Bug #2066540 reported by Chris Johnston
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Sunbeam Charms
Confirmed
Undecided
Unassigned

Bug Description

It looks like a change to requests [1] has broken sunbeam-clusterd.

unit-sunbeam-clusterd-0: 23:10:53 ERROR unit.sunbeam-clusterd/0.juju-log Uncaught exception while in charm code:
Traceback (most recent call last):
  File "/var/lib/juju/agents/unit-sunbeam-clusterd-0/charm/venv/requests/adapters.py", line 555, in send
    conn = self.get_connection_with_tls_context(
  File "/var/lib/juju/agents/unit-sunbeam-clusterd-0/charm/venv/requests/adapters.py", line 411, in get_connection_with_tls_context
    conn = self.poolmanager.connection_from_host(
  File "/var/lib/juju/agents/unit-sunbeam-clusterd-0/charm/venv/urllib3/poolmanager.py", line 246, in connection_from_host
    return self.connection_from_context(request_context)
  File "/var/lib/juju/agents/unit-sunbeam-clusterd-0/charm/venv/urllib3/poolmanager.py", line 258, in connection_from_context
    raise URLSchemeUnknown(scheme)
urllib3.exceptions.URLSchemeUnknown: Not supported URL scheme http+unix

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/var/lib/juju/agents/unit-sunbeam-clusterd-0/charm/./src/charm.py", line 484, in <module>
    main(SunbeamClusterdCharm)
  File "/var/lib/juju/agents/unit-sunbeam-clusterd-0/charm/venv/ops/main.py", line 544, in main
    manager.run()
  File "/var/lib/juju/agents/unit-sunbeam-clusterd-0/charm/venv/ops/main.py", line 520, in run
    self._emit()
  File "/var/lib/juju/agents/unit-sunbeam-clusterd-0/charm/venv/ops/main.py", line 506, in _emit
    self.framework.reemit()
  File "/var/lib/juju/agents/unit-sunbeam-clusterd-0/charm/venv/ops/framework.py", line 859, in reemit
    self._reemit()
  File "/var/lib/juju/agents/unit-sunbeam-clusterd-0/charm/venv/ops/framework.py", line 939, in _reemit
    custom_handler(event)
  File "/var/lib/juju/agents/unit-sunbeam-clusterd-0/charm/./src/charm.py", line 101, in _on_install
    self.clusterd_ready()
  File "/var/lib/juju/agents/unit-sunbeam-clusterd-0/charm/venv/tenacity/__init__.py", line 330, in wrapped_f
    return self(f, *args, **kw)
  File "/var/lib/juju/agents/unit-sunbeam-clusterd-0/charm/venv/tenacity/__init__.py", line 467, in __call__
    do = self.iter(retry_state=retry_state)
  File "/var/lib/juju/agents/unit-sunbeam-clusterd-0/charm/venv/tenacity/__init__.py", line 368, in iter
    result = action(retry_state)
  File "/var/lib/juju/agents/unit-sunbeam-clusterd-0/charm/venv/tenacity/__init__.py", line 390, in <lambda>
    self._add_action_func(lambda rs: rs.outcome.result())
  File "/usr/lib/python3.10/concurrent/futures/_base.py", line 451, in result
    return self.__get_result()
  File "/usr/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
    raise self._exception
  File "/var/lib/juju/agents/unit-sunbeam-clusterd-0/charm/venv/tenacity/__init__.py", line 470, in __call__
    result = fn(*args, **kwargs)
  File "/var/lib/juju/agents/unit-sunbeam-clusterd-0/charm/./src/charm.py", line 234, in clusterd_ready
    if not self._clusterd.ready():
  File "/var/lib/juju/agents/unit-sunbeam-clusterd-0/charm/src/clusterd.py", line 91, in ready
    self._get("cluster/1.0/ready")
  File "/var/lib/juju/agents/unit-sunbeam-clusterd-0/charm/src/clusterd.py", line 80, in _get
    return self._request("get", path, **kwargs)
  File "/var/lib/juju/agents/unit-sunbeam-clusterd-0/charm/src/clusterd.py", line 57, in _request
    response = self._session.request(method=method, url=url, **kwargs)
  File "/var/lib/juju/agents/unit-sunbeam-clusterd-0/charm/venv/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
  File "/var/lib/juju/agents/unit-sunbeam-clusterd-0/charm/venv/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
  File "/var/lib/juju/agents/unit-sunbeam-clusterd-0/charm/venv/requests/adapters.py", line 559, in send
    raise InvalidURL(e, request=request)
requests.exceptions.InvalidURL: Not supported URL scheme http+unix
unit-sunbeam-clusterd-0: 23:10:53 ERROR juju.worker.uniter.operation hook "install" (via hook dispatching script: dispatch) failed: exit status 1

[1] https://github.com/psf/requests/issues/6707

Tags: in-main
Revision history for this message
Chris Johnston (cjohnston) wrote :

This is also causing issues for pylxd [1]. A PR has been created for requests-unixsocket [2] to resolve the issue, but requests-unixsocket appears to not be maintained anymore.

[1] https://github.com/canonical/pylxd/issues/579
[2] https://github.com/msabramo/requests-unixsocket/pull/72

Revision history for this message
Nobuto Murata (nobuto) wrote (last edit ):

Can confirm.

Downgrading to an older revision makes it work but obviously it will miss fixes since then.

$ juju refresh -m controller sunbeam-clusterd --revision 16 --force-units

Not sure the manifest file accepts a revision in addition to a channel though.

software:
  charms:
    sunbeam-clusterd:
      channel: 2024.1/edge
      # LP: #2066540
      revision: 16
      config:
        snap-channel: 2024.1/edge

Changed in sunbeam-charms:
status: New → Confirmed
Revision history for this message
Chris Johnston (cjohnston) wrote :

I wasn't able to get revision to work even though the docs state it works. Haven't dug into it yet.

Revision history for this message
Nobuto Murata (nobuto) wrote :
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to sunbeam-charms (main)

Related fix proposed to branch: main
Review: https://review.opendev.org/c/openstack/sunbeam-charms/+/920300

Revision history for this message
Nobuto Murata (nobuto) wrote :

My current hack just to continue the other part of the testing is the following. It's with good old days of Juju-wait to detect a charm hook failure then downgrading the charm :-)

# LP: #2066540
sunbeam cluster bootstrap --manifest manifest.yaml &
    snap install --classic juju-wait
    until juju status -m controller; do
        sleep 10
    done
    if ! juju-wait -m controller -w; then
        juju refresh -m controller sunbeam-clusterd --revision 16 --force-units
    fi
wait

sunbeam cluster deploy --manifest manifest.yaml

Revision history for this message
Nobuto Murata (nobuto) wrote :

pep8 fails out of the box, and looks like it's blocking the gate
https://bugs.launchpad.net/sunbeam-charms/+bug/2067248

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to sunbeam-charms (main)

Reviewed: https://review.opendev.org/c/openstack/sunbeam-charms/+/920300
Committed: https://opendev.org/openstack/sunbeam-charms/commit/9663868d14a974420001d96e5052dd6ce919b09a
Submitter: "Zuul (22348)"
Branch: main

commit 9663868d14a974420001d96e5052dd6ce919b09a
Author: Chris Johnston <email address hidden>
Date: Thu May 23 16:07:01 2024 +0000

    Pin requests < 2.32.0 in sunbeam-clusted.

    This is only needed until LP: #2066540 is full addressed.

    Also, add "assertIn" into the ignore-words-list not to block the gate
    testing.

    Related-Bug: 2066540
    Change-Id: I6c6686ea4ce5a745e9f86bb9e055d42919f10a50

tags: added: in-main
Changed in sunbeam-charms:
assignee: nobody → Chris Johnston (cjohnston)
assignee: Chris Johnston (cjohnston) → nobody
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.