distrib_codename alpha comparison will soon yield unintended behavior
Bug #1659575 reported by
Ryan Beisner
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Charm Helpers |
Fix Released
|
High
|
Alex Kavanagh | ||
OpenStack Keystone Charm |
Fix Released
|
High
|
Alex Kavanagh | ||
OpenStack Nova Cloud Controller Charm |
Fix Released
|
High
|
Alex Kavanagh | ||
OpenStack Nova Compute Charm |
Fix Released
|
High
|
Alex Kavanagh | ||
nova-cloud-controller (Juju Charms Collection) |
Invalid
|
High
|
Unassigned | ||
nova-compute (Juju Charms Collection) |
Invalid
|
High
|
Unassigned |
Bug Description
Presuming that after 'z' will come 'a' - with regard to distro codename, several charms are about to have unintended behavior due to the use of alpha comparison logic. The numeric version comparison should be used instead.
I've not done a full audit of all OpenStack Charms but that needs to be done as soon as possible, and associated with this bug.
Here are a some examples which need to be fixed:
https:/
if distro_codename < "wily":
if distro_codename >= 'yakkety':
.
Here is an example of the safe way to do it:
if lsb_release(
Related branches
lp://staging/~ajkavanagh/charm-helpers/fix-alphanumerica-comparisons
- David Ames (community): Approve
-
Diff: 674 lines (+210/-173)13 files modifiedcharmhelpers/contrib/hardening/ssh/checks/config.py (+14/-6)
charmhelpers/contrib/network/ip.py (+2/-4)
charmhelpers/contrib/openstack/amulet/utils.py (+2/-1)
charmhelpers/contrib/openstack/context.py (+2/-2)
charmhelpers/contrib/openstack/neutron.py (+12/-7)
charmhelpers/contrib/openstack/utils.py (+4/-88)
charmhelpers/core/host.py (+2/-0)
charmhelpers/core/host_factory/centos.py (+16/-0)
charmhelpers/core/host_factory/ubuntu.py (+32/-0)
charmhelpers/core/strutils.py (+53/-0)
tests/contrib/openstack/test_os_utils.py (+3/-64)
tests/core/test_host.py (+10/-1)
tests/core/test_strutils.py (+58/-0)
description: | updated |
Changed in charm-nova-compute: | |
importance: | Undecided → High |
status: | New → Triaged |
Changed in nova-compute (Juju Charms Collection): | |
status: | Triaged → Invalid |
Changed in charm-nova-cloud-controller: | |
importance: | Undecided → High |
status: | New → Triaged |
Changed in nova-cloud-controller (Juju Charms Collection): | |
status: | Triaged → Invalid |
Changed in charm-helpers: | |
assignee: | nobody → Alex Kavanagh (ajkavanagh) |
Changed in charm-nova-cloud-controller: | |
assignee: | nobody → Alex Kavanagh (ajkavanagh) |
Changed in charm-nova-compute: | |
assignee: | nobody → Alex Kavanagh (ajkavanagh) |
Changed in charm-keystone: | |
importance: | Undecided → High |
assignee: | nobody → Alex Kavanagh (ajkavanagh) |
status: | New → In Progress |
Changed in charm-helpers: | |
status: | Triaged → Fix Committed |
Changed in charm-helpers: | |
status: | Fix Committed → In Progress |
Changed in charm-nova-cloud-controller: | |
status: | Triaged → In Progress |
Changed in charm-nova-compute: | |
status: | Triaged → In Progress |
Changed in charm-helpers: | |
status: | In Progress → Fix Released |
Changed in charm-keystone: | |
status: | In Progress → Fix Committed |
milestone: | none → 17.08 |
Changed in charm-nova-cloud-controller: | |
status: | In Progress → Fix Committed |
milestone: | none → 17.08 |
Changed in charm-nova-compute: | |
status: | In Progress → Fix Committed |
milestone: | none → 17.08 |
Changed in charm-nova-compute: | |
status: | Fix Committed → Fix Released |
Changed in charm-nova-cloud-controller: | |
status: | Fix Committed → Fix Released |
Changed in charm-keystone: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
Some of these alpha comparisons are in charm repos (ie. hook code), and some of them are in charmhelpers.
Here are some examples of trouble-to-come from charmhelpers:
contrib/ openstack/ context. py: if lsb_release( )['DISTRIB_ CODENAME' ].lower( ) > 'trusty':
contrib/ hardening/ ssh/checks/ config. py: if lsb_release( )['DISTRIB_ CODENAME' ].lower( ) >= 'trusty':