Fix issue with hashing symlinks to directories

pull/21/head
Dan Puttick 2017-07-20 13:56:32 -04:00
parent 3eff10fbcd
commit cc5d1e5117
1 changed files with 5 additions and 2 deletions

View File

@ -251,7 +251,7 @@ class File(FileBase):
props = self.get_all_props() props = self.get_all_props()
if not self.is_archive: if not self.is_archive:
if os.path.exists(self.tempdir_path): if os.path.exists(self.tempdir_path):
# FIXME: Hack to make images appear at the correct tree depth in log # FIXME: in_tempdir is a hack to make images appear at the correct tree depth in log
self.logger.add_file(self.src_path, props, in_tempdir=True) self.logger.add_file(self.src_path, props, in_tempdir=True)
return return
self.logger.add_file(self.src_path, props) self.logger.add_file(self.src_path, props)
@ -588,7 +588,10 @@ class GroomerLogger(object):
def add_file(self, file_path, file_props, in_tempdir=False): def add_file(self, file_path, file_props, in_tempdir=False):
"""Add a file to the log. Takes a path and a dict of file properties.""" """Add a file to the log. Takes a path and a dict of file properties."""
depth = self._get_path_depth(file_path) depth = self._get_path_depth(file_path)
try:
file_hash = Logging.computehash(file_path)[:6] file_hash = Logging.computehash(file_path)[:6]
except IsADirectoryError:
file_hash = 'directory'
if file_props['is_symlink']: if file_props['is_symlink']:
symlink_template = "+- NOT COPIED: symbolic link to {name} ({sha_hash})" symlink_template = "+- NOT COPIED: symbolic link to {name} ({sha_hash})"
log_string = symlink_template.format( log_string = symlink_template.format(