You have been subscribed to a public bug by Heather Lemon (hypothetical-lemon):

[Impact]
We cannot decode payloads sent to etcd in Python3. 
Which means key, value pairs can not longer be accessed. 

Both iter_content and the first line of the loop in the
etcd3gw watch code were decoding the chunk received.

Thus, etcd3gw's watch is broken in python3.  This commit
fixes it by only decoding the line once.

[Test Plan]
Run unittests, ensure success 


In python2, this works fine:
```
$ python2 -c "print(b'hello_world'.decode().decode('utf-8'))"
hello_world
```

In python3, it raises an AttributeError:
```
$ python3 -c "print(b'hello_world'.decode().decode('utf-8'))"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
AttributeError: 'str' object has no attribute 'decode'
```

[Regression potential]
unit test failure, 
Which means key, value pairs can not longer be accessed. 

In bionic patch, applying the patch fails the unit tests in Python27.
This is fixed by fixing the imports to:
+-from unittest import mock
++from mock import patch, MagicMock

[Other Info]
Link to upstream patch: 
https://opendev.org/openstack/etcd3gw/commit/ed899b34e464862525f76fff2377a2cceeb65af7

python-etcd3gw-0.2.5 (focal)

** Affects: python-etcd3gw (Ubuntu)
     Importance: High
     Assignee: Heather Lemon (hypothetical-lemon)
         Status: In Progress

** Affects: python-etcd3gw (Ubuntu Bionic)
     Importance: High
     Assignee: Heather Lemon (hypothetical-lemon)
         Status: In Progress

** Affects: python-etcd3gw (Ubuntu Focal)
     Importance: High
     Assignee: Heather Lemon (hypothetical-lemon)
         Status: In Progress

** Affects: python-etcd3gw (Ubuntu Impish)
     Importance: High
     Assignee: Heather Lemon (hypothetical-lemon)
         Status: In Progress

** Affects: python-etcd3gw (Ubuntu Jammy)
     Importance: High
     Assignee: Heather Lemon (hypothetical-lemon)
         Status: In Progress


** Tags: patch sts-sponsor verification-needed-bionic verification-needed-focal 
verification-needed-impish verification-needed-jammy
-- 
upstream patch from opendev - double encoding-decoding
https://bugs.launchpad.net/bugs/1965325
You received this bug notification because you are a member of STS Sponsors, 
which is subscribed to the bug report.

-- 
Mailing list: https://launchpad.net/~sts-sponsors
Post to     : sts-sponsors@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sts-sponsors
More help   : https://help.launchpad.net/ListHelp

Reply via email to