mirror of
https://github.com/Snigdha-OS/snigdhaos-blackbox.git
synced 2025-09-21 20:15:02 +02:00
log_package_status()
This commit is contained in:

committed by
GitHub

parent
672454b534
commit
b9c90c1809
@@ -2147,4 +2147,37 @@ def import_packages(self):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error("Exception in import_packages(): %s" % e)
|
logger.error("Exception in import_packages(): %s" % e)
|
||||||
finally:
|
finally:
|
||||||
self.pkg_err_queue.put(package_err)
|
self.pkg_err_queue.put(package_err)
|
||||||
|
|
||||||
|
def log_package_status(self):
|
||||||
|
logger.info("Logging package status")
|
||||||
|
packages_status_list = None
|
||||||
|
package_err = None
|
||||||
|
while True:
|
||||||
|
try:
|
||||||
|
time.sleep(0.2)
|
||||||
|
packages_status_list = self.pkg_status_queue.get()
|
||||||
|
package_err = self.pkg_err_queue.get()
|
||||||
|
finally:
|
||||||
|
self.pkg_status_queue.task_done()
|
||||||
|
self.pkg_err_queue.task_done()
|
||||||
|
with open(self.logfile, "w") as f:
|
||||||
|
f.write(
|
||||||
|
"# This file was auto-generated by Sofirem on %s at %s\n"
|
||||||
|
% (
|
||||||
|
datetime.today().date(),
|
||||||
|
datetime.now().strftime("%H:%M:%S"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
if packages_status_list is not None:
|
||||||
|
for package in packages_status_list:
|
||||||
|
if package.split("->")[0].strip() in package_err:
|
||||||
|
f.write("%s\n" % package)
|
||||||
|
f.write(
|
||||||
|
"\tERROR: %s\n"
|
||||||
|
% package_err[package.split("->")[0].strip()]
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
f.write("%s\n" % package)
|
||||||
|
break
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user