Charm may skip installation of required deb package

Bug #1877972 reported by Frode Nordahl
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
charm-octavia-diskimage-retrofit
Fix Released
High
Frode Nordahl

Bug Description

The charm lists ``distro-info`` as a required package, however during a gate test we ended up with this situation:

2020-05-11 08:18:53 INFO juju-log Initializing Snap Layer
2020-05-11 08:18:53 DEBUG retrofit-image none
2020-05-11 08:18:54 DEBUG retrofit-image All snaps up to date.
2020-05-11 08:18:54 DEBUG juju-log Running action "retrofit-image"
2020-05-11 08:18:54 INFO juju-log DEPRECATION WARNING: Function action_get is being removed : moved to function_get()
2020-05-11 08:18:55 ERROR juju-log action "retrofit-image" failed: "[Errno 2] No such file or directory: 'distro-info': 'distro-info'" "Traceback (most recent call last):
  File "/var/lib/juju/agents/unit-octavia-diskimage-retrofit-0/charm/actions/retrofit-image", line 67, in main
    action(args)
  File "/var/lib/juju/agents/unit-octavia-diskimage-retrofit-0/charm/actions/retrofit-image", line 49, in retrofit_image
    ch_core.hookenv.action_get('source-image'))
  File "lib/charm/openstack/octavia_diskimage_retrofit.py", line 94, in retrofit
    series=self.config['retrofit-series'])
  File "lib/charm/openstack/octavia_diskimage_retrofit.py", line 67, in get_ubuntu_release
    output = subprocess.check_output(cmd, universal_newlines=True)
  File "/usr/lib/python3.6/subprocess.py", line 356, in check_output
    **kwargs).stdout
  File "/usr/lib/python3.6/subprocess.py", line 423, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/usr/lib/python3.6/subprocess.py", line 729, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.6/subprocess.py", line 1364, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'distro-info': 'distro-info'
"
2020-05-11 08:18:55 INFO juju-log DEPRECATION WARNING: Function action_fail is being removed : moved to function_fail()

Looking at the reactive handlers of the charm:

charm.use_defaults(
    'charm.installed',
    'config.changed',
    'update-status',
    'upgrade-charm',
)

@reactive.when_not('charm.installed')
def check_snap_installed():
    # Installation is handled by the ``snap`` layer, just update our status.
    with charm.provide_charm_instance() as instance:
        instance.assess_status()
    reactive.set_flag('charm.installed')

While the above code was fine when the charm relied only on the snap to do its work, it does not guarantee that the now required ``distro-info`` package is installed in the system before it announces itself as being ready.

Frode Nordahl (fnordahl)
Changed in charm-octavia-diskimage-retrofit:
status: New → Triaged
importance: Undecided → High
milestone: none → 20.05
Frode Nordahl (fnordahl)
Changed in charm-octavia-diskimage-retrofit:
assignee: nobody → Frode Nordahl (fnordahl)
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to charm-octavia-diskimage-retrofit (master)

Fix proposed to branch: master
Review: https://review.opendev.org/726795

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to charm-octavia-diskimage-retrofit (master)

Reviewed: https://review.opendev.org/726795
Committed: https://git.openstack.org/cgit/openstack/charm-octavia-diskimage-retrofit/commit/?id=fb3c4593fc30ce29b2da867b9de32b39ee916c7a
Submitter: Zuul
Branch: master

commit fb3c4593fc30ce29b2da867b9de32b39ee916c7a
Author: Frode Nordahl <email address hidden>
Date: Mon May 11 13:55:38 2020 +0200

    Let default install helper do its job

    Change I80809dbe0ae43a87986b33c902e0eb53563cb90d added a required
    deb package to be installed by the charm.

    Before that the only installation done was through the snap layer
    and the charm updated the status and set the ``charm.installed``
    to have the status set correctly.

    Remove this code as this now is at odds with the requirement of
    having a deb installed before charm operation.

    Closes-Bug: #1877972
    Change-Id: Iee82f7ff066e81787bb658bca3dfce4087ab4e00

Changed in charm-octavia-diskimage-retrofit:
status: In Progress → Fix Committed
David Ames (thedac)
Changed in charm-octavia-diskimage-retrofit:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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