mirror of https://git.48k.eu/ogclient
utils: fix get_image_info regression
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.master v1.3.2-10
parent
a1774c795b
commit
5698aa66d2
|
|
@ -10,7 +10,6 @@ import datetime
|
||||||
import hashlib
|
import hashlib
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import stat
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import shlex
|
import shlex
|
||||||
import shutil
|
import shutil
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
import ipaddress
|
import ipaddress
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
import stat
|
||||||
import subprocess
|
import subprocess
|
||||||
import shlex
|
import shlex
|
||||||
import shutil
|
import shutil
|
||||||
|
|
@ -131,11 +132,11 @@ def get_image_info(image_path):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
st = os.stat(image_path)
|
st = os.stat(image_path)
|
||||||
self.size = st.st_size
|
image_info.size = st.st_size
|
||||||
self.perms = st.st_mode & (stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO)
|
image_info.perms = st.st_mode & (stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO)
|
||||||
self.mtime = int(st.st_mtime)
|
image_info.mtime = int(st.st_mtime)
|
||||||
except:
|
except Exception as e:
|
||||||
logging.info(f'cannot retrieve stats from {image_path}')
|
logging.info(f'cannot retrieve stats from {image_path}: {e}')
|
||||||
|
|
||||||
return image_info
|
return image_info
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue