Take into account missing files when checking

master
Lertsenem 2016-05-27 00:24:00 +02:00
parent 2449711ede
commit c995f07e67
1 changed files with 19 additions and 6 deletions

View File

@ -150,11 +150,24 @@ def _compare_and_log(original_file_path, persoconf_backup_path, logger):
% original_file_path )
else:
if filecmp.cmp(resolved_ofp, resolved_pbp) :
logger.info( "No modification on %s"
% original_file_path )
try:
if filecmp.cmp(resolved_ofp, resolved_pbp) :
logger.info( "No modification on %s"
% original_file_path )
else:
logger.warning( "File %s was modified"
% original_file_path )
except FileNotFoundError as err:
if err.filename == resolved_pbp:
logger.warning( "File %s was modified (no backup file)"
% original_file_path )
else:
logger.warning( "File %s was deleted!"
% original_file_path )
else:
logger.warning( "File %s was modified"
% original_file_path )