~midokura/charms/trusty/nova-compute/backport

« back to all changes in this revision

Viewing changes to hooks/charmhelpers/core/services/base.py

  • Committer: Corey Bryant
  • Date: 2015-07-17 15:25:21 UTC
  • mfrom: (142.1.1 nova-compute)
  • Revision ID: corey.bryant@canonical.com-20150717152521-67gh9wsdxcutl7fo
[corey.bryant,trivial] Sync charm-helpers.

Show diffs side-by-side

added added

removed removed

Lines of Context:
128
128
        """
129
129
        Handle the current hook by doing The Right Thing with the registered services.
130
130
        """
131
 
        hook_name = hookenv.hook_name()
132
 
        if hook_name == 'stop':
133
 
            self.stop_services()
134
 
        else:
135
 
            self.reconfigure_services()
136
 
            self.provide_data()
137
 
        cfg = hookenv.config()
138
 
        if cfg.implicit_save:
139
 
            cfg.save()
 
131
        hookenv._run_atstart()
 
132
        try:
 
133
            hook_name = hookenv.hook_name()
 
134
            if hook_name == 'stop':
 
135
                self.stop_services()
 
136
            else:
 
137
                self.reconfigure_services()
 
138
                self.provide_data()
 
139
        except SystemExit as x:
 
140
            if x.code is None or x.code == 0:
 
141
                hookenv._run_atexit()
 
142
        hookenv._run_atexit()
140
143
 
141
144
    def provide_data(self):
142
145
        """