hook failures for unsupported/containers

Bug #1802805 reported by Haw Loeung
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical Livepatch Charm
Fix Released
Medium
Barry Price

Bug Description

Hi,

On unsupported/containers, the charm fails as follows:

2018-11-12 00:26:24 INFO juju-log OS container detected, livepatch is not needed
2018-11-12 00:26:24 INFO juju-log Invoking reactive handler: reactive/canonical_livepatch.py:249:configure_nagios
2018-11-12 00:26:24 INFO juju-log Setting charm primary status False
2018-11-12 00:26:24 ERROR juju-log Hook error:
Traceback (most recent call last):
  File "/var/lib/juju/agents/unit-canonical-livepatch-1/.venv/lib/python3.6/site-packages/charms/reactive/__init__.py", line 73, in main
    bus.dispatch(restricted=restricted_mode)
  File "/var/lib/juju/agents/unit-canonical-livepatch-1/.venv/lib/python3.6/site-packages/charms/reactive/bus.py", line 390, in dispatch
    _invoke(other_handlers)
  File "/var/lib/juju/agents/unit-canonical-livepatch-1/.venv/lib/python3.6/site-packages/charms/reactive/bus.py", line 359, in _invoke
    handler.invoke()
  File "/var/lib/juju/agents/unit-canonical-livepatch-1/.venv/lib/python3.6/site-packages/charms/reactive/bus.py", line 181, in invoke
    self._action(*args)
  File "/var/lib/juju/agents/unit-canonical-livepatch-1/charm/reactive/canonical_livepatch.py", line 270, in configure_nagios
    write_status_to_disk()
  File "/var/lib/juju/agents/unit-canonical-livepatch-1/charm/reactive/canonical_livepatch.py", line 71, in write_status_to_disk
    current_status = get_livepatch_status()
  File "/var/lib/juju/agents/unit-canonical-livepatch-1/charm/reactive/canonical_livepatch.py", line 59, in get_livepatch_status
    livepatch_status = check_output(cmd, universal_newlines=True)
  File "/usr/lib/python3.6/subprocess.py", line 336, in check_output
    **kwargs).stdout
  File "/usr/lib/python3.6/subprocess.py", line 403, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/usr/lib/python3.6/subprocess.py", line 709, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.6/subprocess.py", line 1344, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/snap/bin/canonical-livepatch': '/snap/bin/canonical-livepatch'

I think we just need to have an 'unsupported' flag and skip configure_nagios() on that.

Related branches

Revision history for this message
Haw Loeung (hloeung) wrote :

Related, /etc/cron.d/check_canonical-livepatch gets shipped out by configure_nagios() and causes cron spam:

Date: Sun, 11 Nov 2018 17:17:01 +0000 (UTC)
From: Cron Daemon <email address hidden>
To: <email address hidden>
Subject: Cron <root@kimura> /snap/bin/canonical-livepatch status >
        /var/lib/nagios/canonical-livepatch-status.txt

/bin/sh: 1: /snap/bin/canonical-livepatch: not found

description: updated
Barry Price (barryprice)
Changed in canonical-livepatch-charm:
assignee: nobody → Barry Price (barryprice)
importance: Undecided → Medium
status: New → In Progress
Barry Price (barryprice)
Changed in canonical-livepatch-charm:
status: In Progress → Fix Committed
Barry Price (barryprice)
Changed in canonical-livepatch-charm:
status: Fix Committed → Fix Released
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.