← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1945866] [NEW] Type error in oslo_middleware/debug.py

 

Public bug reported:

[Keystone 19.0.0]

With this command:
openstack --os-auth-url http://localhost:5000/v3 --os-project-domain-name Default --os-user-domain-name Default --os-project-name admin --os-username admin token issue

I obtain the following error:
[Sat Oct 02 15:49:21.525766 2021] [wsgi:error] [pid 208338:tid 140023572661824] [remote 127.0.0.1:52344] mod_wsgi (pid=208338): Exception occurred processing WSGI script '/openstack/ENV/bin
/keystone-wsgi-public'.
[Sat Oct 02 15:49:21.525868 2021] [wsgi:error] [pid 208338:tid 140023572661824] [remote 127.0.0.1:52344] Traceback (most recent call last):
[Sat Oct 02 15:49:21.525879 2021] [wsgi:error] [pid 208338:tid 140023572661824] [remote 127.0.0.1:52344]   File "/openstack/ENV/lib/python3.9/site-packages/oslo_middleware/debug.py", line 5
5, in print_generator
[Sat Oct 02 15:49:21.525881 2021] [wsgi:error] [pid 208338:tid 140023572661824] [remote 127.0.0.1:52344]     sys.stdout.write(part)
[Sat Oct 02 15:49:21.525887 2021] [wsgi:error] [pid 208338:tid 140023572661824] [remote 127.0.0.1:52344] TypeError: write() argument must be str, not bytes

Patching the file oslo_middleware/debug.py the error disappears:
    @staticmethod
    def print_generator(app_iter):
        """Prints the contents of a wrapper string iterator when iterated."""
        print(("*" * 40) + " BODY")
        for part in app_iter:
            print(type(part))
            sys.stdout.write(str(part))  # <=== note str(...)!
            sys.stdout.flush()
            yield part
        print()

** Affects: keystone
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Identity (keystone).
https://bugs.launchpad.net/bugs/1945866

Title:
  Type error in oslo_middleware/debug.py

Status in OpenStack Identity (keystone):
  New

Bug description:
  [Keystone 19.0.0]

  With this command:
  openstack --os-auth-url http://localhost:5000/v3 --os-project-domain-name Default --os-user-domain-name Default --os-project-name admin --os-username admin token issue

  I obtain the following error:
  [Sat Oct 02 15:49:21.525766 2021] [wsgi:error] [pid 208338:tid 140023572661824] [remote 127.0.0.1:52344] mod_wsgi (pid=208338): Exception occurred processing WSGI script '/openstack/ENV/bin
  /keystone-wsgi-public'.
  [Sat Oct 02 15:49:21.525868 2021] [wsgi:error] [pid 208338:tid 140023572661824] [remote 127.0.0.1:52344] Traceback (most recent call last):
  [Sat Oct 02 15:49:21.525879 2021] [wsgi:error] [pid 208338:tid 140023572661824] [remote 127.0.0.1:52344]   File "/openstack/ENV/lib/python3.9/site-packages/oslo_middleware/debug.py", line 5
  5, in print_generator
  [Sat Oct 02 15:49:21.525881 2021] [wsgi:error] [pid 208338:tid 140023572661824] [remote 127.0.0.1:52344]     sys.stdout.write(part)
  [Sat Oct 02 15:49:21.525887 2021] [wsgi:error] [pid 208338:tid 140023572661824] [remote 127.0.0.1:52344] TypeError: write() argument must be str, not bytes

  Patching the file oslo_middleware/debug.py the error disappears:
      @staticmethod
      def print_generator(app_iter):
          """Prints the contents of a wrapper string iterator when iterated."""
          print(("*" * 40) + " BODY")
          for part in app_iter:
              print(type(part))
              sys.stdout.write(str(part))  # <=== note str(...)!
              sys.stdout.flush()
              yield part
          print()

To manage notifications about this bug go to:
https://bugs.launchpad.net/keystone/+bug/1945866/+subscriptions