Bug 2049615

Summary: Linting issues in python-octavia-lib regarding f-strings and dict items
Product: Red Hat OpenStack Reporter: Szymon Datko <sdatko>
Component: python-octavia-libAssignee: OSP Team <rhos-maint>
Status: CLOSED ERRATA QA Contact: Nikolai Ilushko <nilushko>
Severity: low Docs Contact:
Priority: low    
Version: 17.0 (Wallaby)CC: gthiemon, ihrachys, lpeer, majopela, nilushko, scohen
Target Milestone: gaKeywords: Triaged
Target Release: 17.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-octavia-lib-2.3.1-0.20220222141011.3208f7f.el9ost Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-09-21 12:18:58 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Szymon Datko 2022-02-02 13:13:40 UTC
There are failures in pep8 job for OSP-17.0 in python-octavia-lib project.

```
...
6852022-01-25 23:30:53.206947 | container | [7;33m************* Module octavia_lib.api.drivers.data_models[0m
6852022-01-25 23:30:53.206954 | container | octavia_lib/api/drivers/data_models.py:25:8: C0206: [1mConsider iterating with .items()[0m ([1mconsider-using-dict-items[0m)
6862022-01-25 23:30:53.206961 | container | [7;33m************* Module octavia_lib.api.drivers.driver_lib[0m
6872022-01-25 23:30:53.206968 | container | octavia_lib/api/drivers/driver_lib.py:43:30: C0209: [1mFormatting a regular string which could be a f-string[0m ([1mconsider-using-f-string[0m)
6882022-01-25 23:30:53.206976 | container | octavia_lib/api/drivers/driver_lib.py:68:34: C0209: [1mFormatting a regular string which could be a f-string[0m ([1mconsider-using-f-string[0m)
6892022-01-25 23:30:53.206996 | container | octavia_lib/api/drivers/driver_lib.py:82:34: C0209: [1mFormatting a regular string which could be a f-string[0m ([1mconsider-using-f-string[0m)
6902022-01-25 23:30:53.207003 | container | octavia_lib/api/drivers/driver_lib.py:94:22: C0209: [1mFormatting a regular string which could be a f-string[0m ([1mconsider-using-f-string[0m)
6912022-01-25 23:30:53.207011 | container | [7;33m************* Module octavia_lib.hacking.checks[0m
6922022-01-25 23:30:53.207020 | container | octavia_lib/hacking/checks.py:85:16: C0209: [1mFormatting a regular string which could be a f-string[0m ([1mconsider-using-f-string[0m)
6932022-01-25 23:30:53.207028 | container | octavia_lib/hacking/checks.py:90:15: C0209: [1mFormatting a regular string which could be a f-string[0m ([1mconsider-using-f-string[0m)
6942022-01-25 23:30:53.207035 | container | octavia_lib/hacking/checks.py:92:33: C0209: [1mFormatting a regular string which could be a f-string[0m ([1mconsider-using-f-string[0m)
6952022-01-25 23:30:53.207042 | container | octavia_lib/hacking/checks.py:96:15: C0209: [1mFormatting a regular string which could be a f-string[0m ([1mconsider-using-f-string[0m)
6962022-01-25 23:30:53.207049 | container | octavia_lib/hacking/checks.py:99:16: C0209: [1mFormatting a regular string which could be a f-string[0m ([1mconsider-using-f-string[0m)
6972022-01-25 23:30:53.207055 | container | octavia_lib/hacking/checks.py:99:47: C0209: [1mFormatting a regular string which could be a f-string[0m ([1mconsider-using-f-string[0m)
6982022-01-25 23:30:53.207062 | container | octavia_lib/hacking/checks.py:103:15: C0209: [1mFormatting a regular string which could be a f-string[0m ([1mconsider-using-f-string[0m)
...
```

After research, I found these issues were recently resolved in upstream master branch by introducing the following changes:
– https://review.opendev.org/c/openstack/octavia-lib/+/810892https://review.opendev.org/c/openstack/octavia-lib/+/791925

Both should be cherry-picked to the downstream repository (excluding the change to tox.ini from the second link [change 791925]).

Comment 6 Nikolai Ilushko 2022-07-20 12:31:58 UTC
Verified after running the following commands: 

# Puddle version:
[stack@undercloud-0 ~]$ cat /var/lib/rhos-release/latest-installed
17.0 -p RHOS-17.0-RHEL-9-20220714.n.1

# 1. Cloning the repo 

[stack@undercloud-0 ~]$ git clone https://code.engineering.redhat.com/gerrit/python-octavia-lib.git
Cloning into 'python-octavia-lib'...
remote: Counting objects: 26, done
remote: Total 845 (delta 0), reused 845 (delta 0)
Receiving objects: 100% (845/845), 146.50 KiB | 264.00 KiB/s, done.
Resolving deltas: 100% (400/400), done.
warning: remote HEAD refers to nonexistent ref, unable to checkout.

[stack@undercloud-0 ~]$ cd python-octavia-lib

[stack@undercloud-0 python-octavia-lib]$ git checkout rhos-17.0-trunk-patches
Branch 'rhos-17.0-trunk-patches' set up to track remote branch 'rhos-17.0-trunk-patches' from 'origin'.
Switched to a new branch 'rhos-17.0-trunk-patches'

[stack@undercloud-0 python-octavia-lib]$ ls
CONTRIBUTING.rst  lower-constraints.txt  requirements.txt       tools
doc               octavia_lib            setup.cfg              tox.ini
HACKING.rst       README.rst             setup.py               zuul.d
LICENSE           releasenotes           test-requirements.txt

# 2. Running "tox -epep8" 

[stack@undercloud-0 python-octavia-lib]$ tox -epep8
pep8 create: /home/stack/python-octavia-lib/.tox/pep8
pep8 installdeps: -chttps://releases.openstack.org/constraints/upper/master, -r/home/stack/python-octavia-lib/requirements.txt, -r/home/stack/python-octavia-lib/test-requirements.txt
pep8 develop-inst: /home/stack/python-octavia-lib
pep8 installed: astroid==2.11.7,attrs==21.4.0,autopage==0.5.1,bandit==1.7.4,cliff==3.10.1,cmd2==2.4.1,coverage==6.4.1,debtcollector==2.5.0,dill==0.3.5.1,doc8==0.11.2,docutils==0.17.1,entrypoints==0.3,extras==1.0.0,fixtures==4.0.1,flake8==3.7.9,future==0.18.2,gitdb==4.0.9,GitPython==3.1.27,hacking==3.0.1,iso8601==1.0.2,isort==5.10.1,lazy-object-proxy==1.7.1,mccabe==0.6.1,msgpack==1.0.4,netaddr==0.8.0,netifaces==0.11.0,-e git+https://code.engineering.redhat.com/gerrit/python-octavia-lib.git@0b18bf1021d3ec8db8ce7755af575b542d72b33b#egg=octavia_lib,oslo.i18n==5.1.0,oslo.serialization==5.0.0,oslo.utils==6.0.0,oslotest==4.5.0,packaging==21.3,pbr==5.9.0,platformdirs==2.5.2,prettytable==3.3.0,pycodestyle==2.5.0,pyflakes==2.1.1,Pygments==2.12.0,pylint==2.14.5,pyparsing==3.0.9,pyperclip==1.8.2,python-subunit==1.4.0,pytz==2022.1,PyYAML==6.0,restructuredtext-lint==1.4.0,six==1.16.0,smmap==5.0.0,stestr==3.2.1,stevedore==3.5.0,tenacity==6.3.1,testtools==2.5.0,tomli==2.0.1,tomlkit==0.11.1,typing_extensions==4.3.0,voluptuous==0.13.1,wcwidth==0.2.5,wrapt==1.14.1
pep8 run-test-pre: PYTHONHASHSEED='3422530378'
pep8 run-test: commands[0] | flake8
pep8 run-test: commands[1] | doc8 --ignore-path doc/source/contributor/modules doc/source octavia_lib HACKING.rst README.rst
Scanning...
Validating...
========
Total files scanned = 11
Total files ignored = 0
Total accumulated errors = 0
Detailed error counts:
    - doc8.checks.CheckCarriageReturn = 0
    - doc8.checks.CheckIndentationNoTab = 0
    - doc8.checks.CheckMaxLineLength = 0
    - doc8.checks.CheckNewlineEndOfFile = 0
    - doc8.checks.CheckTrailingWhitespace = 0
    - doc8.checks.CheckValidity = 0
pep8 run-test: commands[2] | bandit -r octavia_lib -ll -ii -x octavia_lib/tests
[main]	INFO	profile include tests: None
[main]	INFO	profile exclude tests: None
[main]	INFO	cli include tests: None
[main]	INFO	cli exclude tests: None
[main]	INFO	running on Python 3.9.10
Run started:2022-07-20 06:49:25.758648

Test results:
	No issues identified.

Code scanned:
	Total lines of code: 1566
	Total lines skipped (#nosec): 0

Run metrics:
	Total issues (by severity):
		Undefined: 0
		Low: 1
		Medium: 0
		High: 0
	Total issues (by confidence):
		Undefined: 0
		Low: 0
		Medium: 1
		High: 0
Files skipped (0):
pep8 run-test: commands[3] | /home/stack/python-octavia-lib/tools/coding-checks.sh --pylint ''
Running pylint...
You can speed this up by running it on 'HEAD~[0-9]' (e.g. HEAD~1, this change only)...
************* Module .pylintrc
.pylintrc:1:0: W0012: Unknown option value for '--disable', expected a valid pylint message and got 'bad-builtin' (unknown-option-value)
.pylintrc:1:0: W0012: Unknown option value for '--disable', expected a valid pylint message and got 'interface-not-implemented' (unknown-option-value)
.pylintrc:1:0: R0022: Useless option value for '--disable', 'no-init' was removed from pylint, see https://github.com/PyCQA/pylint/issues/2409. (useless-option-value)
.pylintrc:1:0: R0022: Useless option value for '--disable', 'bad-continuation' was removed from pylint, see https://github.com/PyCQA/pylint/pull/3571. (useless-option-value)
.pylintrc:1:0: R0022: Useless option value for '--disable', 'no-self-use' was moved to an optional extension, see https://pylint.pycqa.org/en/latest/whatsnew/2/2.14/summary.html#removed-checkers. (useless-option-value)

------------------------------------
Your code has been rated at 10.00/10

___________________________________ summary ____________________________________
  pep8: commands succeeded
  congratulations :)


Moving the bug to "verified".

Comment 10 errata-xmlrpc 2022-09-21 12:18:58 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