mirror of
https://github.com/PiBrewing/craftbeerpi4.git
synced 2024-12-22 13:34:55 +01:00
test for log export fix (plugins)
This commit is contained in:
parent
6eca1dea68
commit
0dfabde7b3
2 changed files with 29 additions and 2 deletions
|
@ -1,3 +1,3 @@
|
|||
__version__ = "4.3.1"
|
||||
__version__ = "4.3.2.a1"
|
||||
__codename__ = "Winter Storm"
|
||||
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
import logging
|
||||
import os
|
||||
import importlib, importlib_metadata
|
||||
#from importlib_metadata import metadata
|
||||
import pkgutil
|
||||
import shutil
|
||||
import psutil
|
||||
from tabulate import tabulate
|
||||
import pathlib
|
||||
import json
|
||||
import aiohttp
|
||||
|
@ -60,7 +64,11 @@ class SystemController:
|
|||
else:
|
||||
os.system('journalctl --since \"{} hours ago\" -u craftbeerpi.service --output cat > {}'.format(logtime, fullname))
|
||||
|
||||
os.system('cbpi plugins > {}'.format(fullpluginname))
|
||||
plugins=self.plugins_list()
|
||||
with open(fullpluginname) as f:
|
||||
f.write(plugins)
|
||||
|
||||
#os.system('cbpi plugins > {}'.format(fullpluginname))
|
||||
|
||||
try:
|
||||
actors = self.cbpi.actor.get_state()
|
||||
|
@ -105,6 +113,25 @@ class SystemController:
|
|||
for filename in filenames:
|
||||
shutil.chown(os.path.join(dirpath, filename), owner, group)
|
||||
|
||||
def plugins_list(self):
|
||||
result = []
|
||||
|
||||
discovered_plugins = {
|
||||
name: importlib.import_module(name)
|
||||
for finder, name, ispkg
|
||||
in pkgutil.iter_modules()
|
||||
if name.startswith('cbpi') and len(name) > 4
|
||||
}
|
||||
for key, module in discovered_plugins.items():
|
||||
try:
|
||||
meta = importlib_metadata.metadata(key)
|
||||
result.append(dict(Name=meta["Name"], Version=meta["Version"], Author=meta["Author"], Homepage=meta["Home-page"], Summary=meta["Summary"]))
|
||||
|
||||
except Exception as e:
|
||||
print(e)
|
||||
#print(tabulate(result, headers="keys"))
|
||||
return tabulate(result, headers="keys")
|
||||
|
||||
async def restoreConfig(self, data):
|
||||
fileData = data['File']
|
||||
filename = fileData.filename
|
||||
|
|
Loading…
Reference in a new issue