host.service_running fails on trusty for snapped service

Bug #1824217 reported by Drew Freiberger
24
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Charm Helpers
Fix Released
Undecided
Unassigned
Prometheus Ceph Exporter Charm
Fix Released
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.

Revision history for this message
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)
Changed in charm-helpers:
status: New → Confirmed
Jeremy Lounder (jldev)
Changed in charm-prometheus-ceph-exporter:
status: New → Invalid
Revision history for this message
Adam Dyess (addyess) wrote :
Changed in charm-helpers:
status: Confirmed → In Progress
assignee: nobody → Adam Dyess (addyess)
Adam Dyess (addyess)
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
Revision history for this message
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
Revision history for this message
Adam Dyess (addyess) wrote :
Revision history for this message
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)
Changed in charm-prometheus-ceph-exporter:
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.