Misc fixes including service disable in early unit lifecycle

This commit is contained in:
James Page 2017-07-12 16:01:12 +01:00
parent e164be0a40
commit 279f41adcd
3 changed files with 21 additions and 1 deletions

View File

@ -140,7 +140,8 @@ class GnocchiCharm(charms_openstack.charm.HAOpenStackCharm):
]),
}
sync_cmd = ['gnocchi-upgrade']
sync_cmd = ['gnocchi-upgrade',
'--log-file=/var/log/gnocchi/gnocchi-upgrade.log']
adapters_class = GnocchiCharmRelationAdapaters
@ -167,3 +168,13 @@ class GnocchiCharm(charms_openstack.charm.HAOpenStackCharm):
'database': 'gnocchi',
'username': 'gnocchi',
'hostname': hookenv.unit_private_ip()}, ]
def disable_services(self):
'''Disable all services related to gnocchi'''
for svc in self.services:
host.service_pause(svc)
def enable_services(self):
'''Enable all services related to gnocchi'''
for svc in self.services:
host.service_resume(svc)

View File

@ -29,6 +29,12 @@ charm.use_defaults(
'update-status')
@reactive.when_not('config.rendered')
def disable_services():
with charm.provide_charm_instance() as charm_class:
charm_class.disable_services()
@reactive.when('coordinator.available')
@reactive.when('shared-db.available')
@reactive.when('identity-service.available')
@ -40,6 +46,7 @@ def render_config(*args):
with charm.provide_charm_instance() as charm_class:
charm_class.render_with_interfaces(args)
charm_class.enable_apache2_site()
charm_class.enable_services()
charm_class.assess_status()
reactive.set_state('config.rendered')

View File

@ -6,6 +6,8 @@
[DEFAULT]
debug = {{ options.debug }}
use_syslog = {{ options.use_syslog }}
# NOTE(jamespage): Set sensible log file location for WSGI processes,
# other daemons will override using CLI options.
log_file = /var/log/gnocchi/gnocchi-api.log
[api]