Installed packages but marked on "hold" in apt are considered not installed

Bug #1884494 reported by Jose Guedez
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Charm Helpers
Triaged
Medium
Unassigned
OpenStack Neutron Open vSwitch Charm
Triaged
Medium
Unassigned

Bug Description

Discovered via a stuck "config-changed" 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

Jose Guedez (jfguedez)
description: updated
James Page (james-page)
Changed in charm-neutron-openvswitch:
status: New → Triaged
importance: Undecided → Medium
Changed in charm-helpers:
status: New → Triaged
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.