~hazmat/charms/precise/glance/ssl-everywhere

« back to all changes in this revision

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

  • Committer: Kapil Thangavelu
  • Date: 2014-02-25 14:22:57 UTC
  • Revision ID: kapil@canonical.com-20140225142257-kxl09khvckg6q9tq
sync helpers

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, stopstart=False):
 
197
def restart_on_change(restart_map):
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
 
            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)
 
222
            for service_name in list(OrderedDict.fromkeys(restarts)):
 
223
                service('restart', service_name)
230
224
        return wrapped_f
231
225
    return wrap
232
226