diff --git a/files/tinc-refresh b/files/tinc-refresh index 4ca419f..eb8de4b 100644 --- a/files/tinc-refresh +++ b/files/tinc-refresh @@ -156,7 +156,10 @@ def check_file_change(mod_func): before = md5(file_path) mod_func(file_path, data) after = md5(file_path) - return before != after + changed = before != after + if changed: + LOG.info('Changed: %s', file_path) + return changed return wrapper @check_file_change @@ -259,9 +262,6 @@ LOG.debug('Saving VNP IP: %s', vpn_ip) with open('{}/tinc-ip'.format(tinc_network_path), 'w') as f: f.write(vpn_ip) -LOG.debug('Updating main config file') -config_changed = write_config(tinc_config_path, sorted_services) - LOG.debug('Generating host config files') hosts_changed = [] for service in sorted_services: @@ -270,6 +270,9 @@ for service in sorted_services: ) hosts_changed.append(add_host_config(host_config_path, service)) +LOG.debug('Updating main config file') +config_changed = write_config(tinc_config_path, sorted_services) + # Avoid reloading Tinc if possible if not config_changed and not any(hosts_changed): LOG.info('No changes detected')