[Bionic] ntp charm should install chrony if not installed on post-series-upgrade hook

Bug #1838529 reported by Alvaro Uria
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
NTP Charm
Fix Committed
Undecided
Joe Guo

Bug Description

Upgrades from Xenial to Bionic require the following steps:
"""
juju upgrade-series <machine-N> prepare bionic
juju ssh <machine-N>
 apt-get update && apt-get dist-upgrade
 do-release-upgrade
 reboot
juju upgrade-series <machine-N> complete
"""

If chrony is not installed, the last step ("... complete") will never end because the ntp subordinate goes into error state because "chrony" is not installed.

The "complete" step runs hooks/post-series-upgrades, so a verification that chrony is installed (or install it) would be needed at the beginning of that step. Since the charm is reactive, it will try to configure chrony but it will fail because /etc/chrony/chrony.conf does not exist (Permission error).

When chrony is manually installed, the ntp-charm will run without issues, and makes the "juju upgrade-series .... complete" step finish successfully.

Revision history for this message
Drew Freiberger (afreiberger) wrote :

Recommend apt-get install chrony after do-release-upgrade but before the reboot as a workaround.

Joe Guo (guoqiao)
Changed in ntp-charm:
assignee: nobody → Joe Guo (guoqiao)
Joe Guo (guoqiao)
Changed in ntp-charm:
status: New → In Progress
Revision history for this message
Joe Guo (guoqiao) wrote :

I've reproduced the issue with following steps in local juju env(lxd):

- juju add-model ntp
- juju deploy --series xenial cs:ubuntu
- juju deploy --series xenial cs:ntp
- juju relate ubuntu ntp
- juju upgrade-series as above

juju upgrade-series $MACHINE_ID complete failed with:

    ntp/0* error idle 10.179.131.156 123/udp hook failed: "post-series-upgrade"

from juju debug-log:

    unit-ntp-0: 16:23:08 ERROR unit.ntp/0.juju-log Hook error:
    Traceback (most recent call last):
    File "/var/lib/juju/agents/unit-ntp-0/.venv/lib/python3.6/site-packages/charms/reactive/__init__.py", line 74, in main
        bus.dispatch(restricted=restricted_mode)
    File "/var/lib/juju/agents/unit-ntp-0/.venv/lib/python3.6/site-packages/charms/reactive/bus.py", line 390, in dispatch
        _invoke(other_handlers)
    File "/var/lib/juju/agents/unit-ntp-0/.venv/lib/python3.6/site-packages/charms/reactive/bus.py", line 359, in _invoke
        handler.invoke()
    File "/var/lib/juju/agents/unit-ntp-0/.venv/lib/python3.6/site-packages/charms/reactive/bus.py", line 181, in invoke
        self._action(*args)
    File "/var/lib/juju/agents/unit-ntp-0/.venv/lib/python3.6/site-packages/charmhelpers/core/host.py", line 719, in wrapped_f
        restart_functions)
    File "/var/lib/juju/agents/unit-ntp-0/.venv/lib/python3.6/site-packages/charmhelpers/core/host.py", line 741, in restart_on_change_helper
        r = lambda_f()
    File "/var/lib/juju/agents/unit-ntp-0/.venv/lib/python3.6/site-packages/charmhelpers/core/host.py", line 718, in <lambda>
        (lambda: f(*args, **kwargs)), restart_map, stopstart,
    File "/var/lib/juju/agents/unit-ntp-0/charm/reactive/ntp.py", line 233, in write_config
        'servers': remote_sources,
    File "lib/ntp_implementation.py", line 57, in set_config
        with open(self.config_file(), "w") as conffile:
    FileNotFoundError: [Errno 2] No such file or directory: '/etc/chrony/chrony.conf'

Revision history for this message
Joe Guo (guoqiao) wrote :

Patch merged.

Changed in ntp-charm:
status: In Progress → Fix Committed
Revision history for this message
Heitor (heitorpbittencourt) wrote :

The current stable version of the charm contains this patch?

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.