host.service_running fails on trusty for snapped service

Bug #1824217 reported by Drew Freiberger on 2019-04-10
24
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Charm Helpers
Undecided
Unassigned
Prometheus Ceph Exporter Charm
Medium
Adam Dyess

Bug Description

The latest charmhelpers.core.host.service_running() checks for systemd, then uses system() to call systemctl or service if init_is_systemd() is true. This init_is_systemd() is false on trusty.

It then falls back to checking for /etc/init/* or /etc/init.d/* files in upstart and sysv format startup.

This creates a gap related to snap-based systemd startup services, as snapd only installs startup scripts in /etc/systemd/system/snapd.XXXXX when installed on trusty.

charmhelpers should be updated to handle the special case of systemd-only services on trusty to support charms that use snapped services.

Drew Freiberger (afreiberger) wrote :

Suggest adding function systemd_is_installed() and add another elif systemd_is_installed(): return service('is-active', service_name) before line https://github.com/juju/charm-helpers/blob/master/charmhelpers/core/host.py#L308 that checks. This would cover a more generic case of using the os-native tools on trusty before reverting back to systemd, but would cover both snap and non-snap systemd-only services installed on trusty.

no longer affects: charm-prometheus-ceph-exporter
Jose Guedez (jfguedez) on 2020-03-19
Changed in charm-helpers:
status: New → Confirmed
Jeremy Lounder (jldev) on 2020-04-29
Changed in charm-prometheus-ceph-exporter:
status: New → Invalid
Adam Dyess (addyess) wrote :
Changed in charm-helpers:
status: Confirmed → In Progress
assignee: nobody → Adam Dyess (addyess)
Adam Dyess (addyess) on 2020-07-17
Changed in charm-helpers:
status: In Progress → Fix Released
Changed in charm-prometheus-ceph-exporter:
status: Invalid → In Progress
assignee: nobody → Adam Dyess (addyess)
Changed in charm-helpers:
assignee: Adam Dyess (addyess) → nobody
Adam Dyess (addyess) wrote :

when charmhelpers 20.17 is available from pypi: re-run tests on prometheus-ceph-exporter and push charm to charm story

Changed in charm-prometheus-ceph-exporter:
assignee: Adam Dyess (addyess) → nobody
status: In Progress → Triaged
Adam Dyess (addyess) wrote :
Changed in charm-prometheus-ceph-exporter:
status: Triaged → Fix Committed
Changed in charm-prometheus-ceph-exporter:
importance: Undecided → Medium
assignee: nobody → Adam Dyess (addyess)
Linda Guo (lihuiguo) on 2021-02-23
Changed in charm-prometheus-ceph-exporter:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers