~louis/+junk/nova-compute

« back to all changes in this revision

Viewing changes to hooks/charmhelpers/core/host.py

  • Committer: Edward Hope-Morley
  • Date: 2014-03-26 18:08:46 UTC
  • mfrom: (55.1.1 nova-compute.lp1273067)
  • Revision ID: edward.hope-morley@canonical.com-20140326180846-o2mo693uow2urlpj
[hopem] Added support for ceph-client logging to syslog

Show diffs side-by-side

added added

removed removed

Lines of Context:
194
194
        return None
195
195
 
196
196
 
197
 
def restart_on_change(restart_map):
 
197
def restart_on_change(restart_map, stopstart=False):
198
198
    """Restart services based on configuration files changing
199
199
 
200
200
    This function is used a decorator, for example
219
219
            for path in restart_map:
220
220
                if checksums[path] != file_hash(path):
221
221
                    restarts += restart_map[path]
222
 
            for service_name in list(OrderedDict.fromkeys(restarts)):
223
 
                service('restart', service_name)
 
222
            services_list = list(OrderedDict.fromkeys(restarts))
 
223
            if not stopstart:
 
224
                for service_name in services_list:
 
225
                    service('restart', service_name)
 
226
            else:
 
227
                for action in ['stop', 'start']:
 
228
                    for service_name in services_list:
 
229
                        service(action, service_name)
224
230
        return wrapped_f
225
231
    return wrap
226
232