~openstack-charmers/charms/trusty/ceilometer/trunk

« back to all changes in this revision

Viewing changes to hooks/ceilometer_hooks.py

  • Committer: Alex Kavanagh
  • Date: 2016-04-17 11:58:45 UTC
  • Revision ID: alex@ajkavanagh.co.uk-20160417115845-ilksb5ih6cg1giuc
Fixes pause/resume failure on w/lib & x/mit lp:1570375

Pause failed as configure_https() had a service restart that was missed
in the initial pause/resume feature addition.  configure_https() was
triggered via a 'config-changed' hook that could occur whilst the unit
is pause.

Also enhanced the pause/resume test to include a forced 'config-changed'
hook to run to test that the fix works.

Change-Id: I0d2820fe5d447dd7877afacb0a63a8590f027b31
Closes-Bug: #1570375

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
    configure_installation_source,
29
29
    openstack_upgrade_available,
30
30
    pausable_restart_on_change as restart_on_change,
 
31
    is_unit_paused_set,
31
32
)
32
33
from ceilometer_utils import (
33
34
    get_packages,
137
138
 
138
139
    # TODO: improve this by checking if local CN certs are available
139
140
    # first then checking reload status (see LP #1433114).
140
 
    try:
141
 
        subprocess.check_call(['service', 'apache2', 'reload'])
142
 
    except subprocess.CalledProcessError:
143
 
        subprocess.call(['service', 'apache2', 'restart'])
 
141
    if not is_unit_paused_set():
 
142
        try:
 
143
            subprocess.check_call(['service', 'apache2', 'reload'])
 
144
        except subprocess.CalledProcessError:
 
145
            subprocess.call(['service', 'apache2', 'restart'])
144
146
 
145
147
 
146
148
@hooks.hook('config-changed')