diff options
author | Alejandro Sirgo Rica <asirgo@soleta.eu> | 2024-06-03 10:43:56 +0200 |
---|---|---|
committer | Alejandro Sirgo Rica <asirgo@soleta.eu> | 2024-06-03 11:29:57 +0200 |
commit | 5698aa66d21f6c699a7170ea21c8d3ad0dc5a616 (patch) | |
tree | 1636cf635c117ccb62a51cc0e3fc766af1668a3e | |
parent | a1774c795b9954a1e85fe542fbe0b831d059f3d2 (diff) |
utils: fix get_image_info regressionv1.3.2-10
Fix image size, permissions and creation time.
Improve error report related to these parameters now showing the
exact cause of the problem if any occurred during the definition
of image size, file permissions or image creation time values.
-rw-r--r-- | src/live/ogOperations.py | 1 | ||||
-rw-r--r-- | src/utils/image.py | 11 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/live/ogOperations.py b/src/live/ogOperations.py index 3eee06a..d98568f 100644 --- a/src/live/ogOperations.py +++ b/src/live/ogOperations.py @@ -10,7 +10,6 @@ import datetime import hashlib import logging import os -import stat import subprocess import shlex import shutil diff --git a/src/utils/image.py b/src/utils/image.py index a9ffb22..088c0c3 100644 --- a/src/utils/image.py +++ b/src/utils/image.py @@ -9,6 +9,7 @@ import ipaddress import logging import os +import stat import subprocess import shlex import shutil @@ -131,11 +132,11 @@ def get_image_info(image_path): try: st = os.stat(image_path) - self.size = st.st_size - self.perms = st.st_mode & (stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) - self.mtime = int(st.st_mtime) - except: - logging.info(f'cannot retrieve stats from {image_path}') + image_info.size = st.st_size + image_info.perms = st.st_mode & (stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) + image_info.mtime = int(st.st_mtime) + except Exception as e: + logging.info(f'cannot retrieve stats from {image_path}: {e}') return image_info |