Comment 0 for bug 1884494

Revision history for this message
Jose Guedez (jfguedez) wrote :

Discovered via a stuck "update-status" hook after an upgrade of the openvswitch charm on a server with openvswitch packages marked as on "hold"

Version: 19.10, but the code seems to be the same on master

The function _dpkg_list in charmhelpers.fetch.ubuntu_apt_pkg.py executes a `dpkg-query --list <package>` command and parses the output. However it's looking for lines that start with 'ii', but packages that are installed but on "hold" have lines that start with 'hi'. Looks like only the second character should be checked to determine that the package is actually installed, or some more complex logic as necessary. This happens here: https://github.com/juju/charm-helpers/blob/master/charmhelpers/fetch/ubuntu_apt_pkg.py#L132

This causes client functions like neutron openvswitch "ovs_has_late_dpdk_init" to get "None" from fetch.ubuntu.get_upstream_version, and throw an exception when the package is actually installed - https://github.com/openstack/charm-neutron-openvswitch/blob/master/hooks/neutron_ovs_utils.py#L922

Example output of the dpkg-query command for a held package:

# dpkg-query --list openvswitch-switch
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-=================================-=====================-=====================-========================================================================
hi openvswitch-switch 2.11.0-0ubuntu2~cloud amd64 Open vSwitch switch implementations