module 'werkzeug.wsgi' has no attribute 'DispatcherMiddleware'

Bug #1917911 reported by Doug Szumski
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloudkitty (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

When calling the CloudKitty API using victoria release I get the following error:

```
(openstack) [stack@cranky ~]$ cloudkitty module list
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>500 Internal Server Error</title>
</head><body>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error or
misconfiguration and was unable to complete
your request.</p>
<p>Please contact the server administrator at
 root@localhost to inform them of the time this error occurred,
 and the actions you performed just before this error.</p>
<p>More information about this error may be available
in the server error log.</p>
</body></html>
 (HTTP 500)
```

In the logs I see:

```

==> cloudkitty-api-error.log <==
[Fri Mar 05 15:47:56.212556 2021] [wsgi:error] [pid 29:tid 139710101341952] [remote 10.103.1.12:50752] return self.object_type.invoke(self)
[Fri Mar 05 15:47:56.212563 2021] [wsgi:error] [pid 29:tid 139710101341952] [remote 10.103.1.12:50752] File "/var/lib/kolla/venv/lib/python3.6/site-packages
/paste/deploy/loadwsgi.py", line 152, in invoke
[Fri Mar 05 15:47:56.212572 2021] [wsgi:error] [pid 29:tid 139710101341952] [remote 10.103.1.12:50752] return fix_call(context.object, context.global_conf
, **context.local_conf)
[Fri Mar 05 15:47:56.212581 2021] [wsgi:error] [pid 29:tid 139710101341952] [remote 10.103.1.12:50752] File "/var/lib/kolla/venv/lib/python3.6/site-packages
/paste/deploy/util.py", line 55, in fix_call
[Fri Mar 05 15:47:56.212585 2021] [wsgi:error] [pid 29:tid 139710101341952] [remote 10.103.1.12:50752] val = callable(*args, **kw)
[Fri Mar 05 15:47:56.212595 2021] [wsgi:error] [pid 29:tid 139710101341952] [remote 10.103.1.12:50752] File "/var/lib/kolla/venv/lib/python3.6/site-packages
/cloudkitty/api/app.py", line 99, in app_factory
[Fri Mar 05 15:47:56.212604 2021] [wsgi:error] [pid 29:tid 139710101341952] [remote 10.103.1.12:50752] return setup_app()
[Fri Mar 05 15:47:56.212611 2021] [wsgi:error] [pid 29:tid 139710101341952] [remote 10.103.1.12:50752] File "/var/lib/kolla/venv/lib/python3.6/site-packages
/cloudkitty/api/app.py", line 72, in setup_app
[Fri Mar 05 15:47:56.212616 2021] [wsgi:error] [pid 29:tid 139710101341952] [remote 10.103.1.12:50752] app = wsgi.DispatcherMiddleware(root_app, dispatch_
dict)
[Fri Mar 05 15:47:56.212639 2021] [wsgi:error] [pid 29:tid 139710101341952] [remote 10.103.1.12:50752] AttributeError: module 'werkzeug.wsgi' has no attribute
 'DispatcherMiddleware'

```

I can fix this by changing the way that DispatcherMiddleware is imported.

I see that Werkzeug==1.0.1 is installed, according to upper constraints:
https://github.com/openstack/requirements/blob/stable/victoria/upper-constraints.txt

If I downgrade Werkzeug to 0.16.0, the DispatcherMiddleware is loaded:

```
(openstack) [stack@cranky ~]$ cloudkitty module list
+-----------+---------+----------+
| Module | Enabled | Priority |
+-----------+---------+----------+
| hashmap | False | 1 |
| noop | True | 1 |
| pyscripts | False | 1 |

```

The regression appears to have occurred with the 0.16.1 release of Werkzeug (used in Ussuri onwards).

Revision history for this message
Doug Szumski (dszumski) wrote :

The current code uses a deprecated method to import DispatcherMiddleware, see this for more details:

https://github.com/pallets/werkzeug/issues/1663

Revision history for this message
Doug Szumski (dszumski) wrote :

This has been fixed here, and the patch exists in stable/victoria:
https://review.opendev.org/c/openstack/cloudkitty/+/691310

This issue was traced to an old release being installed.

Changed in cloudkitty (Ubuntu):
status: New → Invalid
Revision history for this message
Doug Szumski (dszumski) wrote :

Marked invalid.

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.