mirror of
https://github.com/PiBrewing/craftbeerpi4.git
synced 2024-11-09 17:07:43 +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"
|
__codename__ = "Winter Storm"
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
import importlib, importlib_metadata
|
||||||
|
#from importlib_metadata import metadata
|
||||||
|
import pkgutil
|
||||||
import shutil
|
import shutil
|
||||||
import psutil
|
import psutil
|
||||||
|
from tabulate import tabulate
|
||||||
import pathlib
|
import pathlib
|
||||||
import json
|
import json
|
||||||
import aiohttp
|
import aiohttp
|
||||||
|
@ -60,7 +64,11 @@ class SystemController:
|
||||||
else:
|
else:
|
||||||
os.system('journalctl --since \"{} hours ago\" -u craftbeerpi.service --output cat > {}'.format(logtime, fullname))
|
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:
|
try:
|
||||||
actors = self.cbpi.actor.get_state()
|
actors = self.cbpi.actor.get_state()
|
||||||
|
@ -105,6 +113,25 @@ class SystemController:
|
||||||
for filename in filenames:
|
for filename in filenames:
|
||||||
shutil.chown(os.path.join(dirpath, filename), owner, group)
|
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):
|
async def restoreConfig(self, data):
|
||||||
fileData = data['File']
|
fileData = data['File']
|
||||||
filename = fileData.filename
|
filename = fileData.filename
|
||||||
|
|
Loading…
Reference in a new issue