From 6c49815d73269fb83fb7d5a7b641da2c5a54ceb3 Mon Sep 17 00:00:00 2001 From: OpenGnSys Support Team Date: Tue, 12 Dec 2023 17:11:48 +0100 Subject: live: report permissions and last update when creating image add .permissions and .lastupdate to json to report to ogserver. --- src/live/ogOperations.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/live/ogOperations.py') diff --git a/src/live/ogOperations.py b/src/live/ogOperations.py index 66f3024..ff1a099 100644 --- a/src/live/ogOperations.py +++ b/src/live/ogOperations.py @@ -10,6 +10,7 @@ import datetime import hashlib import logging import os +import stat import subprocess import shlex import shutil @@ -479,13 +480,19 @@ class OgLiveOperations: raise ValueError('Error: Incorrect command value') try: - stat = os.stat(image_path) - size = stat.st_size + st = os.stat(image_path) + size = st.st_size + perms = st.st_mode & (stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) + mtime = int(st.st_mtime) except: - logging.info(f'cannot retrieve size from {image_path}') + logging.info(f'cannot retrieve stats from {image_path}') size = 0 + perms = 0 + mtime = 0 image_info.size = size + image_info.perms = perms + image_info.mtime = mtime self._write_md5_file(f'/opt/opengnsys/images/{name}.img') -- cgit v1.2.3-18-g5258