Bug 2059099 - create_firewall_rule: error: argument --ip-version: invalid choice: 5 (choose from 4, 6)
Summary: create_firewall_rule: error: argument --ip-version: invalid choice: 5 (choose...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat OpenStack
Classification: Red Hat
Component: python-neutronclient
Version: 17.0 (Wallaby)
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ga
: 17.0
Assignee: Miguel Lavalle
QA Contact: Fiorella Yanac
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-02-28 08:15 UTC by Arie Bregman
Modified: 2022-09-21 12:19 UTC (History)
8 users (show)

Fixed In Version: python-neutronclient-7.3.0-0.20220707060727.4963c7a.el9ost
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-09-21 12:19:32 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
OpenStack gerrit 834930 0 None stable/wallaby: MERGED python-neutronclient: Use yaml.safe_load instead of yaml.load (Ibe25c4aaf3aa7226f28ec60b8a929ecc143face1) 2022-07-06 14:45:40 UTC
OpenStack gerrit 834942 0 None stable/wallaby: MERGED python-neutronclient: tests: change safe_hasattr to hasattr (I4fe6fabc4f745e2c9a366e30dbea7e7200151f12) 2022-07-06 14:45:45 UTC
Red Hat Issue Tracker OSP-13205 0 None None None 2022-02-28 08:19:17 UTC
Red Hat Product Errata RHEA-2022:6543 0 None None None 2022-09-21 12:19:50 UTC

Description Arie Bregman 2022-02-28 08:15:12 UTC
Unit tests fail in OSP 17 CI:


2022-02-28 07:28:38.759990 | container | Captured traceback:
2022-02-28 07:28:38.759996 | container | ~~~~~~~~~~~~~~~~~~~
2022-02-28 07:28:38.760003 | container |     Traceback (most recent call last):
2022-02-28 07:28:38.760009 | container |
2022-02-28 07:28:38.760015 | container |       File "/root/src/.../python-neutronclient/neutronclient/tests/unit/test_cli20.py", line 1214, in test_list_resources_yaml
2022-02-28 07:28:38.760021 | container |     data = yaml.load(''.join(self.fake_stdout.content))
2022-02-28 07:28:38.760028 | container |
2022-02-28 07:28:38.760034 | container |     TypeError: load() missing 1 required positional argument: 'Loader'
2022-02-28 07:28:38.760048 | container |
2022-02-28 07:28:38.760054 | container |
2022-02-28 07:28:38.760060 | container | neutronclient.tests.unit.test_cli20.CLITestV20OutputFormatter.test_show_resource_yaml
2022-02-28 07:28:38.760075 | container | -------------------------------------------------------------------------------------

To reproduce:

1. Clone the project
2. Checkout OSP 17 branch
3. Run unit tests (py39)

Comment 2 Miguel Lavalle 2022-03-09 00:36:24 UTC
There are two types of failures happening in the python-neutronclient unit tests:

1) "load() missing 1 required positional argument: 'Loader'" with some test cases in neutronclient.tests.unit.test_cli20.CLITestV20OutputFormatter. The problem is that PyYAML yaml.load() requires now a second argument, 'Loader'. This was fixed in upstream master with https://review.opendev.org/c/openstack/python-neutronclient/+/801224, but it wasn't backported to Wallaby. This is because in upstream Wallaby the unit tests are executed in a py38 environment: https://github.com/openstack/python-neutronclient/blob/c58eaf1b15e8b68dd8579f68cac940e7909fe7ef/tox.ini#L2. The version of PyYAML in this py38 environment had deprecated calling yaml.load() without the second argument 'Loader', but still supported it. That is not the case in py39, which is what we are using downstream to run these tests.

2) "AttributeError: module 'testtools.helpers' has no attribute 'safe_hasattr'" with some test cases in neutronclient.tests.unit.test_command_meta.TestCommandMeta. The problem in this case is that testtools 2.5.0 removed the utility function 'safe_hasattr' as explained here: https://github.com/testing-cabal/testtools/blob/2.5.0/NEWS#L31. Again, the problem was fixed in upstream master with https://review.opendev.org/c/openstack/python-neutronclient/+/802306, but it wasn't backported to Wallaby. So, again, we find this issue because we are running these test cases in a py39 environment, whereas upstream Wallaby uses a py38 environment.

So the question here is why don't we align ourselves with upstream and run these unit tests in a py38 environment?

Comment 3 Arie Bregman 2022-03-22 06:39:17 UTC
(In reply to Miguel Lavalle from comment #2)
> There are two types of failures happening in the python-neutronclient unit
> tests:
> 
> 1) "load() missing 1 required positional argument: 'Loader'" with some test
> cases in neutronclient.tests.unit.test_cli20.CLITestV20OutputFormatter. The
> problem is that PyYAML yaml.load() requires now a second argument, 'Loader'.
> This was fixed in upstream master with
> https://review.opendev.org/c/openstack/python-neutronclient/+/801224, but it
> wasn't backported to Wallaby. This is because in upstream Wallaby the unit
> tests are executed in a py38 environment:
> https://github.com/openstack/python-neutronclient/blob/
> c58eaf1b15e8b68dd8579f68cac940e7909fe7ef/tox.ini#L2. The version of PyYAML
> in this py38 environment had deprecated calling yaml.load() without the
> second argument 'Loader', but still supported it. That is not the case in
> py39, which is what we are using downstream to run these tests.
> 
> 2) "AttributeError: module 'testtools.helpers' has no attribute
> 'safe_hasattr'" with some test cases in
> neutronclient.tests.unit.test_command_meta.TestCommandMeta. The problem in
> this case is that testtools 2.5.0 removed the utility function
> 'safe_hasattr' as explained here:
> https://github.com/testing-cabal/testtools/blob/2.5.0/NEWS#L31. Again, the
> problem was fixed in upstream master with
> https://review.opendev.org/c/openstack/python-neutronclient/+/802306, but it
> wasn't backported to Wallaby. So, again, we find this issue because we are
> running these test cases in a py39 environment, whereas upstream Wallaby
> uses a py38 environment.
> 
> So the question here is why don't we align ourselves with upstream and run
> these unit tests in a py38 environment?

We run the tests from OSP 17 branch, not Wallaby. OSP 17 as far as I know is going to be released using Python 3.9

Comment 4 Miguel Lavalle 2022-03-23 21:58:44 UTC
Arie,

Thanks for your response. I have started the back-porting of the necessary changes to the test cases upstream:

https://review.opendev.org/c/openstack/python-neutronclient/+/834930

https://review.opendev.org/c/openstack/python-neutronclient/+/834942

Comment 5 Bernard Cafarelli 2022-06-17 08:31:22 UTC
wallaby backport is merged

Comment 13 errata-xmlrpc 2022-09-21 12:19:32 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Release of components for Red Hat OpenStack Platform 17.0 (Wallaby)), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2022:6543


Note You need to log in before you can comment on or make changes to this bug.