Verified Commit c56829c8 authored by Karel Koci's avatar Karel Koci 🤘
Browse files

nsfarm/lxd: fix image hash calculation

The issue here is that we should not use full path to file never to
calculate hash as different location of NSFarm project result in
different hashes and thus we do not share them at all.
This makes one instance where we included full path just relative to
images directory. This way the path should be contant no matter where
the project is located.

This also does small tweak in form of removal of unnecessary
comprehension error. We can convert directly to list without creating
parent 8197146c
......@@ -85,13 +85,13 @@ class Image:
self._md5sum_update_file(md5sum, self._file_path)
# Additional nodes from directory
if self._dir_path:
nodes = [path for path in self._dir_path.iterdir()]
nodes = list(self._dir_path.iterdir())
while nodes:
node = nodes.pop()
path = self._dir_path / node
if path.is_dir():
nodes += [path for path in node.iterdir()]
nodes += list(node.iterdir())
elif path.is_file():
# For plain file include content
self._md5sum_update_file(md5sum, path)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment