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